diff options
Diffstat (limited to 'Timeline.Tests/Helpers')
-rw-r--r-- | Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs new file mode 100644 index 00000000..bb8fc71b --- /dev/null +++ b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.Extensions.Logging; +using Xunit.Abstractions; + +namespace Timeline.Tests.Helpers +{ + public static class WebApplicationFactoryExtensions + { + public static WebApplicationFactory<TEntry> WithTestConfig<TEntry>(this WebApplicationFactory<TEntry> factory, ITestOutputHelper outputHelper) where TEntry : class + { + return factory.WithWebHostBuilder(builder => + { + builder + .UseEnvironment(EnvironmentConstants.TestEnvironmentName) + .ConfigureLogging(logging => + { + logging.AddXunit(outputHelper); + }); + }); + } + } +} |