public void discount_4th_milk(int quantity, decimal expectedDiscount) { Products products = new Products(); AddMilks(products, quantity); Money discount = _fourthMilkFreeDiscount.Apply(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.Apply(products); Assert.Equal(new Money(expectedDiscount), discount); }
public override decimal CalculateCost() { if (!rangeValidator.Includes(RentalsCount)) { throw new InvalidOperationException(); } decimal cost = base.CalculateCost(); return(discount.Apply(cost)); }
/// <summary> /// Calculate the order discount and apply it to the order. /// </summary> /// <param name="currentOrder">The ODataOrderHeader for the current order.</param> /// <param name="discountAmount">The decimal for the discount amount.</param> public void Apply(ODataOrderHeader currentOrder, DdfDiscount discountData) { discount.Apply(currentOrder, discountData); }