예제 #1
0
        private void DeleteMenuItem()
        {
            Console.Clear();

            Console.WriteLine("Which menu item would you like to remove?");

            List <CafeContent> menuList = _menuRepo.GetItems();

            int count = 0;

            foreach (CafeContent menuItem in menuList)
            {
                count++;
                Console.WriteLine($"{count}. {menuItem.MealName}");
            }

            int targetItemID = int.Parse(Console.ReadLine());
            int targetIndex  = targetItemID - 1;

            if (targetIndex >= 0 && targetIndex < menuList.Count)
            {
                CafeContent desiredItem = menuList[targetIndex];

                if (_menuRepo.DeleteItemFromMenu(desiredItem))
                {
                    Console.WriteLine($"{desiredItem.MealName} was removed.");
                }
            }
            else
            {
                Console.WriteLine("No item by that name found.");
            }
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
예제 #2
0
        public void RDeleteMenuItemTest()
        {
            //arrange
            CafeContent item = _repo.GetItemByTitle("Hamburger");

            //act
            bool removeItem = _repo.DeleteItemFromMenu(item);

            //assert
            Assert.IsTrue(removeItem);
        }