Add Order and OrderBook domains with test suites

This commit is contained in:
2026-10-01 11:38:06 +01:00
commit 9f7d4e6a4f
16 changed files with 493 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
namespace OrderDomain;
public class Order
{
public List<OrderLine> Lines { get; } = new();
public decimal Total => Lines.Sum(l => l.Value);
public bool IsCompleted { get; private set; }
public void AddLine(decimal unitPrice, int quantity)
=> Lines.Add(new OrderLine(unitPrice, quantity));
public void ApplyDiscount(int lineIndex)
=> Lines[lineIndex].ApplyDiscount();
public void Complete() => IsCompleted = true;
}