public void InitialNodeHasTheInputAsOutput() { var stage = PipelineTestHelper.Assignable(PipelineSuspensionState.Resume); var sut = new HierarchicalSuspenderNode(stage); Assert.AreSame(stage, sut.Output); }
public void HierarchyPropagateSuspensionStateAsExpected( PipelineSuspensionState root, PipelineSuspensionState[] hierarchy, HierarchicalBehavior[] behaviors, PipelineSuspensionState expectedFinalState) { var parent = new HierarchicalSuspenderNode(root.AsPipelineConstant()); var lastStage = hierarchy.Zip(behaviors, (a, b) => (input: a, behavior: b)).Aggregate(parent, (acc, next) => acc.CreateChild(next.input.AsPipelineConstant(), next.behavior)); PipelineAssert.Value(lastStage.Output, expectedFinalState); }
public void CreatingSuspenderStageFromHierarchyWillGetHierarchySuspensionState(PipelineSuspensionState state, bool expectInvalidation) { var hierarchy = new HierarchicalSuspenderNode(state.AsPipelineConstant()); var input = PipelineTestHelper.Assignable(1); var sut = hierarchy.WithSuspender(input); var test = sut.AttachTestStage(); input.SetValue(10); if (expectInvalidation) { test.AssertInvalidations(1); } else { test.AssertInvalidations(0); } }