예제 #1
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));
            }
예제 #2
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);
            }
예제 #3
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);
            }
예제 #4
0
            public void AddRecipeWithoutIngredientInfos()
            {
                KitchenService currentKitchen = new KitchenService();
                Recipe         newRecipe      = new Recipe {
                    Name = "PyttIPanna"
                };

                Assert.AreEqual(false, currentKitchen.AddRecipe(newRecipe));
            }
예제 #5
0
            public void AddRecipeWithoutName()
            {
                KitchenService currentKitchen = new KitchenService();
                Recipe         newRecipe      = new Recipe();

                newRecipe.IngredientInfos.Add(new IngredientInfo {
                    Name = "Sausage", Quantity = 1
                });
                Assert.AreEqual(false, currentKitchen.AddRecipe(newRecipe));
            }
예제 #6
0
            public void GetRecipeSimilarName()
            {
                KitchenService currentKitchen = new KitchenService();

                Recipe newRecipe = new Recipe {
                    Name = "SausageStroganoffVeggie"
                };

                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);

                newRecipe = new Recipe {
                    Name = "SausageStroganoff"
                };
                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);

                Recipe result = currentKitchen.GetRecipe("SausageStroganoff");

                Assert.AreEqual(newRecipe.Name, result.Name);
            }
예제 #7
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));
            }
예제 #8
0
            public void WithRecipeGetPossibleMeals()
            {
                KitchenService currentKitchen = new KitchenService();

                Recipe newRecipe = new Recipe {
                    Name = "SausageStroganoffVeggie"
                };

                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);
            }