public void NullHttpContextRendersEmptyString() { var renderer = new AspNetApplicationValueLayoutRenderer(); string result = renderer.Render(new LogEventInfo()); Assert.Empty(result); }
public void VariableNotFoundRendersEmptyString() { var httpContext = Substitute.For <HttpContextBase>(); var renderer = new AspNetApplicationValueLayoutRenderer(); renderer.Variable = "key"; renderer.HttpContextAccessor = new FakeHttpContextAccessor(httpContext); string result = renderer.Render(new LogEventInfo()); Assert.Empty(result); }
public void VariableFoundRendersValue(object expectedValue) { var httpContext = Substitute.For <HttpContextBase>(); httpContext.Application["key"].Returns(expectedValue); var renderer = new AspNetApplicationValueLayoutRenderer(); renderer.Variable = "key"; renderer.HttpContextAccessor = new FakeHttpContextAccessor(httpContext); string result = renderer.Render(new LogEventInfo()); Assert.Equal(Convert.ToString(expectedValue, CultureInfo.CurrentUICulture), result); }