Add unit tests for DashboardPdfStatementService to validate PDF generation with entries and transfers

This commit is contained in:
2026-04-03 12:33:48 +02:00
parent 69181e66b0
commit 9aa1fee49e
9 changed files with 448 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -3,6 +3,7 @@
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<OutputType Condition="$([MSBuild]::IsOSPlatform('Windows'))">WinExe</OutputType>
<ApplicationIcon>Assets\app-icon.ico</ApplicationIcon>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>$([System.DateTime]::Now.ToString('yy')).$([System.DateTime]::Now.DayOfYear)</Version>
@@ -23,6 +24,9 @@
<Content Include="wwwroot\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\app-icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>

View File

@@ -3,18 +3,49 @@ using Duempelkas.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Photino.Blazor;
using System.Runtime.InteropServices;
namespace Duempelkas.Desktop;
class Program
{
[DllImport("shell32.dll", CharSet = CharSet.Unicode)]
private static extern int SetCurrentProcessExplicitAppUserModelID(string appID);
[STAThread]
static void Main(string[] args)
{
if (OperatingSystem.IsWindows())
{
// Ensure Windows taskbar does not group this process under generic dotnet host identity.
SetCurrentProcessExplicitAppUserModelID("Duempelkas.Desktop");
}
var appBuilder = PhotinoBlazorAppBuilder.CreateDefault(args);
var exeDirectory = Path.GetDirectoryName(Environment.ProcessPath ?? AppContext.BaseDirectory) ?? AppContext.BaseDirectory;
var dbPath = Path.Combine(exeDirectory, "duempelkas.db");
// Use a per-user writable DB location so debugging via dotnet host works reliably.
var appDataDir = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Duempelkas");
Directory.CreateDirectory(appDataDir);
var dbPath = Path.Combine(appDataDir, "duempelkas.db");
// One-time compatibility: keep existing data if older versions stored DB next to the app executable.
var legacyExeDirectory = Path.GetDirectoryName(Environment.ProcessPath ?? AppContext.BaseDirectory) ?? AppContext.BaseDirectory;
var legacyDbPath = Path.Combine(legacyExeDirectory, "duempelkas.db");
if (!File.Exists(dbPath) && File.Exists(legacyDbPath))
{
try
{
File.Copy(legacyDbPath, dbPath);
}
catch
{
// Ignore copy errors and continue with a fresh DB.
}
}
appBuilder.Services.AddInfrastructure($"Data Source={dbPath}");
appBuilder.RootComponents.Add<Duempelkas.App.Components.App>("app");
@@ -23,6 +54,13 @@ class Program
app.MainWindow.StartUrl = PhotinoWebViewManager.AppBaseUri;
// Force the native window icon for title bar + taskbar representation.
var iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "app-icon.ico");
if (File.Exists(iconPath))
{
app.MainWindow.SetIconFile(iconPath);
}
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<FinanceDbContext>();