コード例 #1
0
        /// <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);
        }
コード例 #2
0
 public void Setup()
 {
     _productModel = new ProductOrderMappingModel
     {
         Name     = "Item-1",
         Id       = 1,
         Type     = ProductType.NonGrocery,
         Cost     = 100,
         Quantity = 1
     };
 }