Skip to content

About

Domain-Driven Design (DDD) reference model in C# demonstrating aggregate boundaries, value objects (Money/Coin/Wallet), and state transitions

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

VendingMachine

Tactical Domain-Driven Design (DDD) Reference Implementation in C# / .NET

.NET


Overview

VendingMachine is a clean-architecture reference model demonstrating tactical Domain-Driven Design (DDD), object-oriented encapsulation, and Test-Driven Development (TDD) in C#.

Rather than treating a state machine as procedural UI logic, it models financial value objects, inventory aggregates, and wallet change-dispensing strategies with strict invariant enforcement.


Domain Model Highlights

  • Financial Value Objects (Money, Coin, Currency, CoinsBuilder):
    • Immutable monetary primitives enforcing currency consistency (MoneyCurrencyMismatchException).
  • Wallet & Change Allocation Strategy (IWallet, MinCoinsWallet):
    • Encapsulates coin denomination inventory and optimal change-making algorithms with explicit domain exceptions (NotAnoughCoinsException, NotAnoughMoneyException).
  • Aggregate Boundaries (IVendingMachine, NumpadVendingMachine, ProductBusket, Customer):
    • Decouples product catalog (IProduct, IShowcaseItem) and basket state transitions from presentation view-models (MainWindowViewModelTests).
  • Comprehensive Unit Test Suite (VendingMachine.Tests):
    • Full test coverage across coin arithmetic, wallet dispensing, product basket invariants, and view-model interaction.

Author

Andrey Leskov — CTO & Principal Systems Architect (illumi.one · LinkedIn).

About

Domain-Driven Design (DDD) reference model in C# demonstrating aggregate boundaries, value objects (Money/Coin/Wallet), and state transitions

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages