public void BeginConversation_SetsLastCreatedConversationAsActive() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); var conversation1 = conversationManager.BeginConversation(); Assert.IsTrue(conversation1.IsActive); var conversation2 = conversationManager.BeginConversation(); Assert.IsTrue(conversation2.IsActive); Assert.IsFalse(conversation1.IsActive); }
public void DeactivateConversation_GivenAConversation_SetsItAsNotActive() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); var conversation1 = conversationManager.BeginConversation(); conversationManager.DeactivateConversation(conversation1); Assert.IsFalse(conversation1.IsActive); }
public void BeginConversation_WhenThereAreMultipleFactories_ThrowsInvalidOperationException() { configuration.Properties["session_factory_name"] = "TestFactory2"; var factory = configuration.BuildSessionFactory(); validsessionFactoryManager.AddFactory(factory); var sut = new NHibernateConversationManager(validsessionFactoryManager); Assert.Throws<InvalidOperationException>(() => sut.BeginConversation()); }
public void GetActiveConversation_ReturnsTheCurrentConversation() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); var conversation = conversationManager.BeginConversation(); Assert.IsTrue(conversation.IsActive); Assert.AreSame(conversation, conversationManager.GetActiveConversation()); }
public void BeginConversation_IsAbleToBeginAConversation() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); var conversation = conversationManager.BeginConversation(); Assert.IsNotNull(conversation); }
public void BeginConversation_GivenSessionFactoryName_BeginsAConversationForTheSessionFactory() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); var conversation = conversationManager.BeginConversation("TestFactory"); Assert.IsNotNull(conversation); }
public void BeginConversation_GivenANonExistentSessionFactoryName_ThrowsInvalidOperationException() { var conversationManager = new NHibernateConversationManager(validsessionFactoryManager); Assert.Throws<InvalidOperationException>(() => conversationManager.BeginConversation("UNEXISTENT")); }