public Basket(EDiscountType discountType) { _products = new List <Product>(); // Here the discount strategy is defined, according to a desired kind of discount type. _discountStrategy = DiscountStrategyFactory.DiscountStrategyFor(discountType); }
/// <summary> /// Defines a discount type to be applied over all products of basket. /// </summary> /// <param name="discountType">Discount type which will be applied over the products list.</param> public void SetDiscountType(EDiscountType discountType) { _discountStrategy = DiscountStrategyFactory.DiscountStrategyFor(discountType); }