예제 #1
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);
            }
예제 #2
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));
            }
예제 #3
0
            public void PrepareMeal()
            {
                KitchenService currentKitchen = new KitchenService();

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

                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("SausageStroganoff", 1));
            }