Skip to content

Commit

Permalink
feat(tests): ignore ManyServiceProvidersCreatedWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
pogromistik committed Mar 27, 2024
1 parent 0c147e1 commit ad46875
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/Sitko.Core.Xunit/DbBaseTestScope.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -124,9 +125,12 @@ protected virtual void ConfigureInMemoryDatabaseModule(DbContextOptionsBuilder b

protected virtual void ConfigurePostgresDatabaseModule<TSomeDbContext>(IApplicationContext applicationContext,
PostgresDatabaseModuleOptions<TSomeDbContext> 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -28,11 +27,6 @@ protected override void ConfigurePostgresDatabaseModule<TSomeDbContext>(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)
Expand Down

0 comments on commit ad46875

Please sign in to comment.