Example #1
0
        private void DisplayMenuItemByNumber()
        {
            Console.Clear();
            DisplayAllMenuItems();
            Console.WriteLine("Enter the number of the menu item to display.");
            string   intAsString    = Validation.IntFromStringValidation();
            int      menuItemNumber = int.Parse(intAsString);
            MenuItem menuItem       = _menuItemsRepo.GetMenuItemByNumber(menuItemNumber);

            if (menuItem == null)
            {
                Console.WriteLine("That is not an existing menu item.\n\n" +
                                  "Press any key to continue...");
                Console.ReadKey();
                DisplayMenuItemByNumber();
            }
            else
            {
                Console.WriteLine($"\nNumber: {menuItem.NumberOfMenuItem}\n" +
                                  $"Name: {menuItem.NameOfMenuItem}\n" +
                                  $"Description: {menuItem.DescriptionOfMenuItem}\n" +
                                  $"Price: ${menuItem.PriceOfMenuItem}");
                Console.Write("Ingredients: ");
                DisplayIngredients(menuItem);
                Console.WriteLine();
            }
        }
Example #2
0
        public void TestGetMenuItemByID()
        {
            MenuItem menuItemByID      = _repo.GetMenuItemByNumber(menuItem1.NumberOfMenuItem);
            bool     itemNamesAreEqual = menuItem1.NameOfMenuItem == menuItemByID.NameOfMenuItem;

            Assert.IsTrue(itemNamesAreEqual);
        }
Example #3
0
        public void AddToList_ShouldGetNotNull()
        {
            MenuItem menuItem = new MenuItem();

            menuItem.NameOfMenuItem = "Doublemeat Medley";
            MenuItemsRepo repository = new MenuItemsRepo();

            repository.AddItemToMenu(menuItem);
            MenuItem menuItemFromList = repository.GetMenuItemByNumber(1);

            Assert.IsNotNull(menuItemFromList);
        }