public void Open_Should_Clear_Session_If_The_Session_Is_Empty() { var context = HttpContext.CreateWithSession(); var sessionProvider = new SqlSessionStateProvider(); context.SessionState["test"] = "test"; new SessionState(sessionProvider).Load(context); context.SessionState.Count().ShouldEqual(0); }
public void Should_Load_Session() { var sessionStore = Substitute.For <ISqlSessionStateStore>(); sessionStore.Load(null).ReturnsForAnyArgs(Constants.SessionStateSerializedBytes); var sessionState = new SqlSessionStateProvider(sessionStore).Load(_context); sessionState.ShouldNotBeNull(); sessionState.ShouldNotBeEmpty(); sessionState[Constants.SessionStateKey1].ShouldEqual(Constants.SessionStateValue1); sessionState[Constants.SessionStateKey2].ShouldEqual(Constants.SessionStateValue2); sessionState[Constants.SessionStateKey3].ShouldEqual(Constants.SessionStateValue3); }