From fdc51c9e4ac225311e4e14923e6b48efbd05a6e1 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 4 Feb 2019 23:25:33 +0800 Subject: Init commit. --- .../Helpers/WebApplicationFactoryExtensions.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs (limited to 'Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs') 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 WithTestConfig(this WebApplicationFactory factory, ITestOutputHelper outputHelper) where TEntry : class + { + return factory.WithWebHostBuilder(builder => + { + builder + .UseEnvironment(EnvironmentConstants.TestEnvironmentName) + .ConfigureLogging(logging => + { + logging.AddXunit(outputHelper); + }); + }); + } + } +} -- cgit v1.2.3