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

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

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

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

            var transaction = new EFTransaction(mockTransaction);

            transaction.Commit();

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

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

            transaction.Commit();

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

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

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

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

            transaction.Commit();

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