public IEnumerable <int> ApplyRule(Basket basket) { var count = basket.GetUnitLevels(new[] { unit }).Single(); basket.Remove(unit, count); return(Enumerable.Repeat(unitPrice, count)); }
public IEnumerable <int> ApplyRule(Basket basket) { while (basket.GetUnitLevels(new[] { unitUnderOffer }).Single() >= requiredUnits) { basket.Remove(unitUnderOffer, requiredUnits); yield return(offerPrice); } }