diff options
Diffstat (limited to 'Timeline.Tests/Helpers')
-rw-r--r-- | Timeline.Tests/Helpers/MyTestLoggerFactory.cs | 14 | ||||
-rw-r--r-- | Timeline.Tests/Helpers/MyWebApplicationFactory.cs | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/MyTestLoggerFactory.cs b/Timeline.Tests/Helpers/MyTestLoggerFactory.cs new file mode 100644 index 00000000..40c6a77e --- /dev/null +++ b/Timeline.Tests/Helpers/MyTestLoggerFactory.cs @@ -0,0 +1,14 @@ +using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Testing;
+using Xunit.Abstractions;
+
+namespace Timeline.Tests.Helpers
+{
+ public static class MyTestLoggerFactory
+ {
+ public static LoggerFactory Create(ITestOutputHelper outputHelper)
+ {
+ return new LoggerFactory(new[] { new XunitLoggerProvider(outputHelper) });
+ }
+ }
+}
diff --git a/Timeline.Tests/Helpers/MyWebApplicationFactory.cs b/Timeline.Tests/Helpers/MyWebApplicationFactory.cs index dfadd1ae..e96d11fe 100644 --- a/Timeline.Tests/Helpers/MyWebApplicationFactory.cs +++ b/Timeline.Tests/Helpers/MyWebApplicationFactory.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.AspNetCore.TestHost;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
@@ -37,6 +38,10 @@ namespace Timeline.Tests.Helpers {
var options = new DbContextOptionsBuilder<DatabaseContext>()
.UseSqlite(_databaseConnection)
+ .ConfigureWarnings(builder =>
+ {
+ builder.Throw(RelationalEventId.QueryClientEvaluationWarning);
+ })
.Options;
using (var context = new DatabaseContext(options))
|