public void TransactionCannotBeUsedAfterBeingCommitted()
        {
            var control = PipelineTestHelper.TransactionControlMock();
            var sut     = new DeferredPipelineTransaction(control.Object);

            sut.Commit();

            Assert.Throws <InvalidOperationException>(() => sut.Update(1.AsPipelineConstant(), () => true));
            Assert.Throws <InvalidOperationException>(() => sut.Commit());
            Assert.Throws <InvalidOperationException>(() => sut.Cancel());
        }
        public void CanceledTransactionDoesNotInvokeAnyOfTheUpdates()
        {
            var value = PipelineTestHelper.Assignable(1);
            var other = PipelineTestHelper.Assignable("hello");

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

            var control = PipelineTestHelper.TransactionControlMock();
            var sut     = new DeferredPipelineTransaction(control.Object)
                          .Update(value, 2)
                          .Update(other, "hello 2");

            sut.Cancel();

            test1.AssertNotInvalidatedNorRetrieved();
            test2.AssertNotInvalidatedNorRetrieved();
            PipelineAssert.Value(value, 1);
            PipelineAssert.Value(other, "hello");
        }