Files
learning-hour-maker/exercises/show-dont-tell/src/OrderDomain/OrderLine.cs
T
mostalive cfde583649 Add learning hour: Show, Don't Tell — using examples with coding agents
Exercise project with Order domain and NUnit tests demonstrating
the 'show, don't tell' pattern for guiding coding agents.

- 1 refactored test using custom matcher (the example)
- 5 unrefactored tests with multiple asserts (the practice)
- OrderStateConstraint custom matcher for NUnit 3
2026-09-02 22:22:12 +01:00

20 lines
458 B
C#

namespace OrderDomain;
public class OrderLine
{
public decimal UnitPrice { get; }
public int Quantity { get; }
public bool HasDiscount { get; private set; }
public decimal Value =>
HasDiscount ? UnitPrice * Quantity * 0.8m : UnitPrice * Quantity;
public OrderLine(decimal unitPrice, int quantity)
{
UnitPrice = unitPrice;
Quantity = quantity;
}
public void ApplyDiscount() => HasDiscount = true;
}