Exemple #1
0
        private void DeleteMeal()
        {
            Console.Clear();
            ViewAllMeals();
            Console.WriteLine("Enter the meal number for the meal you would like to delete");
            bool wasDeleted = _repo.DeleteMenuItem(Convert.ToInt32(Console.ReadLine()));

            if (wasDeleted)
            {
                Console.WriteLine("The meal was successfully deleted.");
            }
            else
            {
                Console.WriteLine("The meal was not deleted.");
            }
        }
        public void DeleteFromRepo_ShouldGetNull()
        {
            //we can get rid of one of the original menuItems and then ask for it again
            bool deleteMehtodSaysWorked = _repo.DeleteMenuItem(1);

            if (deleteMehtodSaysWorked)
            {
                MenuItem aTestMenuItem = _repo.ReturnMenuItem(1);
                Assert.AreEqual(aTestMenuItem, null);
            }//end of if method said it worked
            else
            {
                //says it didn't work
                Assert.IsTrue(deleteMehtodSaysWorked);
            }
        }//end of deleteFromRepo method
Exemple #3
0
        private void DeleteExistingMenuItem()
        {
            Console.Clear();
            Console.Write("Enter the # of the menu item you want to delete: ");
            string userInput = Console.ReadLine();
            int    itemNumber;

            int.TryParse(userInput, out itemNumber);

            foreach (MenuItem menuItem in _repo.GetAllMenuItems())
            {
                if (menuItem.MealNumber == itemNumber)
                {
                    _repo.DeleteMenuItem(itemNumber);
                }

                else
                {
                    Console.WriteLine("Unable to locate that menu item.");
                    Thread.Sleep(4000);
                    Menu();
                }
            }
        }
        public void DeleteMenuItem_ShouldReturnTrue()
        {
            bool wasDeleted = _repo.DeleteMenuItem(1);

            Assert.IsTrue(wasDeleted);
        }