diff options
author | crupest <crupest@outlook.com> | 2019-02-04 23:25:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-02-04 23:25:33 +0800 |
commit | 4fea4164fad943eebc1850042994fdbaad3682f9 (patch) | |
tree | 36522d986769b0520afd53a791674644305a1dd1 /Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs | |
download | timeline-4fea4164fad943eebc1850042994fdbaad3682f9.tar.gz timeline-4fea4164fad943eebc1850042994fdbaad3682f9.tar.bz2 timeline-4fea4164fad943eebc1850042994fdbaad3682f9.zip |
Init commit.
Diffstat (limited to 'Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs')
-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); + }); + }); + } + } +} |