public void AddDiscount(ICategoryDiscount categoryDiscount) { if (categoryDiscount == null) { throw new ArgumentNullException("categoryDiscount cannot be null."); } _categoryDiscount = categoryDiscount; }
private ICategoryDiscount CreateCategoryDiscount() { ICategoryDiscount categoryDiscount = null; if (this.Product.Category == ProductCategory.Accessories) { categoryDiscount = new AccessoriesDiscount(); } if (this.Product.Category == ProductCategory.Bikes) { categoryDiscount = new BikesDiscount(); } if (this.Product.Category == ProductCategory.Cloathing) { categoryDiscount = new CloathingDiscount(); } return(categoryDiscount); }