public void TestMethod1() { List <string> newIngredients = new List <String> { "Hamburger Meat", "Bacon", "Swiss Cheese", "Lettuce", "Tomato", "Pickle", "Ketchup", "Mayo" }; Menu hamburger = new Menu(1, "Bacon Cheeseburger", "Hamburger with swiss cheese and bacon.", newIngredients, 10.99); MenuRepo newMenuRepo = new MenuRepo(); newMenuRepo.AddMenuToLists(hamburger); //added //Add Grey Pupon Mustard List <string> newIngredients2 = new List <String> { "Grey Poupon Mustard", "Hamburger Meat", "Bacon", "Swiss Cheese", "Lettuce", "Tomato", "Pickle", "Ketchup", "Mayo" }; Menu hamburger2 = new Menu(1, "Bacon Cheeseburger", "Hamburger with swiss cheese and bacon.", newIngredients2, 10.99); newMenuRepo.UpdateExistingMenu(1, hamburger2); Menu hamburger3 = newMenuRepo.GetMenuItemById(1); bool actual = hamburger3.Ingredents.Contains("Grey Poupon Mustard"); bool expected = true; Assert.AreEqual(expected, actual); //Created without issue and added to list }
public void TestMethod1() { List <string> newIngredients = new List <String> { "Hamburger Meat", "Bacon", "Swiss Cheese", "Lettuce", "Tomato", "Pickle", "Ketchup", "Mayo" }; Menu hamburger = new Menu(1, "Bacon Cheeseburger", "Hamburger with swiss cheese and bacon.", newIngredients, 10.99); MenuRepo newMenuRepo = new MenuRepo(); newMenuRepo.AddMenuToLists(hamburger); //added Menu NewMenu2 = newMenuRepo.GetMenuItemById(1); Assert.IsNotNull(NewMenu2); //Should pass if created and added by repo }
//Creating new Menu Item private void CreateNewMenuItem() { Console.Clear(); Menu newMenu = new Menu(); //Menu Item Id Console.WriteLine("Enter a unique Number for the new Menu Item:"); string mealNum = Console.ReadLine(); newMenu.MealNumber = Convert.ToInt16(mealNum); //Menu Item Name Console.WriteLine("Enter the name for the new Menu Item:"); newMenu.MealName = Console.ReadLine(); //Menu Item Description Console.WriteLine("Enter the description for the new Menu Item:"); newMenu.Description = Console.ReadLine(); //Menu Item Ingredients Console.WriteLine("Enter the Ingredients for the new Menu Item"); List <string> ingredients = new List <string>(); //loop until user hits exit bool keepRunning2 = true; while (keepRunning2) { //Display the options Console.WriteLine("Select a menu option:\n" + "1 - Add New Ingredient\n" + "All other key - No additional ingedients"); // Get users input string input = Console.ReadLine(); //Evaluate user input and act accordingly switch (input) { case "1": //Add new Ingredient Console.WriteLine("Add Ingrident:\n"); string ingredient = Console.ReadLine(); ingredients.Add(ingredient); break; default: keepRunning2 = false; break; } } if (ingredients.Count > 0) { newMenu.Ingredents = ingredients; } //Menu Item Price Console.WriteLine("Please insert menu item price:"); string menupriceinit = Console.ReadLine(); newMenu.MealPrice = Convert.ToDouble(menupriceinit); _menuItemDirectory.AddMenuToLists(newMenu); }