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:
Cesar Blum Silveira 2017-04-05 11:23:54 -07:00 committed by GitHub
parent 0ab882b6d3
commit 39164eeb40
2 changed files with 2 additions and 11 deletions

View File

@ -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

View File

@ -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();
})