feat(commons): Flow Debugger outbound kinds, External lane, Pending/Parked outcomes, FlowLifecycleRow
FlowLane.External (3); FlowStepKind.External replaced by ApiCall/DbCall/Notify; FlowStepOutcome gains Pending/Parked; new FlowLifecycleRow + additive FlowStep.Lifecycle; FlowEdge gains Async/Spawn (default false). Predictor and graph-view references renamed compile-only (full work in Tasks 6/7). Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Types.Debugging;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Debugging;
|
||||
|
||||
/// <summary>
|
||||
/// Flow Debugger outbound-calls plan (2026-09-06) Task 0: the Commons vocabulary — External lane,
|
||||
/// the three outbound kinds, Pending/Parked outcomes, the lifecycle row, and additive edge/step shapes.
|
||||
/// </summary>
|
||||
public class FlowStepProjectorTests
|
||||
{
|
||||
private static readonly DateTimeOffset T0 = new(2026, 9, 6, 12, 0, 0, TimeSpan.Zero);
|
||||
|
||||
[Fact]
|
||||
public void Vocabulary_HasExternalLane_ThreeOutboundKinds_AndPendingParkedOutcomes()
|
||||
{
|
||||
Assert.Equal(3, (int)FlowLane.External);
|
||||
Assert.True(Enum.IsDefined(FlowStepKind.ApiCall));
|
||||
Assert.True(Enum.IsDefined(FlowStepKind.DbCall));
|
||||
Assert.True(Enum.IsDefined(FlowStepKind.Notify));
|
||||
Assert.True(Enum.IsDefined(FlowStepKind.Unknown));
|
||||
Assert.False(Enum.GetNames<FlowStepKind>().Contains("External"));
|
||||
Assert.True(Enum.IsDefined(FlowStepOutcome.Pending));
|
||||
Assert.True(Enum.IsDefined(FlowStepOutcome.Parked));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FlowStep_WithoutLifecycle_StillConstructs_AndDefaultsToNull()
|
||||
{
|
||||
var step = new FlowStep(Guid.NewGuid(), null, null, FlowStepKind.ScriptRun, FlowLane.Site, "S", null,
|
||||
T0, null, FlowStepOutcome.Ok, null, null, null, null, null, null, null, null);
|
||||
Assert.Null(step.Lifecycle);
|
||||
|
||||
var row = new FlowLifecycleRow(Guid.NewGuid(), "CachedSubmit", "Submitted", T0, "node-a", null, null);
|
||||
var withLifecycle = step with { Lifecycle = [row] };
|
||||
Assert.Single(withLifecycle.Lifecycle!);
|
||||
Assert.Equal("Submitted", withLifecycle.Lifecycle![0].Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FlowEdge_AsyncAndSpawn_DefaultFalse()
|
||||
{
|
||||
var a = Guid.NewGuid();
|
||||
var b = Guid.NewGuid();
|
||||
var edge = new FlowEdge(a, b, false, false);
|
||||
Assert.False(edge.Async);
|
||||
Assert.False(edge.Spawn);
|
||||
Assert.True((edge with { Async = true }).Async);
|
||||
Assert.True(new FlowEdge(a, b, false, false, Async: false, Spawn: true).Spawn);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user