private void ShipOrder(ShippingTypes shippingType) { double?shippingCost = 0.0d; //switch (shippingType) //{ // case ShippingTypes.Aramex: // shippingCost = 4.0; // break; // case ShippingTypes.FedEx: // shippingCost = 3.25; // break; // case ShippingTypes.DHL: // shippingCost = 4.5; // break; // case ShippingTypes.USPS: // shippingCost = 5.5; // break; // default: // throw new Exception("Not Supported Shipping Type"); //} OrderStrategyContext orderStrategyContext = new OrderStrategyContext(); shippingCost = orderStrategyContext.CalculateShippingCost(shippingType); Console.WriteLine($"Shipping Cost Over {ShippingType} is {shippingCost}"); Console.WriteLine("Order has been shipped"); }
public ShipOrderCommand(OrderStrategyContext orderStrategyContext) { this.orderStrategyContext = orderStrategyContext; }