/// <summary> /// Gets the discounted product price. /// </summary> /// <param name="product">The product.</param> /// <param name="userType">Type of the user.</param> /// <param name="associationYears">The association years.</param> /// <returns>System.Double.</returns> public double GetDiscountedProductPrice(ProductOrderMappingModel product, UserType userType, int associationYears) { bool isDiscountApplicable = this._discountInvoker.GetDiscountType(userType).IsDiscountApplicable(associationYears); double discount = product.Type.Equals(ProductType.NonGrocery) && isDiscountApplicable?this._discountInvoker.GetDiscountType(userType).GetDiscount(product.Cost) : 0; return(product.Cost - discount); }
public void Setup() { _productModel = new ProductOrderMappingModel { Name = "Item-1", Id = 1, Type = ProductType.NonGrocery, Cost = 100, Quantity = 1 }; }