Esempio n. 1
0
        private void RemoveMenuItem()
        {
            Console.WriteLine("Which Item Number would you like to remove?");
            List <MenuItem> contentList = _repo.GetContents();
            int             count       = 0;

            foreach (MenuItem content in contentList)
            {
                count++;
                Console.WriteLine($"{count} {content.MealNumber}");
            }
            int targetContentID = int.Parse(Console.ReadLine());
            int targetIndex     = targetContentID - 1;

            if (targetIndex >= 0 && targetIndex < contentList.Count)
            {
                MenuItem desiredContent = contentList[targetIndex];
                if (_repo.DeleteExistingContent(desiredContent))
                {
                    Console.WriteLine($"{desiredContent.MealNumber}  successfully removed");
                }
                else
                {
                    Console.WriteLine($"I'm sorry.  I'm afraid I can't do that.");
                }
            }
            else
            {
                Console.WriteLine("No Content has that id");
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Esempio n. 2
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //Arrange
            MenuItem content = _repo.GetContentByNumber(1);
            //Act
            bool removeResult = _repo.DeleteExistingContent(content);

            //Assert
            Assert.IsTrue(removeResult);
        }