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
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user