예제 #1
0
        public void FromKitchenWithAvailabileMealAndFullFridgePrepareTwoMeals()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge("Sausage", 5);
            currentFridge.AddIngredientToFridge("Cream", 7.5);
            currentFridge.AddIngredientToFridge("Tomato puree", 22);

            Kitchen currentKitchen = new Kitchen(currentFridge);

            Recipe newRecipe = new Recipe();

            newRecipe.Name      = "SausageStroganoff";
            newRecipe.Available = true;
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Sausage", 1));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Cream", 2.5));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Tomato puree", 2));
            currentKitchen.AddRecipe(newRecipe);

            Boolean result = currentKitchen.PrepareMeal("SausageStroganoff", 2);

            Assert.AreEqual(true, result);
            Assert.AreEqual(3, currentFridge.GetInventoryItem("Sausage").Quantity);
            Assert.AreEqual(2.5, currentFridge.GetInventoryItem("Cream").Quantity);
            Assert.AreEqual(18, currentFridge.GetInventoryItem("Tomato puree").Quantity);
        }
예제 #2
0
        public void FromFullKitchenAndFullFridgeListAvailableMeals()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge("VeggieSausage", 5);
            currentFridge.AddIngredientToFridge("Cream", 2.5);
            currentFridge.AddIngredientToFridge("Tomato puree", 22);

            Kitchen currentKitchen = new Kitchen(currentFridge);

            Recipe newRecipe = new Recipe();

            newRecipe.Name      = "SausageStroganoffVeggie";
            newRecipe.Available = true;
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("VeggieSausage", 1));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Cream", 2.5));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Tomato puree", 2));
            currentKitchen.AddRecipe(newRecipe);

            Order currentOrder = new Order(currentKitchen);

            List <string> result = currentOrder.AvailableMeals();

            Assert.AreEqual(true, result != null);
            Assert.AreEqual(1, result.Count);
        }
예제 #3
0
        public void FromFullKitchenAndFullFridgePlaceZeroOrders()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge("VeggieSausage", 5);
            currentFridge.AddIngredientToFridge("Cream", 2.5);
            currentFridge.AddIngredientToFridge("Tomato puree", 22);

            Kitchen currentKitchen = new Kitchen(currentFridge);

            Recipe newRecipe = new Recipe();

            newRecipe.Name      = "SausageStroganoffVeggie";
            newRecipe.Available = true;
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("VeggieSausage", 1));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Cream", 2.5));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Tomato puree", 2));
            currentKitchen.AddRecipe(newRecipe);

            Order            currentOrder = new Order(currentKitchen);
            List <MealOrder> mealOrders   = new List <MealOrder>();

            MealOrder mealOrder = new MealOrder();

            mealOrder.MealName  = "SausageStroganoffVeggie";
            mealOrder.NoOfMeals = 0;
            mealOrders.Add(mealOrder);

            List <OrderInfo> result = currentOrder.PlaceOrder(mealOrders);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(0, result[0].NoOfMeals);
            Assert.AreEqual(false, result[0].OkFromKitchen);
        }
예제 #4
0
            public void WithFullFridgeIncorrectMealPrepareMeal()
            {
                Fridge currentFridge = new Fridge();

                currentFridge.AddIngredientToFridge("Sausage", 5);
                currentFridge.AddIngredientToFridge("Cream", 7.5);
                currentFridge.AddIngredientToFridge("Tomato puree", 22);

                KitchenService currentKitchen = new KitchenService(currentFridge);

                Recipe newRecipe = new Recipe
                {
                    Name      = "SausageStroganoff",
                    Available = true
                };

                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Sausage", Quantity = 1
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Cream", Quantity = 2.5
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Tomato puree", Quantity = 2
                });
                currentKitchen.AddRecipe(newRecipe);

                Assert.AreEqual(false, currentKitchen.PrepareMeal("Squirrel", 1));
            }
예제 #5
0
            public void WithFullFridgePrepareTwoMeals()
            {
                Fridge currentFridge = new Fridge();

                currentFridge.AddIngredientToFridge("Sausage", 5);
                currentFridge.AddIngredientToFridge("Cream", 7.5);
                currentFridge.AddIngredientToFridge("Tomato puree", 22);

                KitchenService currentKitchen = new KitchenService(currentFridge);

                Recipe newRecipe = new Recipe
                {
                    Name      = "SausageStroganoff",
                    Available = true
                };

                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Sausage", Quantity = 1
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Cream", Quantity = 2.5
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Tomato puree", Quantity = 2
                });
                currentKitchen.AddRecipe(newRecipe);

                Boolean result = currentKitchen.PrepareMeal("SausageStroganoff", 2);

                Assert.AreEqual(true, result);
                Assert.AreEqual(3, currentFridge.GetInventoryItem("Sausage").Quantity);
                Assert.AreEqual(2.5, currentFridge.GetInventoryItem("Cream").Quantity);
                Assert.AreEqual(18, currentFridge.GetInventoryItem("Tomato puree").Quantity);
            }
예제 #6
0
            public void WithNotEnoughFullFridgeGetPossibleMeals()
            {
                Fridge currentFridge = new Fridge();

                currentFridge.AddIngredientToFridge("VeggieSausage", 5);
                currentFridge.AddIngredientToFridge("Cream", 2);
                currentFridge.AddIngredientToFridge("Tomato puree", 22);

                KitchenService currentKitchen = new KitchenService(currentFridge);

                Recipe newRecipe = new Recipe
                {
                    Name      = "SausageStroganoffVeggie",
                    Available = true
                };

                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "VeggieSausage", Quantity = 1
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Cream", Quantity = 2.5
                });
                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Tomato puree", Quantity = 2
                });
                currentKitchen.AddRecipe(newRecipe);

                List <string> result = currentKitchen.PossibleMeals();

                Assert.AreEqual(true, result != null);
                Assert.AreEqual(0, result.Count);
            }
예제 #7
0
        public void ToEmptyFridgeAddTwoIdenticalInventoryItem()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge(inventoryItemMeatballs, 10);
            currentFridge.AddIngredientToFridge(inventoryItemMeatballs, 10);

            Assert.AreEqual(1, currentFridge.InventoryList.Count);
            Assert.AreEqual(20, currentFridge.InventoryList[0].Quantity);
        }
예제 #8
0
        public void FromFullFridgeRemoveNonExistingInventoryItem()
        {
            string invItem1      = "Meatballs";
            string invItem2      = "Potato";
            string invItem3      = "Pasta";
            string invRemoveItem = "Sauce";
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge(invItem1, 10);
            currentFridge.AddIngredientToFridge(invItem2, 50);
            currentFridge.AddIngredientToFridge(invItem3, 4);

            Double result = currentFridge.TakeItemFromFridge(invRemoveItem, 5);

            Assert.AreEqual(-5, result);
        }
예제 #9
0
        public void FromFullFridgeIsItemAvailable()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge(inventoryItemMeatballs, 10);

            Assert.AreEqual(true, currentFridge.IsItemAvailable(inventoryItemMeatballs, 7));
        }
예제 #10
0
        public void DoesInventoryItemExist()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge(inventoryItemMeatballs, 10);

            FridgeInventory result = currentFridge.GetInventoryItem(inventoryItemMeatballs);

            Assert.AreEqual(10, result.Quantity);
        }
예제 #11
0
        public void FromKitchenWithAvailabileMealAndFullFridgeIncorrectMealPrepareMeal()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge("Sausage", 5);
            currentFridge.AddIngredientToFridge("Cream", 7.5);
            currentFridge.AddIngredientToFridge("Tomato puree", 22);

            Kitchen currentKitchen = new Kitchen(currentFridge);

            Recipe newRecipe = new Recipe();

            newRecipe.Name      = "SausageStroganoff";
            newRecipe.Available = true;
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Sausage", 1));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Cream", 2.5));
            newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Tomato puree", 2));
            currentKitchen.AddRecipe(newRecipe);

            Boolean result = currentKitchen.PrepareMeal("Squirrel", 1);

            Assert.AreEqual(false, result);
        }
예제 #12
0
        public void ToEmptyFridgeAddOneInventoryItem()
        {
            Fridge currentFridge = new Fridge();

            currentFridge.AddIngredientToFridge(inventoryItemMeatballs, 10);
        }