diff --git a/src/Sitko.Core.Xunit/DbBaseTestScope.cs b/src/Sitko.Core.Xunit/DbBaseTestScope.cs index 10d1a9f37..430458ce7 100644 --- a/src/Sitko.Core.Xunit/DbBaseTestScope.cs +++ b/src/Sitko.Core.Xunit/DbBaseTestScope.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Sitko.Core.App; @@ -124,9 +125,12 @@ protected virtual void ConfigureInMemoryDatabaseModule(DbContextOptionsBuilder b protected virtual void ConfigurePostgresDatabaseModule(IApplicationContext applicationContext, PostgresDatabaseModuleOptions moduleOptions, Guid applicationId, - string dbName) where TSomeDbContext : DbContext - { - } + string dbName) where TSomeDbContext : DbContext => + moduleOptions.ConfigureDbContextOptions = (builder, _, _) => + { + builder.ConfigureWarnings(configurationBuilder => + configurationBuilder.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)); + }; } public abstract class diff --git a/tests/Sitko.Core.Repository.EntityFrameworkCore.Tests/Data/EFTestScope.cs b/tests/Sitko.Core.Repository.EntityFrameworkCore.Tests/Data/EFTestScope.cs index aad3ae01a..f7cde3a8a 100644 --- a/tests/Sitko.Core.Repository.EntityFrameworkCore.Tests/Data/EFTestScope.cs +++ b/tests/Sitko.Core.Repository.EntityFrameworkCore.Tests/Data/EFTestScope.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Hosting; using Serilog.Events; using Sitko.Core.App; using Sitko.Core.Db.Postgres; @@ -28,11 +27,6 @@ protected override void ConfigurePostgresDatabaseModule(IApplica { base.ConfigurePostgresDatabaseModule(applicationContext, moduleOptions, applicationId, dbName); moduleOptions.Schema = dbName + applicationId; - moduleOptions.ConfigureDbContextOptions = (builder, _, _) => - { - builder.ConfigureWarnings(configurationBuilder => - configurationBuilder.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)); - }; } protected override async Task InitDbContextAsync(TestDbContext dbContext)