From 23b39271bc2eaca96cd6d1db3f524ce0922d4630 Mon Sep 17 00:00:00 2001 From: Mario Matsov Date: Sun, 10 Sep 2023 16:22:27 +0300 Subject: [PATCH] Ignore warnings for transactions in the tested code --- .../ServiceCollectionEntityFrameworkCoreExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/ServiceCollectionEntityFrameworkCoreExtensions.cs b/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/ServiceCollectionEntityFrameworkCoreExtensions.cs index 446bc97a..8d4ec464 100644 --- a/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/ServiceCollectionEntityFrameworkCoreExtensions.cs +++ b/src/MyTested.AspNetCore.Mvc.EntityFrameworkCore/ServiceCollectionEntityFrameworkCoreExtensions.cs @@ -6,6 +6,7 @@ using Internal.EntityFrameworkCore; using Internal.Services; using Microsoft.EntityFrameworkCore; + using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -83,7 +84,9 @@ private static void AddScopedDatabase(opts => { - opts.UseInMemoryDatabase(Guid.NewGuid().ToString()); + opts + .UseInMemoryDatabase(Guid.NewGuid().ToString()) + .ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning)); ((IDbContextOptionsBuilderInfrastructure)opts).AddOrUpdateExtension(new ScopedInMemoryOptionsExtension()); });