private void DeleteExistingContent() { Console.Clear(); Console.Write("Please choose the item you'd like to remove: \n"); List <KomodoCafeContent> contentList = _kcRepo.GetAllContent(); int count = 0; foreach (KomodoCafeContent content in contentList) { count++; Console.Write($"{count} - {content.MealName} \n"); } int targetContentID = int.Parse(Console.ReadLine()); int targetIndex = targetContentID - 1; if (targetIndex >= 0 && targetIndex < contentList.Count) { KomodoCafeContent desiredContent = contentList[targetIndex]; if (_kcRepo.DeleteExistingContent(desiredContent)) { Console.Write($"{desiredContent.MealName} has been removed "); } else { Console.Write("Sorry, but you can't do that "); } } else { Console.Write("There has been an error, please try again \n" + "Please press any key to continue"); Console.ReadKey(); } }
public void DeleteExistingContent_ShouldReturnTrue() { KomodoCafeContent toBeDeleted = _kcrepo.GetContentByTitle("Derp"); bool removeResult = _kcrepo.DeleteExistingContent(toBeDeleted); Assert.IsTrue(removeResult); }