Tests: Initialize App.Client
This commit is contained in:
@ -53,7 +53,7 @@ namespace Elwig {
|
|||||||
public static string? BranchFaxNr { get; private set; }
|
public static string? BranchFaxNr { get; private set; }
|
||||||
public static string? BranchMobileNr { get; private set; }
|
public static string? BranchMobileNr { get; private set; }
|
||||||
public static IList<IScale> Scales { get; private set; }
|
public static IList<IScale> Scales { get; private set; }
|
||||||
public static ClientParameters Client { get; private set; }
|
public static ClientParameters Client { get; set; }
|
||||||
|
|
||||||
public static bool IsPrintingReady => Html.IsReady && Pdf.IsReady;
|
public static bool IsPrintingReady => Html.IsReady && Pdf.IsReady;
|
||||||
public static Dispatcher MainDispatcher { get; private set; }
|
public static Dispatcher MainDispatcher { get; private set; }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig;
|
||||||
|
using Elwig.Helpers;
|
||||||
using Elwig.Helpers.Billing;
|
using Elwig.Helpers.Billing;
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -10,7 +11,7 @@ namespace Tests {
|
|||||||
private SqliteConnection? Connection;
|
private SqliteConnection? Connection;
|
||||||
|
|
||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
public async Task SetupDatabase() {
|
public async Task Setup_1_Database() {
|
||||||
AppDbContext.ConnectionStringOverride = $"Data Source=ElwigTestDB; Mode=Memory; Foreign Keys=True; Cache=Shared";
|
AppDbContext.ConnectionStringOverride = $"Data Source=ElwigTestDB; Mode=Memory; Foreign Keys=True; Cache=Shared";
|
||||||
Connection = await AppDbContext.ConnectAsync();
|
Connection = await AppDbContext.ConnectAsync();
|
||||||
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Create.sql");
|
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Create.sql");
|
||||||
@ -18,7 +19,13 @@ namespace Tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
public async Task SetupBillingData() {
|
public void Setup_2_Client() {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
App.Client = new ClientParameters(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public async Task Setup_3_BillingData() {
|
||||||
await BillingData.Init();
|
await BillingData.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user