public void discount_4th_milk(int quantity, decimal expectedDiscount) { Products products = new Products(); AddMilks(products, quantity); Money discount = _fourthMilkFreeDiscount.ApplyTo(products); Assert.Equal(new Money(expectedDiscount), discount); }
public void discount_a_bread_at_50_percent_off(int butterQuantity, int breadQuantity, decimal expectedDiscount) { Products products = new Products(); AddButter(products, butterQuantity); AddBread(products, breadQuantity); Money discount = fiftyPercentBreadDiscount.ApplyTo(products); Assert.Equal(new Money(expectedDiscount), discount); }
public void AddDiscount(IDiscount discount) { if(discount.AppliesTo(this)) { _discounts.Add(discount); discount.ApplyTo(this); } }