public void Arrange()
        {
            Meal contentOne = new Meal()
            {
                MealNumber  = 1,
                MealName    = "Tenders Meal",
                Description = "4-piece Chicken Tenders with Medium Fry and Medium Drink",
                Ingredients = new List <string> {
                    "fried chicken breast", "buttermilk breading", "natural cut fries"
                },
                Price = 5.99m
            };

            _repo.AddMealToMenu(contentOne);


            Meal contentTwo = new Meal()
            {
                MealNumber  = 3,
                MealName    = "Double Cheese Meal",
                Description = "Double Cheeseburger with Medium Fry and Medium Drink",
                Ingredients = new List <string> {
                    "USDA beef", "cheese", "ketchup", "tomato", "onion", "lettuce", "natural cut fries"
                },
                Price = 6.99m
            };

            _repo.AddMealToMenu(contentTwo);
        }
Exemple #2
0
        public void AddMealToMenu()
        {
            Console.Clear();
            Menu newMenuMeal = new Menu();

            Console.WriteLine("Enter the new Meal Number:");
            string mealNumAsString = Console.ReadLine();
            int    mealNumAsInt    = int.Parse(mealNumAsString);

            newMenuMeal.MealNumber = mealNumAsInt;

            Console.WriteLine("\nEnter the new Meal Name:");
            newMenuMeal.MealName = Console.ReadLine();

            Console.WriteLine("\nEnter the new meal Description:");
            newMenuMeal.Description = Console.ReadLine();

            Console.WriteLine("\nEnter the new Meal Ingredients:");
            newMenuMeal.ListOfIngredients = Console.ReadLine();

            Console.WriteLine("\nEnter the new Meal Price:");
            string priceAsString = Console.ReadLine();
            double priceAsDouble = double.Parse(priceAsString);

            newMenuMeal.Price = priceAsDouble;

            _menu.AddMealToMenu(newMenuMeal);
        }
Exemple #3
0
        private void CreateMenuItem()
        {
            Console.Clear();
            Meal newMeal = new Meal();

            bool hasValidItemNumber = false;

            while (hasValidItemNumber == false)
            {
                Console.WriteLine("Enter the item number for the meal:");
                string newMealNumAsString = Console.ReadLine();
                try
                {
                    newMeal.MealNumber = int.Parse(newMealNumAsString);
                    hasValidItemNumber = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"{ex.Message} Please enter as a numeric number.\n" +
                                      "Press enter to try again. . .");
                    Console.ReadLine();
                }
            }

            Console.WriteLine("\nEnter the name of the meal:");
            newMeal.MealName = Console.ReadLine();

            Console.WriteLine("\nEnter the description of the meal:");
            newMeal.MealDescription = Console.ReadLine();

            Console.WriteLine("\nEnter the ingrediants of the meal:");
            newMeal.MealIngredients = Console.ReadLine();

            bool hasValidPriceNumber = false;

            while (hasValidPriceNumber == false)
            {
                Console.WriteLine("\nEnter the price of the meal:");
                string newMealPriceAsString = Console.ReadLine();
                try
                {
                    newMeal.MealPrice   = decimal.Parse(newMealPriceAsString, System.Globalization.NumberStyles.AllowCurrencySymbol | System.Globalization.NumberStyles.Number);
                    hasValidPriceNumber = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"{ex.Message} please enter as a numeric number.\n" +
                                      "Example: 12.34 or $12.34\n" +
                                      "Press enter to try again. . .");
                    Console.ReadLine();
                }
            }
            _menuRepo.AddMealToMenu(newMeal);
        }
Exemple #4
0
        public void Arrange()
        {
            _repo    = new MenuRepo();
            _content = new Menu(4, "Philly Cheesesteak", "Delicious, but not so nutritious!", "Meat, Cheese, Lettuce, Tomato, and Mayonnaise", 7.99);

            _repo.AddMealToMenu(_content);
        }
Exemple #5
0
        private void CreateAMenuItem()
        {
            Console.Clear();
            Menu newMeal = new Menu();


            Console.WriteLine("What would you like to call this meal?");
            newMeal.MealName = Console.ReadLine();

            Console.WriteLine("What number will this meal be assigned?");
            string mealNumberAsString = Console.ReadLine();

            newMeal.MealNumber = int.Parse(mealNumberAsString);

            Console.WriteLine("Please describe this meal:");
            newMeal.Description = Console.ReadLine();

            Console.WriteLine("Please list the ingredients in this meal:");
            newMeal.Ingredients = Console.ReadLine();

            Console.WriteLine("How much will you charge for this meal? (Please use the format 0.00)");
            string priceAsString = Console.ReadLine();

            newMeal.Price = double.Parse(priceAsString);

            _mealRepo.AddMealToMenu(newMeal);
        }
        public void TestAddItem()
        {
            MenuRepo menuRepo = new MenuRepo();
            Meal     testMeal = new Meal();

            Assert.AreEqual(0, menuRepo.GetMenuList().Count);
            //This is what I'm testing compare list before and after
            menuRepo.AddMealToMenu(testMeal);
            Assert.AreEqual(1, menuRepo.GetMenuList().Count);
        }
        public void TestDeleteItem()
        {
            MenuRepo menuRepo    = new MenuRepo();
            Meal     testOldMeal = new Meal(1, "Fries", "Side order of fries", "potatoes, greese, salt, mayo", 2.50m);

            menuRepo.AddMealToMenu(testOldMeal);
            // ensure meal was added to list
            Assert.AreEqual(1, menuRepo.GetMenuList().Count);
            // test that the meal was removed from list
            string mealName = "Fries";

            menuRepo.GetMenuItemByName(mealName);
            menuRepo.DeleteFromMenu(mealName);
            Assert.AreEqual(0, menuRepo.GetMenuList().Count);
        }
Exemple #8
0
        public void AddToMenu_ShouldGetNotNull()
        {
            // Arrange --> Setting up the playing field
            Menu content = new Menu();

            content.MealNumber = 5;
            MenuRepo repository = new MenuRepo();

            // Act --> Get/Run the we want to test
            repository.AddMealToMenu(content);
            Menu contentFromMenu = repository.GetMealById(5);

            // Assert --> Use the assert class to verify the expected outcome
            Assert.IsNotNull(contentFromMenu);
        }
        public void TestGetByID()
        {
            MenuRepo menuRepo = new MenuRepo();
            Menu     testMeal = new Menu(10, "Bub", "Drink", "Soda", 99.99);

            menuRepo.AddMealToMenu(testMeal);

            List <Menu> mealMenu = menuRepo.GetMenu();

            foreach (Menu meal in mealMenu)
            {
                if (meal.MealNumber == testMeal.MealNumber)
                {
                    Assert.IsTrue(testMeal.MealNumber == 10);
                }
            }
        }
        public void TestingAddToMenu()
        {
            MenuRepo menuRepo = new MenuRepo();
            Menu     testMeal = new Menu(4, "Bub", "Drink", "Soda", 99.99);

            menuRepo.AddMealToMenu(testMeal);

            List <Menu> mealMenu = menuRepo.GetMenu();

            bool mealNumberIsEqual = false;

            foreach (Menu meal in mealMenu)
            {
                if (meal.MealNumber == testMeal.MealNumber)
                {
                    mealNumberIsEqual = true;
                    break;
                }
            }
            Assert.IsTrue(mealNumberIsEqual);
        }
        public void TestingDeleteMethod()
        {
            MenuRepo menuRepo = new MenuRepo();
            Menu     testMeal = new Menu(10, "Bub", "Drink", "Soda", 99.99);

            menuRepo.AddMealToMenu(testMeal);
            menuRepo.DeleteMenuItem(10);

            List <Menu> mealMenu = menuRepo.GetMenu();

            bool notDeleted = true;

            foreach (Menu meal in mealMenu)
            {
                if (meal.MealNumber == 10)
                {
                    notDeleted = false;
                    break;
                }
            }
            Assert.IsTrue(notDeleted);
        }