diff --git a/tests/NLog.Web.AspNetCore.Tests/AspNetCoreTests.cs b/tests/NLog.Web.AspNetCore.Tests/AspNetCoreTests.cs index da5ad1f0..536dc630 100644 --- a/tests/NLog.Web.AspNetCore.Tests/AspNetCoreTests.cs +++ b/tests/NLog.Web.AspNetCore.Tests/AspNetCoreTests.cs @@ -81,17 +81,19 @@ public void UseNLogContentRootTest() System.IO.Directory.CreateDirectory(tempPath); System.IO.Directory.SetCurrentDirectory(tempPath); + var configChanged = false; + + LogManager.ConfigurationChanged += (args, sender) => configChanged = true; + using var webhost = CreateWebHost(); var hostEnvironment = webhost.Services.GetRequiredService(); Assert.NotNull(hostEnvironment.ContentRootPath); + Assert.False(configChanged); // Scanned ContentRoot without assigning any default config var loggerFact = GetLoggerFactory(webhost.Services); - Assert.NotNull(loggerFact); - Assert.Null(LogManager.Configuration); // Scanned ContentRoot without assigning any default config - var configuration = CreateConfigWithMemoryTarget(out var target, "${logger}|${message}|${callsite}"); LogManager.Setup().RegisterNLogWeb(serviceProvider: webhost.Services).LoadConfiguration(configuration);