Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Commit 39164ee

Browse files
author
Cesar Blum Silveira
authored
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.
1 parent 0ab882b commit 39164ee

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

test/Microsoft.AspNetCore.Hosting.Tests/Fakes/CustomLoggerFactory.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ public void AddProvider(ILoggerProvider provider) { }
1818
public void Dispose() { }
1919
}
2020

21-
public static class CustomLoggerFactoryExtensions
22-
{
23-
public static IWebHostBuilder ConfigureCustomLogger(this IWebHostBuilder builder, Action<CustomLoggerFactory> configureLogger)
24-
{
25-
builder.UseLoggerFactory(_ => new CustomLoggerFactory());
26-
builder.ConfigureLogging(configureLogger);
27-
return builder;
28-
}
29-
}
30-
3121
public class SubLoggerFactory : CustomLoggerFactory { }
3222

3323
public class NonSubLoggerFactory : ILoggerFactory

test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ public void ConfigureLoggingNotCalledIfLoggerFactoryTypeDoesNotMatches()
294294
public void CanUseCustomLoggerFactory()
295295
{
296296
var hostBuilder = new WebHostBuilder()
297-
.ConfigureCustomLogger(factory =>
297+
.UseLoggerFactory(_ => new CustomLoggerFactory())
298+
.ConfigureLogging<CustomLoggerFactory>(factory =>
298299
{
299300
factory.CustomConfigureMethod();
300301
})

0 commit comments

Comments
 (0)