public void TestUnique() { var storage = new SessionDataStorage(); var firstSession = storage.CreateSession(); var secondSession = storage.CreateSession(); Assert.AreNotSame(firstSession, secondSession); Assert.AreNotEqual(firstSession, secondSession); }
public void TestNotNull() { var storage = new SessionDataStorage(); var session = storage.CreateSession(); Assert.NotNull(session); }
public void TestException() { var storage = new SessionDataStorage(); var session = storage.CreateSession(); var newKey = new Guid(); Assert.Throws <KeyNotFoundException>(() => storage.GetSession(newKey)); }
public void TestNotNull() { var storage = new SessionDataStorage(); var session = storage.CreateSession(); var retrievedSession = storage.GetSession(session.Id); Assert.NotNull(retrievedSession); }
public void TestRemaining() { var storage = new SessionDataStorage(); var session = storage.CreateSession(); storage.Cleanup(); var retrievedSession = storage.GetSession(session.Id); Assert.AreSame(session, retrievedSession); }
public void TestGetString() { var storage = new SessionDataStorage(); for (var i = 0; i < 3; i++) { storage.CreateSession(); } var session = storage.CreateSession(); for (var i = 0; i < 7; i++) { storage.CreateSession(); } var retrievedSession = storage.GetSession(session.Id.ToString()); Assert.AreSame(session, retrievedSession); }
public void TestRemoval() { var storage = new SessionDataStorage(); var session = storage.CreateSession(); session.Expiration = DateTime.Now.Subtract(new TimeSpan(1)); var retrievedSession = storage.GetSession(session.Id); Assert.AreSame(session, retrievedSession); storage.Cleanup(); Assert.Throws <KeyNotFoundException>(() => storage.GetSession(session.Id)); }