- CSS: drop the Bootstrap template leftovers (NavMenu.razor.css, most of MainLayout.razor.css, button/form rules in app.css) and the copied Fluent demo rules in BankTransactions.razor.css. - Bootstrap: keep only bootstrap.min.css (+ map); 42 unused files removed. - Credit-card statement import, never wired into the Blazor UI: service methods, GetCreditCardStatementPath, DI registrations for ICreditCardStatementService/IPdfParsingService, FreeSpire.PDF. - CSV export (GetTransactionListCsvAsync), only called from tests. - Split predefinitions: model, repository and the JSON editor entry. - Unused members: TrySetYear, GetUploadPath (+ DataFolders.Uploads), GetClasses; unused usings, fields and parameters. - Home.razor.css -> PendingBookings.razor.css: the pending-bookings table moved there in "PR U-10" and had lost its styling since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using Schaad.Accounting.Datasets;
|
|
using Schaad.Accounting.Services;
|
|
using Shouldly;
|
|
|
|
namespace Schaad.Accounting.Tests;
|
|
|
|
public class SettingsServiceTestShould : IDisposable
|
|
{
|
|
private readonly string dataPath;
|
|
private readonly SettingsService sut;
|
|
|
|
public SettingsServiceTestShould()
|
|
{
|
|
dataPath = Path.Combine(Path.GetTempPath(), "AccountingNext-tests-" + Guid.NewGuid().ToString("N"));
|
|
Directory.CreateDirectory(dataPath);
|
|
|
|
sut = new SettingsService(new SettingsDataset { DataPath = dataPath, DefaultMandator = "Mandator" });
|
|
sut.SetYear(2025);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (Directory.Exists(dataPath))
|
|
{
|
|
Directory.Delete(dataPath, recursive: true);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void ReturnMandatorYearFolderWhenGettingDbPath()
|
|
{
|
|
sut.GetDbPath().ShouldBe(Path.Combine(dataPath, "Mandator", "2025"));
|
|
sut.GetLastYearDbPath().ShouldBe(Path.Combine(dataPath, "Mandator", "2024"));
|
|
}
|
|
|
|
[Fact]
|
|
public void ReturnMandatorFolderWithoutYearWhenGettingMandatorPath()
|
|
{
|
|
sut.GetMandatorPath().ShouldBe(Path.Combine(dataPath, "Mandator"));
|
|
}
|
|
|
|
[Fact]
|
|
public void ReturnZipBelowRootBackupWhenGettingBackupFilePath()
|
|
{
|
|
var path = sut.GetBackupFilePath();
|
|
|
|
Path.GetDirectoryName(path).ShouldBe(Path.Combine(dataPath, "backup", "Mandator", "2025"));
|
|
Path.GetExtension(path).ShouldBe(".zip");
|
|
}
|
|
|
|
[Fact]
|
|
public void ListOnlyMandatorsWithThatYearWhenGettingMandators()
|
|
{
|
|
Directory.CreateDirectory(Path.Combine(dataPath, "Mandator", "2025"));
|
|
Directory.CreateDirectory(Path.Combine(dataPath, "Other", "2025"));
|
|
Directory.CreateDirectory(Path.Combine(dataPath, "OnlyOlder", "2023"));
|
|
Directory.CreateDirectory(Path.Combine(dataPath, "backup", "2025"));
|
|
|
|
sut.GetMandators(2025).OrderBy(m => m).ShouldBe(["Mandator", "Other"]);
|
|
}
|
|
}
|