Simplify WebHostBuilderTests.CanUseCustomLoggerFactory.
- Keep all the code in the test itself, instead of in an extension method. Makes it easier to understand what's happening without having to look up the extension method's definition.
This commit is contained in:
parent
0ab882b6d3
commit
39164eeb40
|
|
@ -18,16 +18,6 @@ namespace Microsoft.AspNetCore.Hosting.Fakes
|
|||
public void Dispose() { }
|
||||
}
|
||||
|
||||
public static class CustomLoggerFactoryExtensions
|
||||
{
|
||||
public static IWebHostBuilder ConfigureCustomLogger(this IWebHostBuilder builder, Action<CustomLoggerFactory> configureLogger)
|
||||
{
|
||||
builder.UseLoggerFactory(_ => new CustomLoggerFactory());
|
||||
builder.ConfigureLogging(configureLogger);
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
public class SubLoggerFactory : CustomLoggerFactory { }
|
||||
|
||||
public class NonSubLoggerFactory : ILoggerFactory
|
||||
|
|
|
|||
|
|
@ -294,7 +294,8 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
public void CanUseCustomLoggerFactory()
|
||||
{
|
||||
var hostBuilder = new WebHostBuilder()
|
||||
.ConfigureCustomLogger(factory =>
|
||||
.UseLoggerFactory(_ => new CustomLoggerFactory())
|
||||
.ConfigureLogging<CustomLoggerFactory>(factory =>
|
||||
{
|
||||
factory.CustomConfigureMethod();
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue