public void BeginTransaction_Throws_InvalidOperationException_When_Transaction_Already_Running() { var mockContainer = MockRepository.GenerateStub<IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); unitOfWork.BeginTransaction(); Assert.That(unitOfWork.IsInTransaction); Assert.Throws<InvalidOperationException>(() => unitOfWork.BeginTransaction()); }
public void BeginTransaction_Throws_InvalidOperationException_When_Transaction_Already_Running() { var mockContainer = MockRepository.GenerateStub <IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); unitOfWork.BeginTransaction(); Assert.That(unitOfWork.IsInTransaction); Assert.Throws <InvalidOperationException>(() => unitOfWork.BeginTransaction()); }
public void Flush_Does_Nothing_When_A_TransactionHas_Already_Been_Started() { var mockContainer = MockRepository.GenerateMock<IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); unitOfWork.BeginTransaction(); unitOfWork.Flush(); mockContainer.AssertWasNotCalled(x => x.Commit()); mockContainer.AssertWasNotCalled(x => x.Rollback()); mockContainer.VerifyAllExpectations(); }
public void Begin_Transaction_Should_Start_A_New_Transaction_With_Default_IsolationLevel() { var mockContainer = MockRepository.GenerateMock<IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); var transaction = unitOfWork.BeginTransaction(); Assert.That(unitOfWork.IsInTransaction); Assert.That(transaction, Is.Not.Null); mockContainer.VerifyAllExpectations(); }
public void Begin_Transaction_Should_Start_A_New_Transaction_With_Default_IsolationLevel() { var mockContainer = MockRepository.GenerateMock <IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); var transaction = unitOfWork.BeginTransaction(); Assert.That(unitOfWork.IsInTransaction); Assert.That(transaction, Is.Not.Null); mockContainer.VerifyAllExpectations(); }
public void Flush_Does_Nothing_When_A_TransactionHas_Already_Been_Started() { var mockContainer = MockRepository.GenerateMock <IObjectContainer>(); var unitOfWork = new Db4oUnitOfWork(mockContainer); unitOfWork.BeginTransaction(); unitOfWork.Flush(); mockContainer.AssertWasNotCalled(x => x.Commit()); mockContainer.AssertWasNotCalled(x => x.Rollback()); mockContainer.VerifyAllExpectations(); }