示例#1
0
        static void Main(string[] args)
        {
            StrategyContext strategyContext = new StrategyContext();

            var customertype = DiscountEnum.hasToGo;

            ICalcDiscount discountType = strategyContext.GetDiscountPerCustomerType(customertype);

            double OnBid = 100.00;

            double discount = strategyContext.ApplyStrategy(discountType, OnBid);

            Console.WriteLine((OnBid - discount).ToString());
        }
        public double ApplyStrategy(ICalcDiscount calcDiscount, double priceOnBid)
        {
            double finalprice = priceOnBid * calcDiscount.DiscountPerCustomer();

            return(finalprice);
        }