Use in-memory runtime state with SQLite write-through

This commit is contained in:
2026-02-24 23:13:20 +01:00
parent f212636feb
commit 5c199b4468
4 changed files with 743 additions and 455 deletions

View File

@@ -205,10 +205,11 @@ public sealed class UnitTest1 : IClassFixture<WebApplicationFactory<Program>>
services.AddSingleton<IDiceRoller>(new FixedDiceRoller(rollValues));
services.RemoveAll<DbContextOptions<RpgRollerDbContext>>();
services.RemoveAll<IDbContextFactory<RpgRollerDbContext>>();
services.RemoveAll<RpgRollerDbContext>();
var dbPath = Path.Combine(Path.GetTempPath(), $"rpgroller-tests-{Guid.NewGuid():N}.db");
services.AddDbContext<RpgRollerDbContext>(options => options.UseSqlite($"Data Source={dbPath}"));
services.AddDbContextFactory<RpgRollerDbContext>(options => options.UseSqlite($"Data Source={dbPath}"));
}));
}