public void StagePassesPreviousValueThrough()
        {
            var previous  = 10.AsPipelineConstant();
            var exclusive = 100.AsPipelineConstant();
            var sut       = new MutuallyExclusivePipelineStage <int>(previous, exclusive);

            PipelineAssert.Value(sut, previous.GetValue());
        }
        public void InputAndAllExclusiveStagesAreAddedAsDependencies(int numExclusive)
        {
            var input     = 10.AsPipelineConstant();
            var exclusive = Enumerable.Range(0, numExclusive).Select(i => i.AsPipelineConstant()).ToArray();
            var sut       = new MutuallyExclusivePipelineStage <int>(input, exclusive);

            PipelineAssert.DependentOn(sut, exclusive.Append(input).ToArray());
        }
        public void StageIsNotInvalidatedWhenAtLeastOneMutuallyExclusiveStageIsInvalidated(int totalExclusiveStages, int invalidations)
        {
            var previous  = 10.AsPipelineConstant();
            var exclusive = Enumerable.Range(0, totalExclusiveStages).Select(i => i.AsPipelineConstant()).ToArray();
            var sut       = new MutuallyExclusivePipelineStage <int>(previous, exclusive);
            var test      = sut.AttachTestStage();

            PipelineCore.Invalidate(new[] { previous }.Concat(exclusive.Take(invalidations)));
            test.AssertInvalidations(0);

            PipelineCore.Invalidate(new[] { sut }.Concat(exclusive.Take(invalidations)));
            test.AssertInvalidations(0);
        }
        public void StageIsInvalidatedWhenNoMutuallyExclusiveStagesAre()
        {
            var previous  = 10.AsPipelineConstant();
            var exclusive = 100.AsPipelineConstant();
            var sut       = new MutuallyExclusivePipelineStage <int>(previous, exclusive);
            var test      = sut.AttachTestStage();

            previous.Invalidate();
            test.AssertInvalidations(1);

            sut.Invalidate();
            test.AssertInvalidations(2);
        }