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

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

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

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

            var transaction = new LinqToSqlTransaction(mockTransaction);

            transaction.Rollback();

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

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

            var commitCalled   = false;
            var rollbackCalled = false;
            var transaction    = new LinqToSqlTransaction(mockTransaction);

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

            transaction.Rollback();

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

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

            transaction.Rollback();

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