Example #1
0
        private static void BetterSolution()
        {
            var restaurant      = new OnlineRestaurant();
            var shippingService = new ShippingService();
            var facade          = new Facade(restaurant, 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"
            };

            facade.OrderFood(new List <Order>()
            {
                chickenOrder, sushiOrder
            });
            Console.ReadLine();
        }
Example #2
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();
        }
Example #3
0
 public Facade(OnlineRestaurant restaurant, ShippingService shippingService)
 {
     _restaurant      = restaurant;
     _shippingService = shippingService;
 }