Exemple #1
0
        public void InvalidationHappensOnlyOnComplete()
        {
            var value = Assignable(1);
            var other = Assignable("hello");

            var test1 = value.AttachTestStage();
            var test2 = other.AttachTestStage();

            var sut = new PipelineTransaction()
                      .Update(value, 2)
                      .Update(other);

            test1.AssertNotInvalidatedNorRetrieved();
            test2.AssertNotInvalidatedNorRetrieved();

            sut.Commit();

            test1.AssertInvalidations(1);
            test2.AssertInvalidations(1);
        }
Exemple #2
0
        public void MultipleUpdatesAreAllPropagated(int numStages, int updates)
        {
            var stages = Enumerable.Range(0, numStages).Select(i => Assignable(i)).ToArray();
            var tests  = stages.Select(s => s.AttachTestStage()).ToArray();

            var sut = new PipelineTransaction();

            foreach (var stage in stages.Take(updates))
            {
                sut.Update(stage, numStages);
            }
            sut.Commit();

            foreach (var test in tests.Take(updates))
            {
                test.AssertInvalidations(1);
            }

            foreach (var test in tests.Skip(updates))
            {
                test.AssertNotInvalidatedNorRetrieved();
            }
        }