Improve testing and some cleanup refactoring.

This commit is contained in:
2026-07-29 11:07:12 +02:00
parent 249a166d07
commit 44846eaa13
15 changed files with 253 additions and 96 deletions
@@ -20,7 +20,10 @@ public static class TransferFundsHandler
var source = await query.FindByIdAsync(cmd.SourceAccountId);
var dest = await query.FindByIdAsync(cmd.DestinationAccountId);
if (source == null || dest == null) return null;
if (source == null || dest == null)
{
return null;
}
return new TransferContext(source, dest, timeProvider.GetUtcNow());
}
@@ -28,8 +31,8 @@ public static class TransferFundsHandler
public static ( IStorageAction<Account> SourceWrite, IStorageAction<Account> DestWrite, IStorageAction<JournalEntry>
JournalWrite, FundsTransferredEvent Event ) Handle(TransferFundsCommand cmd, TransferContext context)
{
var updatedSource = context.Source.Debit(cmd.Amount);
var updatedDest = context.Destination.Credit(cmd.Amount);
var updatedSource = context.Source.ApplyPosting(cmd.Amount, EntryType.Debit);
var updatedDest = context.Destination.ApplyPosting(cmd.Amount, EntryType.Credit);
var lines = new List<JournalLine>
{