示例#1
0
        private static void BadSolution()
        {
            var restaurant      = new OnlineRestaurant();
            var shippingService = new ShippingService();
            var chickenOrder    = new Order()
            {
                DishName = "Chicken with rice", DishPrice = 20.0, User = "******", ShippingAddress = "Random street 123"
            };
            var sushiOrder = new Order()
            {
                DishName = "Sushi", DishPrice = 52.0, User = "******", ShippingAddress = "More random street 321"
            };

            restaurant.AddOrderToCart(chickenOrder);
            restaurant.AddOrderToCart(sushiOrder);
            restaurant.CompleteOrders();
            shippingService.AcceptOrder(chickenOrder);
            shippingService.CalculateShippingExpenses();
            shippingService.ShipOrder();
            shippingService.AcceptOrder(sushiOrder);
            shippingService.CalculateShippingExpenses();
            shippingService.ShipOrder();
            Console.ReadLine();
        }
示例#2
0
        public void OrderFood(List <Order> orders)
        {
            foreach (var order in orders)
            {
                _restaurant.AddOrderToCart(order);
            }

            _restaurant.CompleteOrders();

            foreach (var order in orders)
            {
                _shippingService.AcceptOrder(order);
                _shippingService.CalculateShippingExpenses();
                _shippingService.ShipOrder();
            }
        }