public void Commit_Calls_Commit_On_Underlying_ITransaction()
        {
            var mockTransaction = MockRepository.GenerateMock<IDbTransaction>();
            mockTransaction.Expect(x => x.Commit()).IgnoreArguments();

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

            mockTransaction.VerifyAllExpectations();
        }
        public void Commit_Calls_Commit_On_Underlying_ITransaction()
        {
            var mockTransaction = MockRepository.GenerateMock <IDbTransaction>();

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

            var transaction = new LinqToSqlTransaction(mockTransaction);

            transaction.Commit();

            mockTransaction.VerifyAllExpectations();
        }
        public void Commit_Raises_TransactionComitted_Event()
        {
            var mockTransaction = MockRepository.GenerateMock<IDbTransaction>();
            mockTransaction.Expect(x => x.Commit());

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

            transaction.Commit();

            mockTransaction.VerifyAllExpectations();
            Assert.That(commitCalled);
            Assert.That(!rollbackCalled);
        }
        public void Commit_Raises_TransactionComitted_Event()
        {
            var mockTransaction = MockRepository.GenerateMock <IDbTransaction>();

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

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

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

            transaction.Commit();

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