Add admin database download

This commit is contained in:
2026-04-01 22:25:43 +02:00
parent 637a2ef7ac
commit b062ad1adf
10 changed files with 132 additions and 7 deletions

View File

@@ -23,6 +23,23 @@ public sealed class HostingCoverageTests
Assert.Contains(services, d => d.ServiceType == typeof(IDiceRoller));
}
[Fact]
public void AddRpgRollerCore_WithFileConnectionString_RegistersResolvedSqliteDatabaseFile()
{
var services = new ServiceCollection();
var contentRoot = Path.Combine(Path.GetTempPath(), $"rpgroller-hosting-{Guid.NewGuid():N}");
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?> { ["ConnectionStrings:RpgRoller"] = "Data Source=App_Data/rpgroller.db" }).Build();
var environment = new TestWebHostEnvironment { ContentRootPath = contentRoot };
services.AddRpgRollerCore(configuration, environment);
using var provider = services.BuildServiceProvider();
var databaseFile = provider.GetRequiredService<SqliteDatabaseFile>();
Assert.Equal(Path.Combine(contentRoot, "App_Data", "rpgroller.db"), databaseFile.Path);
Assert.True(Directory.Exists(Path.Combine(contentRoot, "App_Data")));
}
[Fact]
public void SqliteSchemaUpgrader_MigratesLegacySchema()
{