コード例 #1
0
        public void SettingANewSourceWithoutInvalidateCausesNoInvalidation()
        {
            var sut  = new SourceSelectPipelineStage <string>("", "".AsPipelineConstant());
            var test = sut.AttachTestStage();

            Assert.IsTrue(sut.SetSourceWithoutInvalidating("Derpface".AsPipelineConstant()));
            test.AssertInvalidations(0);
        }
コード例 #2
0
        public void ValueIsTakenFromCurrentSource()
        {
            var sut = new SourceSelectPipelineStage <string>("", "Hello, World?".AsPipelineConstant());

            PipelineAssert.Value(sut, "Hello, World?");

            sut.SetSource("Whazzup?".AsPipelineConstant());
            PipelineAssert.Value(sut, "Whazzup?");

            sut.SetSourceWithoutInvalidating("Yo!".AsPipelineConstant());
            PipelineAssert.Value(sut, "Yo!");
        }
コード例 #3
0
        public void SettingANewSourceRemovesOldDependencyANdAddsNew()
        {
            var input = 1.AsPipelineConstant();
            var sut   = new SourceSelectPipelineStage <int>("", input);

            PipelineAssert.DependentOn(sut, input);

            var input2 = 2.AsPipelineConstant();

            sut.SetSource(input2);
            PipelineAssert.NotDependentOn(sut, input);
            PipelineAssert.DependentOn(sut, input2);

            var input3 = 3.AsPipelineConstant();

            sut.SetSourceWithoutInvalidating(input3);
            PipelineAssert.NotDependentOn(sut, input2);
            PipelineAssert.DependentOn(sut, input3);
        }
コード例 #4
0
        /// <summary>
        /// Adds an update to an <see cref="SourceSelectPipelineStage{TValue}"/>.
        /// </summary>
        /// <typeparam name="TValue">The data type.</typeparam>
        /// <param name="transaction">The transaction.</param>
        /// <param name="stage">The stage to set value for.</param>
        /// <param name="newSource">The new source.</param>
        /// <returns>The same transaction object.</returns>
        public static IPipelineTransaction Update <TValue>(this IPipelineTransaction transaction, SourceSelectPipelineStage <TValue> stage, IPipelineStage <TValue> newSource)
        {
            bool SourceSelectUpdate() => stage.SetSourceWithoutInvalidating(newSource);

            return(transaction.Update(stage, SourceSelectUpdate));
        }