private static (AspNetSessionValueLayoutRenderer, HttpContext) CreateRenderer(bool throwsError = false) { var(renderer, httpContext) = CreateWithHttpContext(); var mockSession = new SessionMock(throwsError); mockSession.SetString("a", "https://duckduckgo.com"); httpContext.Session = mockSession; httpContext.Items = new Dictionary <object, object>(); var sessionFeature = new SessionFeatureMock(mockSession); httpContext.Features.Get <ISessionFeature>().Returns(sessionFeature); return(renderer, httpContext); }