public void ControlRefusesToCommitTransactionThatIsNotRegistered() { var control = new AggregatingTransactionControl(); var transaction = new DeferredPipelineTransaction(new AggregatingTransactionControl()); Assert.Throws <ArgumentException>(() => control.Commit(transaction, Enumerable.Empty <DeferredTransactionPart>())); }
public void TransactionDoesNothingBeforeCommit() { var value = PipelineTestHelper.Assignable(1); var test = value.AttachTestStage(); var control = PipelineTestHelper.TransactionControlMock(); control.Setup(mock => mock.Commit(It.IsAny <DeferredPipelineTransaction>(), It.IsAny <IEnumerable <DeferredTransactionPart> >())) .Callback(new Action <DeferredPipelineTransaction, IEnumerable <DeferredTransactionPart> >((a, b) => { var c = new AggregatingTransactionControl(); c.Register(a); c.Commit(a, b); })); var sut = new DeferredPipelineTransaction(control.Object) .Update(value, 2); control.Verify(mock => mock.Commit(It.IsAny <DeferredPipelineTransaction>(), It.IsAny <IEnumerable <DeferredTransactionPart> >()), Times.Never); PipelineAssert.Value(value, 1); test.AssertNotInvalidatedNorRetrieved(); sut.Commit(); control.Verify(mock => mock.Commit(It.IsAny <DeferredPipelineTransaction>(), It.IsAny <IEnumerable <DeferredTransactionPart> >()), Times.Once); PipelineAssert.Value(value, 2); test.AssertInvalidations(1); }