void RemoveItem() { Console.Clear(); Console.WriteLine("Which item would you like to remove (by meal number)?:"); List <MenuItem> removeItem = _repo.GetList(); int count = 0; foreach (MenuItem item in removeItem) { count++; Console.WriteLine($"{count}, {item.MealName}"); } int targetContentID = int.Parse(Console.ReadLine()); int targetIndex = targetContentID - 1; if (targetIndex >= 0 && targetIndex < removeItem.Count) { MenuItem tobeRemoved = removeItem[targetIndex]; if (_repo.DeleteExistingItem(tobeRemoved)) { Console.WriteLine($"{tobeRemoved.MealName} successfully removed."); } else { Console.WriteLine("Nope, that isn't going to work."); } } else { Console.WriteLine("No content has that ID"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Console.Clear(); }
public void TestAddContentToMenu() { int expected = 3; int actual = _repo.GetList().Count; Assert.AreEqual(expected, actual); }
private void ShowMenu() { Console.Clear(); List <MenuList> listOfMenu = _repo.GetList(); foreach (MenuList edible in listOfMenu) { DisplayContent(edible); } }
public void GetList_Test() { //Arrange MenuItem item = new MenuItem(); CafeRepo newRepo = new CafeRepo(); newRepo.AddMenuItem(item); //ACT List <MenuItem> items = newRepo.GetList(); bool hasItems = items.Contains(item); //Assert Assert.IsTrue(hasItems); }
public void RemoveItem_Test() { //Arrange what is needed for method to work CafeRepo _cafeRepo = new CafeRepo(); List <MenuItem> items = _cafeRepo.GetList(); MenuItem item = new MenuItem(); //ACT ---> Call Method _cafeRepo.AddMenuItem(item); bool remove = _cafeRepo.DeleteExistingItem(item); bool doesHaveItem = items.Contains(item); //ASSERT Assert.IsFalse(doesHaveItem); }