Tests: Add tests for documents

This commit is contained in:
2024-02-13 12:38:37 +01:00
parent 912206f52d
commit 805f782c83
10 changed files with 136 additions and 13 deletions

@ -8,7 +8,7 @@ namespace Elwig.Helpers.Printing {
private static RazorLightEngine? Engine = null;
public static bool IsReady => Engine != null;
public static async Task Init(Action evtHandler) {
public static async Task Init(Action? evtHandler = null) {
var e = new RazorLightEngineBuilder()
.UseFileSystemProject(App.DataPath + "resources")
.UseMemoryCachingProvider()
@ -24,7 +24,7 @@ namespace Elwig.Helpers.Printing {
await e.CompileTemplateAsync("DeliveryConfirmation");
Engine = e;
evtHandler();
evtHandler?.Invoke();
}
public static async Task<string> CompileRenderAsync(string key, object model) {