diff --git a/tests/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetEnvironmentLayoutRendererTests.cs b/tests/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetEnvironmentLayoutRendererTests.cs index e6f3ab19..04a832c9 100644 --- a/tests/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetEnvironmentLayoutRendererTests.cs +++ b/tests/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetEnvironmentLayoutRendererTests.cs @@ -13,7 +13,7 @@ namespace NLog.Web.Tests.LayoutRenderers { - public class AspNetEnvironmentLayoutRendererTests + public class AspNetEnvironmentLayoutRendererTests : TestBase { [Fact] public void SuccessTest() @@ -38,5 +38,16 @@ public void NullTest() string actual = renderer.Render(new LogEventInfo()); Assert.Equal(string.Empty, actual); } + + [Fact] + public void InitCloseTest() + { + var logFactory = new LogFactory().Setup().RegisterNLogWeb().LoadConfiguration(builder => + { + builder.ForTarget().WriteTo(new NLog.Targets.MemoryTarget() { Layout = "${aspnet-environment}" }); + }).LogFactory; + Assert.NotNull(logFactory); + logFactory.Shutdown(); + } } } diff --git a/tests/Shared/LayoutRenderers/AspNetAppBasePathLayoutRendererTests.cs b/tests/Shared/LayoutRenderers/AspNetAppBasePathLayoutRendererTests.cs index 144a0370..a5f4f4ba 100644 --- a/tests/Shared/LayoutRenderers/AspNetAppBasePathLayoutRendererTests.cs +++ b/tests/Shared/LayoutRenderers/AspNetAppBasePathLayoutRendererTests.cs @@ -19,7 +19,7 @@ namespace NLog.Web.Tests.LayoutRenderers { - public class AspNetAppBasePathLayoutRendererTests + public class AspNetAppBasePathLayoutRendererTests : TestBase { [Fact] public void SuccessTest() @@ -61,5 +61,16 @@ public void NullTest() Assert.Equal(AppContext.BaseDirectory, actual); #endif } + + [Fact] + public void InitCloseTest() + { + var logFactory = new LogFactory().Setup().RegisterNLogWeb().LoadConfiguration(builder => + { + builder.ForTarget().WriteTo(new NLog.Targets.MemoryTarget() { Layout = "${aspnet-appbasepath}" }); + }).LogFactory; + Assert.NotNull(logFactory); + logFactory.Shutdown(); + } } } diff --git a/tests/Shared/LayoutRenderers/AspNetWebRootPathLayoutRendererTests.cs b/tests/Shared/LayoutRenderers/AspNetWebRootPathLayoutRendererTests.cs index 1a7fe55e..e02bf9d8 100644 --- a/tests/Shared/LayoutRenderers/AspNetWebRootPathLayoutRendererTests.cs +++ b/tests/Shared/LayoutRenderers/AspNetWebRootPathLayoutRendererTests.cs @@ -19,7 +19,7 @@ namespace NLog.Web.Tests.LayoutRenderers { - public class AspNetWebRootPathLayoutRendererTests + public class AspNetWebRootPathLayoutRendererTests : TestBase { [Fact] public void SuccessTest() @@ -57,5 +57,16 @@ public void NullTest() Assert.Equal(string.Empty, actual); } + + [Fact] + public void InitCloseTest() + { + var logFactory = new LogFactory().Setup().RegisterNLogWeb().LoadConfiguration(builder => + { + builder.ForTarget().WriteTo(new NLog.Targets.MemoryTarget() { Layout = "${aspnet-webrootpath}" }); + }).LogFactory; + Assert.NotNull(logFactory); + logFactory.Shutdown(); + } } } diff --git a/tests/Shared/LayoutRenderers/IISInstanceNameLayoutRendererTests.cs b/tests/Shared/LayoutRenderers/IISInstanceNameLayoutRendererTests.cs index 7a421e65..6eab02b3 100644 --- a/tests/Shared/LayoutRenderers/IISInstanceNameLayoutRendererTests.cs +++ b/tests/Shared/LayoutRenderers/IISInstanceNameLayoutRendererTests.cs @@ -18,7 +18,7 @@ namespace NLog.Web.Tests.LayoutRenderers { - public class IISInstanceNameLayoutRendererTests + public class IISInstanceNameLayoutRendererTests : TestBase { [Fact] public void SuccessTest() @@ -57,5 +57,16 @@ public void NullTest() Assert.Equal(string.Empty, actual); } + + [Fact] + public void InitCloseTest() + { + var logFactory = new LogFactory().Setup().RegisterNLogWeb().LoadConfiguration(builder => + { + builder.ForTarget().WriteTo(new NLog.Targets.MemoryTarget() { Layout = "${iis-site-name}" }); + }).LogFactory; + Assert.NotNull(logFactory); + logFactory.Shutdown(); + } } }