public void Must_first_begin_a_transaction_before_rolling_back() { using (_mocks.Record()) { Expect.Call(this._mockTransaction.IsActive).Return(false); } using (_mocks.Playback()) { NHibernateTransactionWrapper transactionWrapper = new NHibernateTransactionWrapper(this._mockTransaction); // transaction.Begin(); <- We didn't start (or begin) it yet! transactionWrapper.Rollback(); } }
public void Cannot_rollback_an_already_committed_transaction() { using (_mocks.Record()) { Expect.Call(this._mockTransaction.IsActive).Return(true); this._mockTransaction.Commit(); Expect.Call(this._mockTransaction.IsActive).Return(false); } using (_mocks.Playback()) { NHibernateTransactionWrapper transactionWrapper = new NHibernateTransactionWrapper(this._mockTransaction); transactionWrapper.Commit(); transactionWrapper.Rollback(); } }
public void Should_delegate_rollback_to_underlying_NHibernate_transaction() { using (_mocks.Record()) { Expect.Call(this._mockTransaction.IsActive).Return(true); this._mockTransaction.Rollback(); } using (_mocks.Playback()) { NHibernateTransactionWrapper transaction1 = new NHibernateTransactionWrapper(this._mockTransaction); transaction1.Rollback(); } }