public void ShouldBeInitialisedToNull() { // arrange SimpleSessionStorage storage = new SimpleSessionStorage(); // act IUnitOfWork uow = storage.GetCurrentUnitOfWork(); // assert Assert.AreEqual(null, uow); }
public void ShouldGetAndSetUnitOfWork() { // arrange SimpleSessionStorage storage = new SimpleSessionStorage(); // act storage.SetCurrentUnitOfWork(m_uow.Object); IUnitOfWork uow = storage.GetCurrentUnitOfWork(); // assert Assert.IsTrue(ReferenceEquals(uow, m_uow.Object)); }
private SimpleSessionStorage GetSimpleSessionStorage() { HttpContext context = HttpContext.Current; SimpleSessionStorage storage = context.Items[HttpContextSessionStorageKey] as SimpleSessionStorage; if (storage == null) { storage = new SimpleSessionStorage(); context.Items[HttpContextSessionStorageKey] = storage; } return(storage); }
private static SimpleSessionStorage GetSimpleSessionStorage() { var context = HttpContext.Current; var storage = context.Items[HttpContextSessionStorageKey] as SimpleSessionStorage; if (storage == null) { storage = new SimpleSessionStorage(); context.Items[HttpContextSessionStorageKey] = storage; } return storage; }
public void ShouldDeleteUnitOfWork() { // arrange SimpleSessionStorage storage = new SimpleSessionStorage(); // act storage.SetCurrentUnitOfWork(m_uow.Object); storage.DeleteCurrentUnitOfWork(); IUnitOfWork uow = storage.GetCurrentUnitOfWork(); // assert Assert.AreEqual(null, uow); }
private SimpleSessionStorage GetSimpleSessionStorageForThread() { var currentThreadName = this.GetCurrentThreadName(); SimpleSessionStorage sessionStorage; if (!this.perThreadSessionStorage.TryGetValue(currentThreadName, out sessionStorage)) { sessionStorage = new SimpleSessionStorage(); this.perThreadSessionStorage.Add(currentThreadName, sessionStorage); } return(sessionStorage); }
public System.Collections.Generic.IEnumerable <ISession> GetAllSessions() { SimpleSessionStorage storage = GetSimpleSessionStorage(); return(storage.GetAllSessions()); }
public void SetSessionForKey(string factoryKey, ISession session) { SimpleSessionStorage storage = GetSimpleSessionStorage(); storage.SetSessionForKey(factoryKey, session); }
public ISession GetSessionForKey(string factoryKey) { SimpleSessionStorage storage = GetSimpleSessionStorage(); return(storage.GetSessionForKey(factoryKey)); }