aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/Helpers/TestApplication.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-05-15 22:31:59 +0800
committercrupest <crupest@outlook.com>2021-05-15 22:31:59 +0800
commitd832591db5ddc594a97cc8a75739e0868094e3ec (patch)
tree97cb22dd8e60a0372d6abcb7992dc18caa0d1604 /BackEnd/Timeline.Tests/Helpers/TestApplication.cs
parent8f88c6c995b340a64086aedd27d312d5732d3e7d (diff)
downloadtimeline-d832591db5ddc594a97cc8a75739e0868094e3ec.tar.gz
timeline-d832591db5ddc594a97cc8a75739e0868094e3ec.tar.bz2
timeline-d832591db5ddc594a97cc8a75739e0868094e3ec.zip
test: Use xunit logging output.
Diffstat (limited to 'BackEnd/Timeline.Tests/Helpers/TestApplication.cs')
-rw-r--r--BackEnd/Timeline.Tests/Helpers/TestApplication.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/Helpers/TestApplication.cs b/BackEnd/Timeline.Tests/Helpers/TestApplication.cs
index 723ef500..2c2856c1 100644
--- a/BackEnd/Timeline.Tests/Helpers/TestApplication.cs
+++ b/BackEnd/Timeline.Tests/Helpers/TestApplication.cs
@@ -4,16 +4,25 @@ using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Timeline.Configs;
using Xunit;
+using Xunit.Abstractions;
namespace Timeline.Tests.Helpers
{
public class TestApplication : IAsyncLifetime
{
+ private readonly ITestOutputHelper _testOutputHelper;
+
+ public TestApplication(ITestOutputHelper testOutputHelper)
+ {
+ _testOutputHelper = testOutputHelper;
+ }
+
public IHost Host { get; private set; } = default!;
public string WorkDirectory { get; private set; } = default!;
@@ -24,6 +33,11 @@ namespace Timeline.Tests.Helpers
Directory.CreateDirectory(WorkDirectory);
Host = await Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder()
+ .ConfigureLogging(logging =>
+ {
+ logging.ClearProviders();
+ logging.AddXUnit(_testOutputHelper);
+ })
.ConfigureAppConfiguration((context, config) =>
{
config.AddInMemoryCollection(new Dictionary<string, string>