Example #1
0
        public void Rollback_Calls_Rollback_On_Underlying_ITransaction()
        {
            var mockTransaction = MockRepository.GenerateMock<IDbTransaction>();
            mockTransaction.Expect(x => x.Rollback()).IgnoreArguments();

            var transaction = new EFTransaction(mockTransaction);
            transaction.Rollback();

            mockTransaction.VerifyAllExpectations();
        }
Example #2
0
        public void Rollback_Calls_Rollback_On_Underlying_ITransaction()
        {
            var mockTransaction = MockRepository.GenerateMock <IDbTransaction>();

            mockTransaction.Expect(x => x.Rollback()).IgnoreArguments();

            var transaction = new EFTransaction(mockTransaction);

            transaction.Rollback();

            mockTransaction.VerifyAllExpectations();
        }
Example #3
0
        public void Rollback_Raises_RollbackComitted_Event()
        {
            var mockTransaction = MockRepository.GenerateMock <IDbTransaction>();

            mockTransaction.Expect(x => x.Rollback());

            bool commitCalled   = false;
            bool rollbackCalled = false;
            var  transaction    = new EFTransaction(mockTransaction);

            transaction.TransactionCommitted  += delegate { commitCalled = true; };
            transaction.TransactionRolledback += delegate { rollbackCalled = true; };

            transaction.Rollback();

            mockTransaction.VerifyAllExpectations();
            Assert.That(!commitCalled);
            Assert.That(rollbackCalled);
        }
Example #4
0
        public void Rollback_Raises_RollbackComitted_Event()
        {
            var mockTransaction = MockRepository.GenerateMock<IDbTransaction>();
            mockTransaction.Expect(x => x.Rollback());

            bool commitCalled = false;
            bool rollbackCalled = false;
            var transaction = new EFTransaction(mockTransaction);
            transaction.TransactionCommitted += delegate { commitCalled = true; };
            transaction.TransactionRolledback += delegate { rollbackCalled = true; };

            transaction.Rollback();

            mockTransaction.VerifyAllExpectations();
            Assert.That(!commitCalled);
            Assert.That(rollbackCalled);
        }