using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using RadicadeServer.DB; namespace RadicadeServer.Tests; /// /// Builds the options every test context uses. /// /// Each test asks for its own InMemory database, so each one needs its own /// and EF builds a separate internal service /// provider for it. Past twenty of those EF raises /// as an exception, which /// fails whichever tests happen to run after the twentieth provider rather than the test /// that built it. That count is a property of how the harness allocates contexts, not of /// the behaviour under test, so the warning is ignored once here instead of per test. /// internal static class TestDbOptions { public static DbContextOptionsBuilder Create() => new DbContextOptionsBuilder() .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)); }