Exemplo n.º 1
0
        Product IPricer.DoPrice(ProductSpec product, IEnumerable <CompetitorProduct> compProducts)
        {
            var cpgInFrequentOrder = compProducts.GroupBy(cp => cp.Price)
                                     .OrderByDescending(cpg => cpg.Count())
                                     .ThenBy(cpg => cpg.Key)
                                     .FirstOrDefault();

            return(new Product(product, cpgInFrequentOrder == null? CompetitivePricer.PriceReplacementIfPriceNotFound : cpgInFrequentOrder.Key));
        }
Exemplo n.º 2
0
        public override Product DoPrice(ProductSpec product, IEnumerable <CompetitorProduct> compProducts)
        {
            var filtered = compProducts.Where(cp =>
                                              cp.Price <GetAvgPricePlus50PercentageOfAverage(compProducts)
                                                        &&
                                                        cp.Price> GetAvgPriceMinus50PercentageOfAverage(compProducts));

            return(base.DoPrice(product, filtered));
        }
Exemplo n.º 3
0
        public override Product DoPrice(ProductSpec productSpec, IEnumerable <CompetitorProduct> compProducts)
        {
            Product product = base.DoPrice(productSpec, compProducts);

            if (productSpec.Demand == SupplyDemandIndicator.High && productSpec.Supply == SupplyDemandIndicator.Low)
            {
                return(new Product(productSpec, product.Price + (product.Price * SupplyLowDemandHighDecorator.PercentageToAdd / 100)));
            }
            else
            {
                return(product);
            }
        }
Exemplo n.º 4
0
 public virtual Product DoPrice(ProductSpec product, IEnumerable <CompetitorProduct> compProducts)
 {
     return(pricer.DoPrice(product, compProducts));
 }
Exemplo n.º 5
0
        public override Product DoPrice(ProductSpec product, IEnumerable <CompetitorProduct> compProducts)
        {
            var filtered = compProducts.Where(cp => cp.Price > compProducts.Average(cpForAverage => cpForAverage.Price) / 2);

            return(base.DoPrice(product, filtered));
        }
Exemplo n.º 6
0
 public Product(ProductSpec spec, double price)
 {
     this.Spec  = spec;
     this.Price = price;
 }