public void Rollback_Calls_Rollback_On_Underlying_ITransaction() { var mockContainer = MockRepository.GenerateMock<IObjectContainer>(); var transaction = new Db4oTransaction(mockContainer); transaction.Rollback(); mockContainer.AssertWasCalled(x => x.Rollback()); mockContainer.VerifyAllExpectations(); }
public void Commit_Calls_Commit_On_Underlying_Container() { var mockContainer = MockRepository.GenerateMock<IObjectContainer>(); var transaction = new Db4oTransaction(mockContainer); transaction.Commit(); mockContainer.AssertWasCalled(x => x.Commit()); mockContainer.VerifyAllExpectations(); }
public void Rollback_Calls_Rollback_On_Underlying_ITransaction() { var mockContainer = MockRepository.GenerateMock <IObjectContainer>(); var transaction = new Db4oTransaction(mockContainer); transaction.Rollback(); mockContainer.AssertWasCalled(x => x.Rollback()); mockContainer.VerifyAllExpectations(); }
public void Commit_Calls_Commit_On_Underlying_Container() { var mockContainer = MockRepository.GenerateMock <IObjectContainer>(); var transaction = new Db4oTransaction(mockContainer); transaction.Commit(); mockContainer.AssertWasCalled(x => x.Commit()); mockContainer.VerifyAllExpectations(); }
public void Rollback_Raises_RollbackComitted_Event() { var mockContainer = MockRepository.GenerateMock<IObjectContainer>(); var commitCalled = false; var rollbackCalled = false; var transaction = new Db4oTransaction(mockContainer); transaction.TransactionCommitted += delegate { commitCalled = true; }; transaction.TransactionRolledback += delegate { rollbackCalled = true; }; transaction.Rollback(); Assert.That(!commitCalled); Assert.That(rollbackCalled); mockContainer.AssertWasCalled(x => x.Rollback()); mockContainer.AssertWasNotCalled(x => x.Commit()); mockContainer.VerifyAllExpectations(); }
public void Rollback_Raises_RollbackComitted_Event() { var mockContainer = MockRepository.GenerateMock <IObjectContainer>(); var commitCalled = false; var rollbackCalled = false; var transaction = new Db4oTransaction(mockContainer); transaction.TransactionCommitted += delegate { commitCalled = true; }; transaction.TransactionRolledback += delegate { rollbackCalled = true; }; transaction.Rollback(); Assert.That(!commitCalled); Assert.That(rollbackCalled); mockContainer.AssertWasCalled(x => x.Rollback()); mockContainer.AssertWasNotCalled(x => x.Commit()); mockContainer.VerifyAllExpectations(); }