private void AddNewMeal()
        {
            CafeMenuRepository newMeal = new CafeMenuRepository();

            Console.WriteLine("What is the Meal Number?");
            int mealNumber = Convert.ToString(Console.ReadLine();

            Console.WriteLine("What is the Meal Name?");
            string mealName = Console.ReadLine();

            Console.WriteLine("What is the Meal Description?");
            string mealDescription = Console.ReadLine();

            Console.WriteLine("What ingredients are included in this meal");
            string ingredients = Console.ReadLine();
            {
                List<Menu> listOfIngredients = new List<Menu>();
                listOfIngredients.Add(Console.ReadLine());
                int numberOfIngredients = listOfIngredients.Count;
                Console.WriteLine($"Ingredient {numberOfIngredients + 1}:");
                string userInput = Console.ReadLine();
            } 
            
            Console.WriteLine("What is the Price of this meal ? Enter a decimal amount (ex: 10.50):");
            decimal mealPrice = decimal.Parse(Console.ReadLine());
            
            _menuRepository.AddItemToMenu(newMeal);
            Console.WriteLine($"{} has been added to the Menu.\n" +
                $"Press any key to continue.");
            Console.ReadKey();
        }
        public void DeleteMenuItem_ShouldReturnTrue()
        {
            CafeMenuRepository _cafeMenuRepo = new CafeMenuRepository();

            // Arrange
            //   seed the menu list
            MenuItem seedMenuItem1 = new MenuItem(1, "Meal One", "The first meal on the menu", "One burger, One bun, One whiskey", 11.11m);
            MenuItem seedMenuItem2 = new MenuItem(2, "Meal Two", "The second meal on the menu", "Two burgers, Two buns, Two whiskeys", 22.22m);
            MenuItem seedMenuItem3 = new MenuItem(3, "Meal Three", "The third meal on the menu", "Three burgers, Three buns, Three whiskeys", 33.33m);
            MenuItem seedMenuItem4 = new MenuItem(4, "Meal Four", "The fourth meal on the menu", "Four burgers, Four buns, Four whiskeys", 44.44m);

            _cafeMenuRepo.AddItemToMenu(seedMenuItem1);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem2);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem3);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem4);

            // get menu item 3 from the list
            MenuItem menuItem = _cafeMenuRepo.GetMenuItemByMealNumber(3);

            // Act
            //    delete menu item 3 from the list
            bool menuItemDeleted = _cafeMenuRepo.DeleteMenuItem(menuItem);

            // Assert
            Assert.IsTrue(menuItemDeleted);
        }
        public void InitializeTests()
        {
            // ?????????  Is this running before each test  ?????????
            CafeMenuRepository _cafeMenuRepo       = new CafeMenuRepository();
            List <MenuItem>    allMenuItemsDeleted = _cafeMenuRepo.DeleteAllMenuItems();
            // seed the repository with menu items with this constructor
            // public MenuItem(int mealNumber, string mealName, string mealDescription, string mealIngredients, decimal mealPrice)

            MenuItem seedMenuItem1 = new MenuItem(1, "Meal One", "The first meal on the menu", "One burger, One bun, One whiskey", 11.11m);
            MenuItem seedMenuItem2 = new MenuItem(2, "Meal Two", "The second meal on the menu", "Two burgers, Two buns, Two whiskeys", 22.22m);
            MenuItem seedMenuItem3 = new MenuItem(3, "Meal Three", "The third meal on the menu", "Three burgers, Three buns, Three whiskeys", 33.33m);
            MenuItem seedMenuItem4 = new MenuItem(4, "Meal Four", "The fourth meal on the menu", "Four burgers, Four buns, Four whiskeys", 44.44m);

            _cafeMenuRepo.AddItemToMenu(seedMenuItem1);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem2);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem3);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem4);
        }
        public void GetMenuItemByMealNumber_ShouldReturnRequestedMenuItem()
        {
            CafeMenuRepository _cafeMenuRepo = new CafeMenuRepository();

            // Arrange
            //   seed the menu list
            MenuItem seedMenuItem1 = new MenuItem(1, "Meal One", "The first meal on the menu", "One burger, One bun, One whiskey", 11.11m);
            MenuItem seedMenuItem2 = new MenuItem(2, "Meal Two", "The second meal on the menu", "Two burgers, Two buns, Two whiskeys", 22.22m);
            MenuItem seedMenuItem3 = new MenuItem(3, "Meal Three", "The third meal on the menu", "Three burgers, Three buns, Three whiskeys", 33.33m);
            MenuItem seedMenuItem4 = new MenuItem(4, "Meal Four", "The fourth meal on the menu", "Four burgers, Four buns, Four whiskeys", 44.44m);

            _cafeMenuRepo.AddItemToMenu(seedMenuItem1);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem2);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem3);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem4);

            // Act
            MenuItem menuItem = _cafeMenuRepo.GetMenuItemByMealNumber(3);

            // Assert
            Assert.AreEqual(menuItem, seedMenuItem3);
        }
        public void AddItemToMenu_ShouldReturnTrue()
        {
            CafeMenuRepository _cafeMenuRepo = new CafeMenuRepository();

            // Arrange
            MenuItem seedMenuItem5 = new MenuItem(5, "Meal Five", "The fifth meal on the menu", "Five burgers, Five buns, Five whiskeys", 55.55m);

            // Act
            bool addItemToMenu = _cafeMenuRepo.AddItemToMenu(seedMenuItem5);

            // Assert
            Assert.IsTrue(addItemToMenu);
        }
        public void GetAllMenuItems_ShouldReturnMenuItemList()
        {
            CafeMenuRepository _cafeMenuRepo = new CafeMenuRepository();

            // Arrange
            // look in TestInitialize
            MenuItem seedMenuItem1 = new MenuItem(1, "Meal One", "The first meal on the menu", "One burger, One bun, One whiskey", 11.11m);
            MenuItem seedMenuItem2 = new MenuItem(1, "Meal Two", "The second meal on the menu", "Two burgers, Two buns, Two whiskeys", 22.22m);
            MenuItem seedMenuItem3 = new MenuItem(1, "Meal Three", "The third meal on the menu", "Three burgers, Three buns, Three whiskeys", 33.33m);
            MenuItem seedMenuItem4 = new MenuItem(1, "Meal Four", "The fourth meal on the menu", "Four burgers, Four buns, Four whiskeys", 44.44m);

            _cafeMenuRepo.AddItemToMenu(seedMenuItem1);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem2);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem3);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem4);


            // Act
            List <MenuItem> listOfAllItems = _cafeMenuRepo.GetAllMenuItems();

            // Assert
            Assert.AreEqual(listOfAllItems.Count, 4);
        }
        }         // RunMenu method

        private void AddMenuItem()
        {
            int newMealNumber = PromptForMealNumber();

            if (newMealNumber <= 0)
            {
                Console.WriteLine("Sorry. There was a problem. Please try again. \n" +
                                  "Press any key to continue..");
            }
            else
            {
                Console.WriteLine("What's the name if this meal?");
                string newMealName = Console.ReadLine();
                Console.WriteLine("Describe the meal.");
                string newMealDescription = Console.ReadLine();
                Console.WriteLine("What are the ingredients?");
                string newMealIngredients = Console.ReadLine();
                Console.WriteLine("What's the price of this meal? ");
                decimal newMealPrice = Convert.ToDecimal(Console.ReadLine());

                MenuItem newMeal = new MenuItem(newMealNumber, newMealName, newMealDescription, newMealIngredients, newMealPrice);
                if (!_cafeMenuRepo.AddItemToMenu(newMeal))
                {
                    Console.WriteLine("Sorry. Your new meal wasn't added. Please try again.");
                }
                else
                {
                    Console.WriteLine($"Your new meal is \n" +
                                      $"#{newMealNumber}   {newMealName}                        ${newMealPrice} \n" +
                                      $"      {newMealDescription} \n" +
                                      $"      {newMealIngredients} \n" +
                                      "Press any key to continue...");
                    Console.ReadLine();
                }
            }
        } // AddMenuItem method
        public void DeleteAllMenuItems_ShouldReturnEmptyList()
        {
            CafeMenuRepository _cafeMenuRepo = new CafeMenuRepository();

            // Arrange
            // seed the repository with menu items with this constructor
            // public MenuItem(int mealNumber, string mealName, string mealDescription, string mealIngredients, decimal mealPrice)

            MenuItem seedMenuItem1 = new MenuItem(1, "Meal One", "The first meal on the menu", "One burger, One bun, One whiskey", 11.11m);
            MenuItem seedMenuItem2 = new MenuItem(2, "Meal Two", "The second meal on the menu", "Two burgers, Two buns, Two whiskeys", 22.22m);
            MenuItem seedMenuItem3 = new MenuItem(3, "Meal Three", "The third meal on the menu", "Three burgers, Three buns, Three whiskeys", 33.33m);
            MenuItem seedMenuItem4 = new MenuItem(4, "Meal Four", "The fourth meal on the menu", "Four burgers, Four buns, Four whiskeys", 44.44m);

            _cafeMenuRepo.AddItemToMenu(seedMenuItem1);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem2);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem3);
            _cafeMenuRepo.AddItemToMenu(seedMenuItem4);

            // Act
            List <MenuItem> allMenuItemsDeleted = _cafeMenuRepo.DeleteAllMenuItems();

            // Assert
            Assert.AreEqual(allMenuItemsDeleted.Count, 0);
        }
Exemple #9
0
 public void Arrange()
 {
     _CafeMenuRepository = new CafeMenuRepository();
     _meal = new Menu("Burger", '1', "Grilled Burger", "Two all beef patties, special sauce, lettuce, cheese, pickle, onion, and a sesame seed bun.", 9.99d);
     _CafeMenuRepository.AddItemToMenu(_meal);
 }