diff --git a/Schaad.Accounting.Tests/ChartServiceTestShould.cs b/Schaad.Accounting.Tests/ChartServiceTestShould.cs index eef998f..360600d 100644 --- a/Schaad.Accounting.Tests/ChartServiceTestShould.cs +++ b/Schaad.Accounting.Tests/ChartServiceTestShould.cs @@ -248,19 +248,19 @@ public class ChartServiceTestShould { var checking = MakeAccount("chk", 1010); var groceries = MakeAccount("groc", 4200); - viewService.GetAccountViewAsync("chk").Returns(AsDataset(checking)); - viewService.GetTransactionViewListAsync("chk").Returns(new List + viewService.GetAccountViewAsync("groc").Returns(AsDataset(groceries)); + viewService.GetTransactionViewListAsync("groc").Returns(new List { MakeTransaction(checking, groceries, value: 50m, valueDate: new DateTime(2026, 1, 5), text: "Migros"), MakeTransaction(checking, groceries, value: 30m, valueDate: new DateTime(2026, 2, 3), text: "Migros"), MakeTransaction(checking, groceries, value: 20m, valueDate: new DateTime(2026, 2, 4), text: "Coop") }); - var totals = await BuildService().GetBookingTextTotalsAsync("chk"); + var totals = await BuildService().GetBookingTextTotalsAsync("groc"); totals.Count.ShouldBe(2); - totals.ShouldContain(t => t.Name == "Migros" && t.Value == -80m); - totals.ShouldContain(t => t.Name == "Coop" && t.Value == -20m); + totals.ShouldContain(t => t.Name == "Migros" && t.Value == 80m); + totals.ShouldContain(t => t.Name == "Coop" && t.Value == 20m); } [Fact] @@ -282,20 +282,20 @@ public class ChartServiceTestShould } [Fact] - public async Task NetOutgoingAndIncomingBookingsWithTheSameTextWhenBuildingTotalsForAccount() + public async Task ExcludeBookingsWhereAccountIsOriginWhenBuildingTotalsForAccount() { var checking = MakeAccount("chk", 1010); var groceries = MakeAccount("groc", 4200); - viewService.GetAccountViewAsync("chk").Returns(AsDataset(checking)); - viewService.GetTransactionViewListAsync("chk").Returns(new List + viewService.GetAccountViewAsync("groc").Returns(AsDataset(groceries)); + viewService.GetTransactionViewListAsync("groc").Returns(new List { MakeTransaction(checking, groceries, value: 50m, valueDate: new DateTime(2026, 1, 5), text: "Migros"), MakeTransaction(groceries, checking, value: 20m, valueDate: new DateTime(2026, 1, 6), text: "Migros") }); - var totals = await BuildService().GetBookingTextTotalsAsync("chk"); + var totals = await BuildService().GetBookingTextTotalsAsync("groc"); - totals.Single().Value.ShouldBe(-30m); + totals.Single().Value.ShouldBe(50m); } [Fact] @@ -303,14 +303,14 @@ public class ChartServiceTestShould { var checking = MakeAccount("chk", 1010); var groceries = MakeAccount("groc", 4200); - viewService.GetAccountViewAsync("chk").Returns(AsDataset(checking)); - viewService.GetTransactionViewListAsync("chk").Returns(new List + viewService.GetAccountViewAsync("groc").Returns(AsDataset(groceries)); + viewService.GetTransactionViewListAsync("groc").Returns(new List { MakeTransaction(checking, groceries, value: 50m, valueDate: new DateTime(2026, 1, 5), text: "Migros"), MakeTransaction(checking, groceries, value: -50m, valueDate: new DateTime(2026, 1, 6), text: "Migros") }); - var totals = await BuildService().GetBookingTextTotalsAsync("chk"); + var totals = await BuildService().GetBookingTextTotalsAsync("groc"); totals.ShouldBeEmpty(); }