public void FromFullKitchenAndNotFullEnoughFridgePlaceTwoOrders() { Fridge currentFridge = new Fridge(); currentFridge.AddIngredientToFridge("VeggieSausage", 5); currentFridge.AddIngredientToFridge("Cream", 2.5); currentFridge.AddIngredientToFridge("Tomato puree", 22); currentFridge.AddIngredientToFridge("Tomato sauce", 10); currentFridge.AddIngredientToFridge("Ham", 25); currentFridge.AddIngredientToFridge("Cheese", 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); newRecipe = new Recipe(); newRecipe.Name = "Pizza"; newRecipe.Available = true; newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Tomato Sauce", 1)); newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Ham", 1)); newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Cheese", 1)); currentKitchen.AddRecipe(newRecipe); Order currentOrder = new Order(currentKitchen); List <MealOrder> mealOrders = new List <MealOrder>(); MealOrder mealOrder = new MealOrder(); mealOrder.MealName = "SausageStroganoffVeggie"; mealOrder.NoOfMeals = 1; mealOrders.Add(mealOrder); mealOrder = new MealOrder(); mealOrder.MealName = "Pizza"; mealOrder.NoOfMeals = 20; mealOrders.Add(mealOrder); List <OrderInfo> result = currentOrder.PlaceOrder(mealOrders); Assert.AreEqual(2, result.Count); Assert.AreEqual(false, result[1].OkFromKitchen); Assert.AreEqual(true, result[0].OkFromKitchen); }
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); }
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); }
public void ToKitchenAddRecipeWithoutIngredientsAndQuantity() { Kitchen currentKitchen = new Kitchen(); Recipe newRecipe = new Recipe(); newRecipe.Name = "PyttIPanna"; Assert.AreEqual(false, currentKitchen.AddRecipe(newRecipe)); }
public void ToKitchenAddRecipeWithoutName() { Kitchen currentKitchen = new Kitchen(); Recipe newRecipe = new Recipe(); newRecipe.IngredientsAndQuantity.Add(new KeyValuePair <string, double>("Sausage", 1)); Assert.AreEqual(false, currentKitchen.AddRecipe(newRecipe)); }
public void FromKitchenGetRecipeSimilarName() { Kitchen currentKitchen = new Kitchen(); Recipe newRecipe = new Recipe(); newRecipe.Name = "SausageStroganoffVeggie"; 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); newRecipe = new Recipe(); newRecipe.Name = "SausageStroganoff"; 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); Recipe result = currentKitchen.GetRecipe("SausageStroganoff"); Assert.AreEqual(newRecipe.Name, result.Name); }
public void FromKitchenWithoutAvailabileMealsGetPossibleMeals() { Kitchen currentKitchen = new Kitchen(); Recipe newRecipe = new Recipe(); newRecipe.Name = "SausageStroganoffVeggie"; 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); List <string> result = currentKitchen.PossibleMeals(); Assert.AreEqual(true, result != null); Assert.AreEqual(0, result.Count); }
public void FromKitchenWithNotAvailabileMealPrepareMeal() { Kitchen currentKitchen = new Kitchen(); Recipe newRecipe = new Recipe(); newRecipe.Name = "SausageStroganoff"; newRecipe.Available = false; 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", 1); Assert.AreEqual(false, result); }
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); }
public void IntegrateWithFridgeTest() { RestClient fridgeClient = new RestClient("http://localhost:14589"); var request = new RestRequest("api/fridge/", Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(new FridgeInventory("Sausage", 5) ); var response = new RestResponse(); Task.Run(async() => { response = await GetResponseContentAsync(fridgeClient, request) as RestResponse; }).Wait(); //// request = new RestRequest("api/fridge/", Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(new FridgeInventory("Cream", 7.5) ); response = new RestResponse(); Task.Run(async() => { response = await GetResponseContentAsync(fridgeClient, request) as RestResponse; }).Wait(); //// request = new RestRequest("api/fridge/", Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(new FridgeInventory("Tomato puree", 22) ); response = new RestResponse(); Task.Run(async() => { response = await GetResponseContentAsync(fridgeClient, request) as RestResponse; }).Wait(); Kitchen currentKitchen = new Kitchen(); 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", 3); Assert.AreEqual(true, result); }