コード例 #1
0
        public IEnumerable <int> ApplyRule(Basket basket)
        {
            var count = basket.GetUnitLevels(new[] { unit }).Single();

            basket.Remove(unit, count);

            return(Enumerable.Repeat(unitPrice, count));
        }
コード例 #2
0
 public IEnumerable <int> ApplyRule(Basket basket)
 {
     while (basket.GetUnitLevels(new[] { unitUnderOffer }).Single() >= requiredUnits)
     {
         basket.Remove(unitUnderOffer, requiredUnits);
         yield return(offerPrice);
     }
 }