public void GetDiscount_With_Valid_Client_Type_Should_Return_Valid_Price(decimal price, int type, decimal expectedResult) { //arrange User user = new User() { UserType = type }; //act decimal actualResult = _sut.GetDiscount(user, price); Assert.AreEqual(expectedResult, actualResult); }
public decimal GetProductsPrice(User user, IList <Product> products) { decimal result = 0; foreach (var product in products) { result += product.Price; } return(_discountHelper.GetDiscount(user, result)); }
public decimal GetTotalPrice() { decimal totalPrice = 0; var basketProducts = _basket.GetBasketProducts; var uniqueProductsCount = basketProducts.Count; var discountSize = _discountHelper.GetDiscount(uniqueProductsCount); foreach (var key in basketProducts.Keys) { totalPrice += key.Price * (basketProducts[key] - discountSize); } return(totalPrice); }
public IEnumerable <ProductDataContract> GetProducts() { var list = m_dbe.GetProducts(); List <ProductDataContract> result = new List <ProductDataContract>(); foreach (var p in list) { // маппинг сущности на ProductDataContract ProductDataContract pdc = new ProductDataContract { id = p.id, Name = p.Name, Category = p.Category, Price = p.Price - m_dh.GetDiscount(p.Price) }; result.Add(pdc); } return(result); }