Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var order = new Order();

            //var service = new ShippingCostCalculatorService(new FedExShippingCostStrategy());
            //OR
            var service = new ShippingCostCalculatorService(new UspsShippingCostStrategy());

            //OR
            //var service = new ShippingCostCalculatorService(new UpsShippingCostStrategy());

            service.CalculateShippingCost(order);
        }
Exemplo n.º 2
0
        private static void NewMethod()
        {
            var order = new Order {
                OrderId = 1, Item = "Phone", ShippingOptions = ShippingOptions.FunCurier
            };

            ICalculatorShipping calculatorShipping = new FunCurierShipping();

            var shippingService = new ShippingCostCalculatorService(calculatorShipping);

            var cost = shippingService.CalculateShippingCost(order);

            Console.WriteLine($"The Final cost for your order is: {cost} ");
        }