Tests: Add in-memory database for testing

This commit is contained in:
2024-01-05 17:06:58 +01:00
parent 3f6a94e773
commit 2556033a07
9 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,30 @@
using Elwig.Helpers;
using Microsoft.Data.Sqlite;
using System.Reflection;
namespace Tests {
[TestFixture]
public class HelpersBillingTest {
private SqliteConnection? Connection;
[OneTimeSetUp]
public async Task SetupDatabase() {
Connection = await AppDbContext.ConnectAsync();
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.BillingInsert.sql");
}
[OneTimeTearDown]
public async Task TeardownDatabase() {
if (Connection == null) return;
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.BillingDelete.sql");
await Connection.DisposeAsync();
Connection = null;
}
[Test]
public void Test() {
// TODO
}
}
}