public void TestCreateOrder() { DateTime orderTime = DateTime.Now.Date; restaurantManager.CreateDish("Chips", "testDishDescription", null, CategoryDTG.snack, 1.0); restaurantManager.CreateClient("John Smith", "111222333", "Street", "1", "90-200"); restaurantManager.CreateClient("Matthew Johnson", "111222333", "Street", "1", "90-200"); List <string> dishesNames = new List <string>(); dishesNames.Add("Chips"); restaurantManager.CreateOrder("John Smith", DateTime.Now, false, dishesNames, "Street", "2", "00-000", DateTime.Now); List <OrderDTG> orders = restaurantManager.GetActiveOrders(); Assert.AreEqual(1, orders.Count, "Wrong orders number"); restaurantManager.CreateOrder("Matthew Johnson", DateTime.Now, true, dishesNames, "AnotherStreet", "5", "11-111", orderTime); List <OrderDTG> deliveries = restaurantManager.GetActiveDeliveries(); Assert.AreEqual(1, deliveries.Count, "Wrong deliveries number"); Assert.AreEqual("John Smith", orders[0].Client.Name, "Wrong order client name"); Assert.AreEqual("Chips", orders[0].Dishes[0].Name, "Wrong dish name"); Assert.AreEqual("Matthew Johnson", deliveries[0].Client.Name, "Wrong delivery client name"); Assert.AreEqual(orderTime, deliveries[0].DeliveryEndTime, "Wrong delivery date"); }
public void RefreshView() { Menu.Clear(); Clients.Clear(); ActiveOrders.Clear(); CompletedOrders.Clear(); ActiveDelivery.Clear(); CompletedDeliveries.Clear(); foreach (DishDTG dish in restaurantManager.GetMenu()) { Menu.Add(new DishModel(dish)); } foreach (ClientDTG client in restaurantManager.GetAllClients()) { Clients.Add(new ClientModel(client)); } foreach (OrderDTG order in restaurantManager.GetActiveOrders()) { ActiveOrders.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetCompletedOrders()) { CompletedOrders.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetActiveDeliveries()) { ActiveDelivery.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetCompletedDeliveries()) { CompletedDeliveries.Add(new OrderModel(order)); } }
public void RefreshView() { Menu.Clear(); Clients.Clear(); ActiveOrders.Clear(); CompletedOrders.Clear(); ActiveDelivery.Clear(); CompletedDeliveries.Clear(); foreach (Dish dish in restaurantManager.GetMenu()) { Menu.Add(dish); } foreach (Client client in restaurantManager.GetAllClients()) { Clients.Add(client); } foreach (Order order in restaurantManager.GetActiveOrders()) { ActiveOrders.Add(order); } foreach (Order order in restaurantManager.GetCompletedOrders()) { CompletedOrders.Add(order); } foreach (Order order in restaurantManager.GetActiveDeliveries()) { ActiveDelivery.Add(order); } foreach (Order order in restaurantManager.GetCompletedDeliveries()) { CompletedDeliveries.Add(order); } }