public void GetShouldOpenTransactionAndCallSessionGet() { using (mocks.Record()) { factory.Expect(f => f.OpenSession()).Return(session).Repeat.Any(); session.Expect(s => s.Transaction).Return(transaction).Repeat.Any(); transaction.Expect(t => t.IsActive).Return(false).Repeat.Any(); session.Expect(s => s.BeginTransaction()).Return(transaction).Repeat.Once(); transaction.Expect(t => t.Commit()).Repeat.Once(); session.Expect(s => s.Get <object>(1)).Return(null); } using (mocks.Playback()) { unitOfWork.Get <object>(1); } }