Пример #1
0
        private void CreateItem()
        {
            Console.Clear();
            Menu menu = new Menu();

            Console.WriteLine("Please enter the number of the meal: ");
            menu.MealNumber = int.Parse(Console.ReadLine());

            Console.WriteLine("Please enter the meal name: ");
            menu.MealName = Console.ReadLine();

            Console.WriteLine("Please enter the description of the meal: ");
            menu.Description = Console.ReadLine();


            bool          condition = true; //Exit condition
            List <string> ingred    = new List <string>();

            Console.WriteLine("Please enter ingredients one at time then press enter Ex. (Bun) 'Press enter': ");
            Console.WriteLine("Enter the word 'exit' when you are finished.");
            do
            {
                string answer = Console.ReadLine();
                if (answer != "exit")
                {
                    ingred.Add(answer);
                }
                else
                {
                    menu.ListOfIngredients = ingred;
                    condition = false;
                }
            } while (condition);

            Console.WriteLine("Enter the price of the menu item: ");
            decimal price = Convert.ToDecimal(Console.ReadLine());

            menu.Price = price;

            bool added = _menuRepo.AddMenuItem(menu);

            if (added)
            {
                Console.WriteLine("Your menu item has been added \n" +
                                  "Press any key to continue");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("There has been an error please try again.");
                Console.ReadKey();
            }
        }
Пример #2
0
        public void UpdateMenuItem_ShouldUpdateItem()
        {
            MenuRepo      repo = new MenuRepo();
            List <string> ing  = new List <string>()
            {
                "ing1", "ing2", "ing3"
            };
            Menu menu = new Menu()
            {
                ItemNumber  = 1,
                MealName    = "Name",
                Ingredients = ing,
                Description = "desc",
                Price       = 2.50m
            };
            List <string> ing2 = new List <string>()
            {
                "1ing", "2ing", "3ing"
            };
            Menu menu2 = new Menu()
            {
                ItemNumber  = 2,
                MealName    = "Name2",
                Ingredients = ing2,
                Description = "desc2",
                Price       = 2.75m
            };

            repo.AddMenuItem(menu);
            repo.UpdateExistingMenuItem(menu.ItemNumber, menu2);
            Menu actual = repo.GetMenuItems()[0];

            Assert.AreEqual(menu2, actual);
        }
Пример #3
0
        public void AddMenuItem()
        {
            Console.WriteLine("Please input the new item's menu number.");
            string inputMenuNumber = Console.ReadLine();
            int    menuNum         = int.Parse(inputMenuNumber);

            Console.WriteLine("Please input the new item's menu name.");
            string inputMenuName = Console.ReadLine();

            Console.WriteLine("Please input the new item's description.");
            string inputDescription = Console.ReadLine();

            Console.WriteLine("Please input the new item's price.");
            string inputPrice = Console.ReadLine();
            double menuPrice  = double.Parse(inputPrice);

            //empty list
            List <string> placeholder = new List <string>();

            Menu newItem = new Menu(menuNum, inputMenuName, inputDescription, menuPrice, placeholder);

            _menuRepo.AddMenuItem(newItem);

            Console.WriteLine($"{inputMenuName} has been completely added to the Menu.");
        }
Пример #4
0
        //Create new Menu Item
        private void CreateMenuItem()
        {
            Console.Clear();
            Menu newMenuItem = new Menu();

            Console.WriteLine("Enter the Menu Item Number:");
            string numberAsString = Console.ReadLine();

            newMenuItem.Number = int.Parse(numberAsString);

            Console.WriteLine("Enter the Menu Item Name");
            newMenuItem.Name = Console.ReadLine().ToLower();

            Console.WriteLine("Enter the Description for the Item");
            newMenuItem.Description = Console.ReadLine();

            Console.WriteLine("Add an ingredient:");
            newMenuItem.ListOfIngredients.Add(Console.ReadLine());
            bool stillAdding = true;

            while (stillAdding)
            {
                Console.WriteLine("Would you like add another ingredient?(y/n)");
                string input = Console.ReadLine();
                switch (input.ToLower())
                {
                case "y":
                    Console.WriteLine("Add an ingredient:");
                    newMenuItem.ListOfIngredients.Add(Console.ReadLine());
                    break;

                case "n":
                    stillAdding = false;
                    break;
                }
                // took these two lines out because it caused extra prompts for "would you like to add an ingredient" to show up instead of moving on to the next property immediately
                // Console.WriteLine("Would you like add another ingredient?(y/n)");
                // input = Console.ReadLine();
            }

            Console.WriteLine("Enter the price for the menu item:");
            string priceAsString = Console.ReadLine();

            newMenuItem.Price = decimal.Parse(priceAsString);

            _menuRepo.AddMenuItem(newMenuItem);
        }
Пример #5
0
        public void Arrange()
        {
            _repo = new MenuRepo();
            _menu = new Menu(1, "Pasta", "Pasta with meatballs", new List <string> {
                "Noodles", "Marinara", "Meatballs"
            }, 4.99m);

            _repo.AddMenuItem(_menu);
        }
 public void Arrange()
 {
     _repo = new MenuRepo();
     _menu = new Menu(1, "Teriyaki Chicken", "Lunch", new List <string>()
     {
         "chicken", "rice", "vegetables", "teriyaki sauce", "soy sauce"
     }, 9.99m);
     _repo.AddMenuItem(_menu);
 }
Пример #7
0
        public void ShouldAddNew()
        {
            Menu item = new Menu(5, "Sushi", "Fresh fish on rice", 10.99d, ingredients);

            _menuRepo.AddMenuItem(item);

            var expected = 4;
            var actual   = _menuRepo.GetMenuItems().Count;

            Assert.AreEqual(expected, actual);
        }
        public void AddMenuItem_ShouldGetNotNull()
        {
            Menu menu = new Menu(12, "Teriyaki Chicken", "Lunch", new List <string>()
            {
                "chicken", "rice", "vegetables", "teriyaki sauce", "soy sauce"
            }, 9.99m);

            //menu.MealNumber = 12;
            _repo.AddMenuItem(menu);
            Menu mealMenu = _repo.GetMenuByMenuNumber(12);

            Assert.IsNotNull(mealMenu);
        }
Пример #9
0
        public void GetAllItems_ShouldReturnCorrectList() //Read TEST
        {
            //Arrange
            Menu     testFood = new Menu(); //Creating objects to test again
            MenuRepo repo     = new MenuRepo();

            repo.AddMenuItem(testFood); //Adding to list

            //Act
            List <Menu> menuList         = repo.GetAllItems();
            bool        menuListHasItems = menuList.Contains(testFood);

            //Assert
            Assert.IsTrue(menuListHasItems);
        }
Пример #10
0
        public void AddMenuItem_ShouldGetNotNull()
        {
            //arrange
            Menu menu = new Menu();

            menu.Name = "Pasta";
            MenuRepo repo = new MenuRepo();

            //act
            repo.AddMenuItem(menu);
            Menu menuFromDirectory = repo.GetMenuItemByName("Pasta");


            //assert
            Assert.IsNotNull(menuFromDirectory);
        }
Пример #11
0
        public void AddMenuItem_ShouldGetNotNull()
        {
            MenuRepo      repo = new MenuRepo();
            List <string> ing  = new List <string>()
            {
                "ing1", "ing2", "ing3"
            };
            Menu menu = new Menu()
            {
                ItemNumber  = 1,
                MealName    = "Name",
                Ingredients = ing,
                Description = "desc",
                Price       = 2.50m
            };

            repo.AddMenuItem(menu);
            Assert.IsNotNull(repo.GetMenuItems());
        }
Пример #12
0
        public void RemoveMenuItem_ShouldHaveZeroItems()
        {
            MenuRepo      repo = new MenuRepo();
            List <string> ing  = new List <string>()
            {
                "ing1", "ing2", "ing3"
            };
            Menu menu = new Menu()
            {
                ItemNumber  = 1,
                MealName    = "Name",
                Ingredients = ing,
                Description = "desc",
                Price       = 2.50m
            };

            repo.AddMenuItem(menu);
            repo.RemoveMenuItem(menu.ItemNumber);
            Assert.IsTrue(repo.GetMenuItems().Count == 0);
        }
Пример #13
0
 public void Arrange()
 {
     _repo = new MenuRepo();
     _item = new Menu(1, "Big Mac", "Will make you gain weight..", ingred, 15.15m);
     _repo.AddMenuItem(_item);
 }