public void NullHttpContextRendersEmptyString() { var renderer = new AspNetSessionIDLayoutRenderer(); string result = renderer.Render(new LogEventInfo()); Assert.Empty(result); }
public void NullSessionRendersEmptyString() { var httpContext = Substitute.For<HttpContextBase>(); httpContext.Session.Returns(null as HttpSessionStateWrapper); var renderer = new AspNetSessionIDLayoutRenderer(); renderer.HttpContextAccessor = new FakeHttpContextAccessor(httpContext); string result = renderer.Render(new LogEventInfo()); Assert.Empty(result); }
public void AvailableSessionRendersSessionId() { var expectedResult = "value"; var httpContext = Substitute.For<HttpContextBase>(); httpContext.Session.SessionID.Returns(expectedResult); var renderer = new AspNetSessionIDLayoutRenderer(); renderer.HttpContextAccessor = new FakeHttpContextAccessor(httpContext); string result = renderer.Render(new LogEventInfo()); Assert.Equal(expectedResult, result); }