コード例 #1
0
 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();
 }
コード例 #2
0
 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();
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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();
        }