public void SetSessionForKey_Sets_Session() { //Arrange var storage = new ThreadAndWebSessionStorage(null); //Act storage.SetSessionForKey("blah", MockRepository.GenerateStub<ISession>()); //Assert var session = storage.GetSessionForKey("blah"); Assert.IsNotNull(session); }
public void GetSessionForKey_Returns_Correct_Session() { //Arrange var storage = new ThreadAndWebSessionStorage(null); storage.SetSessionForKey("blah", null); storage.SetSessionForKey("blahs", MockRepository.GenerateStub<ISession>()); storage.SetSessionForKey("blahed", null); //Act var session = storage.GetSessionForKey("blahs"); Assert.IsNotNull(session); }
public void GetAllSessions_Returns_All_Sessions() { //Arrange var storage = new ThreadAndWebSessionStorage(null); storage.SetSessionForKey("blah", MockRepository.GenerateStub<ISession>()); storage.SetSessionForKey("blahs", MockRepository.GenerateStub<ISession>()); //Act var sessions = storage.GetAllSessions(); //Assert Assert.AreEqual(2, sessions.Count()); }
public override void Init() { base.Init(); _threadAndWebSessionStorage = new ThreadAndWebSessionStorage(this); }
private void InitializeNHibernateSessions() { MigrateDatabase(); _threadAndWebSessionStorage = new ThreadAndWebSessionStorage(this); var config = new NHibernateConfiguration(_connectionString); NHibernateSession.Init(_threadAndWebSessionStorage, new[] { Server.MapPath("~/bin/TemplateProject.Infrastructure.dll") }, new AutoPersistenceModelGenerator().Generate(), null, null, null, config); }