Exemplo n.º 1
0
        public void NullHttpContextRendersEmptyString()
        {
            var renderer = new AspNetSessionIDLayoutRenderer();

            string result = renderer.Render(new LogEventInfo());

            Assert.Empty(result);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }