public void Meal_RemoveMealFromList_ShouldRemoveMealFromList() { //arrange MenuRepo menuRpo = new MenuRepo(); Menu content = new Menu(2, "Burger", "Best Burger In Town", "Meat, onions, pickle, mayo", 10.20); Menu content2 = new Menu(3, "Burger", "Best Burger In Town", "Meat, onions, pickle, mayo", 10.20); //act menuRpo.AddToList(content); menuRpo.AddToList(content2); menuRpo.RemoveMealFromList(2); List <Menu> list = menuRpo.GetMealList(); var actual = list.Count; var expected = 1; //assert Assert.AreEqual(expected, actual); }
private void CreateMenuItem() { Console.Clear(); Console.WriteLine("What would you like the meal number to be?"); string mealNumberAsString = Console.ReadLine(); int numberOfMeal = 0; bool correct = IntTest(mealNumberAsString); if (correct) { numberOfMeal = int.Parse(mealNumberAsString); Console.WriteLine("You have succesfully added a meal number"); } else { Console.WriteLine("Please enter a valid number."); Console.ReadLine(); CreateMenuItem(); } Console.Clear(); Console.WriteLine("What would you like the meal name to be?"); string mealName = Console.ReadLine(); Console.Clear(); Console.WriteLine("How would you like to describe the meal?"); string mealDescription = Console.ReadLine(); Console.Clear(); Console.WriteLine("What are the main ingredients in this meal?"); string mainIngredients = Console.ReadLine(); Console.Clear(); Console.WriteLine("What would you like the price to be on this meal?"); string priceAsString = Console.ReadLine(); double price = 0; bool correct1 = IntTest(priceAsString); if (correct1) { price = double.Parse(priceAsString); Console.WriteLine("You have succesfully set the meal price"); } else { Console.WriteLine("Please enter a valid price."); } Console.ReadLine(); Menu newContent = new Menu(numberOfMeal, mealName, mealDescription, mainIngredients, price); _newMenuRepo.AddToList(newContent); }
public void Meal_AddToList_ShouldAddMealToList() { MenuRepo newRpo = new MenuRepo(); //arrange MenuRepo menuRpo = new MenuRepo(); Menu content = new Menu(2, "Burger", "Best Burger In Town", "Meat, onions, pickle, mayo", 10.20); //act menuRpo.AddToList(content); List <Menu> list = menuRpo.GetMealList(); var actual = list.Count; var expected = 1; //assert Assert.AreEqual(expected, actual); Assert.IsTrue(list.Contains(content)); }