public void ShouldDispose()
 {
     mocks.ReplayAll();
     var sharedUnitOfWork = new SharedNHibernateUnitOfWork(sessionFactoryMock);
     sharedUnitOfWork.Dispose();
     mocks.VerifyAll();
 }
        public void ShouldSaveChanges()
        {
            var currentSession = mocks.DynamicMock<ISession>();
            Expect.Call(sessionFactoryMock.GetCurrentSession()).Return(currentSession);
            Expect.Call(currentSession.Flush);

            mocks.ReplayAll();
            var sharedUnitOfWork = new SharedNHibernateUnitOfWork(sessionFactoryMock);
            sharedUnitOfWork.SaveChanges();
            mocks.VerifyAll();
        }
        public void ShouldGetCurrentSession()
        {
            var currentSession = mocks.DynamicMock<ISession>();
            Expect.Call(sessionFactoryMock.GetCurrentSession()).Return(currentSession);

            mocks.ReplayAll();
            var sharedUnitOfWork = new SharedNHibernateUnitOfWork(sessionFactoryMock);
            var session = sharedUnitOfWork.Session;
            mocks.VerifyAll();

            Assert.Equal(currentSession, session);
        }