Tests: Add tests for documents
This commit is contained in:
37
Tests/DocumentTests/Setup.cs
Normal file
37
Tests/DocumentTests/Setup.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using Elwig.Helpers;
|
||||
using System.Reflection;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Elwig.Helpers.Printing;
|
||||
|
||||
namespace Tests.DocumentTests {
|
||||
[SetUpFixture]
|
||||
public class Setup {
|
||||
|
||||
private SqliteConnection? Connection;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public async Task SetupDatabase() {
|
||||
Connection = await AppDbContext.ConnectAsync();
|
||||
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.DocumentInsert.sql");
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public async Task TeardownDatabase() {
|
||||
if (Connection == null) return;
|
||||
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.DocumentDelete.sql");
|
||||
await Connection.DisposeAsync();
|
||||
Connection = null;
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
public async Task SetupPrinting() {
|
||||
await Html.Init();
|
||||
await Pdf.Init();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void TeardownPrinting() {
|
||||
// no teardown needed yet
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user