示例#1
0
        public void GenerateIncomeReportTest()
        {
            RestaurantManager restaurantManager = new RestaurantManager();

            restaurantManager.CreateClient("Jan Kowalski", "", "", "", "");
            restaurantManager.CreateDish("testDish", "", new List <IngredientDTG>(), CategoryDTG.alcohol, 15);
            restaurantManager.CreateDish("testDish2", "", new List <IngredientDTG>(), CategoryDTG.alcohol, 10.3);

            List <string> dishesNames = new List <string>();

            dishesNames.Add("testDish");
            dishesNames.Add("testDish2");
            dishesNames.Add("testDish");
            //ClientDTG client = new ClientDTG(1, "Jan Kowalski", "", null);

            restaurantManager.CreateOrder("Jan Kowalski", DateTime.Now, false, dishesNames, "", "", "", DateTime.Now.AddHours(1));
            Assert.AreEqual(1, restaurantManager.GetActiveOrders().Count, "Wrong number of active orders");

            restaurantManager.CompleteOrder(0);
            Assert.AreEqual(1, restaurantManager.GetCompletedOrders().Count, "Wrong number of completed orders");

            IncomeReport report = restaurantManager.GenerateIncomeReport(DateTime.Now.AddHours(-1), DateTime.Now.AddHours(1));

            Assert.AreEqual(40.3, report.Income, "Wrong income value");
        }
 private void CompleteOrder()
 {
     if (SelectedOrder != null)
     {
         restaurantManager.CompleteOrder(SelectedOrder.Id);
         RefreshView();
     }
 }
        public void TestCompleteOrder()
        {
            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);
            Assert.AreEqual(0, restaurantManager.GetCompletedOrders().Count, "Wrong completed orders number");
            Assert.AreEqual(1, restaurantManager.GetActiveOrders().Count, "Wrong active orders number");

            restaurantManager.CompleteOrder(0);

            Assert.AreEqual(1, restaurantManager.GetCompletedOrders().Count, "Wrong completed orders number");
            Assert.AreEqual(0, restaurantManager.GetActiveOrders().Count, "Wrong active orders number");
        }