Beispiel #1
0
 public DiscountRuleResult(Guid discountRuleId, DiscountRuleType type, IEnumerable <Guid> productIds, Action <ProductInBasket> action)
 {
     DiscountRuleId   = discountRuleId;
     DiscountRuleType = type;
     ProductIds       = productIds;
     Action           = action;
 }
Beispiel #2
0
        public static IDiscountRuleValidator GetDiscountRuleValidator(DiscountRuleType discountRuleType)
        {
            switch (discountRuleType)
            {
            case DiscountRuleType.MinimumProductSkuCount:
                return(new MinimumProductSkuCountValidator());

            default:
                throw new ArgumentException();
            }
        }
Beispiel #3
0
        public IDiscountRule ResolveDiscountRule(DiscountRuleType type)
        {
            switch (type)
            {
            case DiscountRuleType.BuyManyGetOneFree: return(new BuyManyGetOneFree());

            case DiscountRuleType.Percentage: return(new PercentageRule());

            case DiscountRuleType.None: return(new DefaultRule());

            default: throw new ArgumentException("Unhandeled discount type provided");
            }
        }
Beispiel #4
0
 private BasketItem GetBasketItem(int id, int qty, DiscountRuleType type, int param)
 {
     return(new BasketItem
     {
         Id = id,
         Quantity = qty,
         AfterDiscountPrice = 0,
         DiscountRuleType = type,
         DiscountParameter = param,
         Product = new Product
         {
             Id = id,
             Price = (decimal)10.50,
         }
     });
 }
Beispiel #5
0
 public DiscountRuleResult(Guid discountRuleId, DiscountRuleType type, IEnumerable <ProductInBasket> additionalProducts)
 {
     DiscountRuleId     = discountRuleId;
     DiscountRuleType   = type;
     AdditionalProducts = additionalProducts;
 }