public void Get_All_Discounts()
        {
            var results = InMemoryProvider.AllDiscounts();

            Assert.IsNotNull(results);
            Assert.IsInstanceOf <IEnumerable <Discount> >(results);
        }
Пример #2
0
 public double GetDiscountedPrice(Product product, List <Product> products = null, List <int> discounts = null)
 {
     try
     {
         List <Discount> Discount = new List <Discount>();
         if (discounts != null && discounts.Count > 0)
         {
             discounts.ToList().ForEach(id => {
                 Discount.Add(_ctx.AllDiscounts().FirstOrDefault(x => x.DiscountId == id));
             });
         }
         return(util.CalculatePrice(product, products, Discount));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }