Esempio n. 1
0
        public CheckoutRepository()
        {
            items = new Dictionary <string, Item>()
            {
                { "A", new Item("A", 10) },
                { "B", new Item("B", 15) },
                { "C", new Item("C", 40) },
                { "D", new Item("D", 55) },
            };

            promotions = new List <Promotion>()
            {
                new XForYPromotion()
                {
                    Item = items["B"], QuantityForEffect = 3, BundlePrice = 40
                },
                new PercentDiscountPromotion()
                {
                    Item = items["D"], QuantityForEffect = 2, PercentDiscount = 25
                }
            };

            defaultPromotionPricingMapping = new PromotionPricingMap(new Dictionary <Type, IPromotionPricing>()
            {
                { typeof(XForYPromotion), new XForYPromotionPricing() },
                { typeof(PercentDiscountPromotion), new PercentDiscountPromotionPricing() }
            });
        }
Esempio n. 2
0
 public PromotionLogic(PromotionPricingMap promotionPricingMap)
 {
     this.promotionPricingMap = promotionPricingMap;
 }