Part 10 · 1 chapters · ~8 min
Capstone: The Ledger API in C#
The shared ledger API capstone in C# with ASP.NET Core minimal APIs, EF Core and MassTransit: idempotent transfers under 100 concurrent requests, double-entry postings summing to zero, payouts with unknown outcomes via the outbox, and a comparison with the Java and Kotlin capstones.
11
Acceptance
code
dotnet test --filter Category=Acceptance
# ✓ 100 concurrent identical POST /v1/transfers → exactly 1 transfer (WebApplicationFactory + Testcontainers)
# ✓ Σ postings = 0 for every transfer (FsCheck property, 1,000 cases)
# ✓ payout timed out at the rail → Unknown → only a rail confirmation settles it
// property test with FsCheck
[Property] public bool Postings_sum_to_zero(PositiveInt amount, NonNegativeInt fee) =>
Ledger.PostingsFor(new Kobo(amount.Get), new Kobo(fee.Get % 5_000)).Sum(p => p.Amount.Value) == 0;CAPSTONE: THE LEDGER API IN C#
the shared acceptance tests from every language course
swipe the figure sideways, or tap expand for full screen
1/4
shared contract
The same three acceptance tests as every language capstone, run through WebApplicationFactory against a Testcontainers Postgres.
the shared testsreal Postgres