コード例 #1
0
        public void InitialNodeHasTheInputAsOutput()
        {
            var stage = PipelineTestHelper.Assignable(PipelineSuspensionState.Resume);
            var sut   = new HierarchicalSuspenderNode(stage);

            Assert.AreSame(stage, sut.Output);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }