public HttpContext InitializeHttpContext() { var testContext = new HttpContext( new HttpRequest("", "http://dotnet.try0.jp", ""), new HttpResponse(new StringWriter()) ); var sessionStateContainer = new HttpSessionStateContainer( "", new SessionStateItemCollection(), new HttpStaticObjectsCollection(), 20000, true, HttpCookieMode.UseCookies, SessionStateMode.InProc, false ); SessionStateUtility.AddHttpSessionStateToContext(testContext, sessionStateContainer); HttpContext.Current = testContext; FeedbackMessageStore.Initialize(FeedbackMessageStoreHolder.Instance); return(testContext); }
public HttpContext InitializeHttpContext() { var testContext = new DefaultHttpContext(); testContext.Session = new MockSession(); FeedbackMessageStoreHolder.IsAvailableSession = true; var contextAccessor = new MockHttpContextAccessor(); contextAccessor.HttpContext = testContext; FeedbackMessageStoreHolder.ContextAccessor = contextAccessor; FeedbackMessageStore.Initialize(FeedbackMessageStoreHolder.Instance); return(testContext); }