public void Must_first_begin_a_transaction_before_committing() { 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.Commit(); } }
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_commit_to_underlying_NHibernate_transaction() { using (_mocks.Record()) { Expect.Call(this._mockTransaction.IsActive).Return(true); this._mockTransaction.Commit(); } using (_mocks.Playback()) { NHibernateTransactionWrapper transaction2 = new NHibernateTransactionWrapper(this._mockTransaction); transaction2.Commit(); } }