top-level main programs

This commit is contained in:
Oli Sturm
2026-04-22 13:48:24 +01:00
parent 1b5239566a
commit 1f24bea336
5 changed files with 51 additions and 84 deletions
+12 -20
View File
@@ -3,28 +3,20 @@ using CsharpOop.Contracts;
using CsharpOop.Domain;
using CsharpOop.Infrastructure;
namespace CsharpOop;
Console.WriteLine("[csharp-oop] Starting withdraw money demo...");
public class Program
{
public static void Main()
{
Console.WriteLine("[csharp-oop] Starting withdraw money demo...");
var repository = new InMemoryAccountRepository();
var handler = new WithdrawMoneyHandler(repository);
var repository = new InMemoryAccountRepository();
var handler = new WithdrawMoneyHandler(repository);
var accountId = Guid.NewGuid();
Console.WriteLine($"[csharp-oop] Seeding account {accountId} with opening balance 200.00");
repository.Save(new Account(new AccountId(accountId), new Money(200m)));
var accountId = Guid.NewGuid();
Console.WriteLine($"[csharp-oop] Seeding account {accountId} with opening balance 200.00");
repository.Save(new Account(new AccountId(accountId), new Money(200m)));
var command = new WithdrawMoneyCommand { AccountId = accountId, Amount = 100m };
Console.WriteLine(
$"[csharp-oop] Dispatching command: withdraw {command.Amount:0.00} from account {command.AccountId}"
);
var command = new WithdrawMoneyCommand { AccountId = accountId, Amount = 100m };
Console.WriteLine(
$"[csharp-oop] Dispatching command: withdraw {command.Amount:0.00} from account {command.AccountId}"
);
handler.Handle(command);
handler.Handle(command);
Console.WriteLine("[csharp-oop] Demo completed.");
}
}
Console.WriteLine("[csharp-oop] Demo completed.");