private void DeleteMenuItem() { Console.WriteLine("Which meal number would you like to remove from the menu?"); List <Meal> mealList = _mealRepo.GetItemsFromMenu(); int count = 0; foreach (Meal meal in mealList) { count++; Console.WriteLine($"{count}. {meal.Name}"); } int targetMealId = Convert.ToInt32(Console.ReadLine()); int targetIndex = targetMealId - 1; if (targetIndex >= 0 && targetIndex < mealList.Count) { Meal desiredMeal = mealList[targetIndex]; if (_mealRepo.DeleteExistingMenuItem(desiredMeal)) { Console.WriteLine($"{desiredMeal.Name} was successfully removed."); } else { Console.WriteLine("Sorry Dr.Suess. Meal was not removed."); } } else { Console.WriteLine("Invalid response. Meal could not be removed"); } Console.WriteLine("\n Press any key to continue..."); Console.ReadKey(); }
public void DeleteMealFromMenu_ShouldGetCorrectBool() { //Arrange Meal meal = _mealRepo.GetMealByName("Chicken Soup"); //ACT bool wasRemoved = _mealRepo.DeleteExistingMenuItem(meal); //Assert Assert.IsTrue(wasRemoved); }