E2ETests: Use ElwigTestDB.sqlite3 instead of default
All checks were successful
Test / Run tests (push) Successful in 2m38s

This commit is contained in:
2024-07-08 13:05:21 +02:00
parent 6b48a1090c
commit 34178105a7
11 changed files with 67 additions and 31 deletions

View File

@ -1,4 +1,7 @@
namespace Tests.E2ETests {
using Elwig.Helpers;
using System.Reflection;
namespace Tests.E2ETests {
[SetUpFixture]
public static class Setup {
@ -9,9 +12,25 @@
Driver = new();
}
[OneTimeSetUp]
public static async Task SetupDatabase() {
if (File.Exists(Utils.TestDatabasePath)) File.Delete(Utils.TestDatabasePath);
using var cnx = await AppDbContext.ConnectAsync($"Data Source=\"{Utils.TestDatabasePath}\"; Mode=ReadWriteCreate; Foreign Keys=True; Cache=Default");
await AppDbContext.ExecuteEmbeddedScript(cnx, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Create.sql");
await AppDbContext.ExecuteEmbeddedScript(cnx, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Insert.sql");
}
[OneTimeTearDown]
public static void TeardownWinAppDriver() {
Driver?.Dispose();
}
[OneTimeTearDown]
public static void TeardownDatabase() {
try {
// FIXME not working - other process using file
File.Delete(Utils.TestDatabasePath);
} catch { }
}
}
}