public void WhenDisposed_ThenSessionIsReleasedForCurrentThread() { var sessionFactoryMock = new Mock<ISessionFactory>(); var session = new Mock<ISession>().Object; var testee = new ActiveMqTransaction(sessionFactoryMock.Object, session); testee.Dispose(); sessionFactoryMock.Verify(sf => sf.RemoveSessionForCurrentThread()); }
public void WhenDisposed_ThenSessionIsRolledBack() { var sessionFactoryMock = new Mock<ISessionFactory>(); var sessionMock = new Mock<ISession>(); var testee = new ActiveMqTransaction(sessionFactoryMock.Object, sessionMock.Object); testee.Dispose(); sessionMock.Verify(s => s.Rollback()); sessionMock.Verify(s => s.Commit(), Times.Never()); }
public void WhenDisposed_ThenSessionIsReleasedForCurrentThread() { var sessionFactoryMock = new Mock <ISessionFactory>(); var session = new Mock <ISession>().Object; var testee = new ActiveMqTransaction(sessionFactoryMock.Object, session); testee.Dispose(); sessionFactoryMock.Verify(sf => sf.RemoveSessionForCurrentThread()); }
public void WhenDisposed_ThenSessionIsRolledBack() { var sessionFactoryMock = new Mock <ISessionFactory>(); var sessionMock = new Mock <ISession>(); var testee = new ActiveMqTransaction(sessionFactoryMock.Object, sessionMock.Object); testee.Dispose(); sessionMock.Verify(s => s.Rollback()); sessionMock.Verify(s => s.Commit(), Times.Never()); }