Exemple #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();
        }
        public void ShowAllItems()
        {
            Console.Clear();
            List <Menu> directory = _cafeRepository.GetContents();

            foreach (Menu item in directory)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
Exemple #3
0
        public void GetContents_ShouldReturnCorrectCollection()
        {
            //Arrange
            MenuItem       content = new MenuItem();
            CafeRepository repo    = new CafeRepository();

            repo.AddMealToMenu(content);
            //Act
            List <MenuItem> contents            = repo.GetContents();
            bool            directoryHasContent = contents.Contains(content);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }