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)); }
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)); }
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); } }
public virtual Product DoPrice(ProductSpec product, IEnumerable <CompetitorProduct> compProducts) { return(pricer.DoPrice(product, compProducts)); }
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)); }
public Product(ProductSpec spec, double price) { this.Spec = spec; this.Price = price; }