diff options
author | 杨宇千 <crupest@outlook.com> | 2019-09-25 21:35:35 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-09-25 21:35:35 +0800 |
commit | e1fb12bafa9bb5b1d657d223a4131c63cd4c2349 (patch) | |
tree | 6badcfb14fd9fb17c6ae467e2a767b6d72a282e9 /Timeline.Tests/Helpers | |
parent | c0292eeb2eb1d531cede4b3fdfead86a86730056 (diff) | |
download | timeline-e1fb12bafa9bb5b1d657d223a4131c63cd4c2349.tar.gz timeline-e1fb12bafa9bb5b1d657d223a4131c63cd4c2349.tar.bz2 timeline-e1fb12bafa9bb5b1d657d223a4131c63cd4c2349.zip |
Init migration to dotnet core 3.0.0 .
Diffstat (limited to 'Timeline.Tests/Helpers')
-rw-r--r-- | Timeline.Tests/Helpers/MyTestLoggerFactory.cs | 21 | ||||
-rw-r--r-- | Timeline.Tests/Helpers/MyWebApplicationFactory.cs | 6 |
2 files changed, 17 insertions, 10 deletions
diff --git a/Timeline.Tests/Helpers/MyTestLoggerFactory.cs b/Timeline.Tests/Helpers/MyTestLoggerFactory.cs index 40c6a77e..b9960378 100644 --- a/Timeline.Tests/Helpers/MyTestLoggerFactory.cs +++ b/Timeline.Tests/Helpers/MyTestLoggerFactory.cs @@ -1,14 +1,25 @@ -using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Testing;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
using Xunit.Abstractions;
namespace Timeline.Tests.Helpers
{
- public static class MyTestLoggerFactory
+ public static class Logging
{
- public static LoggerFactory Create(ITestOutputHelper outputHelper)
+ public static ILoggerFactory Create(ITestOutputHelper outputHelper)
{
- return new LoggerFactory(new[] { new XunitLoggerProvider(outputHelper) });
+ // TODO: Use test output.
+ return NullLoggerFactory.Instance;
+ }
+
+ public static IWebHostBuilder ConfigureTestLogging(this IWebHostBuilder builder)
+ {
+ builder.ConfigureLogging(logging =>
+ {
+ //logging.AddXunit(outputHelper);
+ });
+ return builder;
}
}
}
diff --git a/Timeline.Tests/Helpers/MyWebApplicationFactory.cs b/Timeline.Tests/Helpers/MyWebApplicationFactory.cs index 1a9fe01e..dfbe6620 100644 --- a/Timeline.Tests/Helpers/MyWebApplicationFactory.cs +++ b/Timeline.Tests/Helpers/MyWebApplicationFactory.cs @@ -58,11 +58,7 @@ namespace Timeline.Tests.Helpers return factory.WithWebHostBuilder(builder =>
{
- builder
- .ConfigureLogging(logging =>
- {
- logging.AddXunit(outputHelper);
- })
+ builder.ConfigureTestLogging()
.ConfigureServices(services =>
{
services.AddEntityFrameworkSqlite();
|