using ZB.MOM.WW.ScadaBridge.Commons.Types.Debugging; namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Debugging; /// /// 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. /// 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().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); } }