private void RemoveMenuItem()
        {
            Console.WriteLine("Which meal would you like to remove?");
            List <CafeMenuContent> menuList = _CafeMenuRepository.ReadMenu();
            int count = 0;

            foreach (CafeMenuContent meal in menuList)
            {
                count++;
                Console.WriteLine($"{count}. {meal.MealName}.");
            }

            int targetCountID = int.Parse(Console.ReadLine());
            int targetIndex   = targetCountID - 1;

            if (targetIndex >= 0 && targetIndex < menuList.Count)
            {
                CafeMenuContent desiredMeal = menuList[targetIndex];
                if (_CafeMenuRepository.DeleteMeal(desiredMeal))
                {
                    Console.WriteLine($"{desiredMeal} has been removed.");
                }
                else
                {
                    Console.WriteLine("Sorry, Buster, I'm afraid I cannot do that.");
                }
            }
            else
            {
                Console.WriteLine("No content has that ID.");
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }
        private void AddMenuItem()
        {
            Console.Clear();

            CafeMenuContent meal = new CafeMenuContent();

            Console.WriteLine("Let's add a meal to your menu!");

            Console.WriteLine("Enter a Number for this meal. This number must be unique.");
            meal.MealNumber = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter a name for this meal.");
            meal.MealName = Console.ReadLine();

            Console.WriteLine("Enter a description for this meal.");
            meal.MealDescription = Console.ReadLine();

            Console.WriteLine("Enter a list of ingredients for this meal.");
            meal.MealIngredients = Console.ReadLine();

            Console.WriteLine("Enter the price for this meal (excluding the $ sign).");
            meal.MealPrice = double.Parse(Console.ReadLine());

            _CafeMenuRepository.AddMealToMenu(meal);
        }
Пример #3
0
        public void DeleteMeal_ShouldReturnTrue()
        {
            CafeMenuContent meal = _repository.GetMealByNumber(5);

            bool removeMeal = _repository.DeleteMeal(meal);

            Assert.IsTrue(removeMeal);
        }
Пример #4
0
        public void Arrange()
        {
            _repository = new CafeMenuContentRepository();

            _meal = new CafeMenuContent(5, "Hamburger", "Beef on Buns", "Buns, Beef, Lettuce, Tomato", 6.98);

            _repository.AddMealToMenu(_meal);
        }
 private void DisplayMenuItem(CafeMenuContent meal)
 {
     Console.WriteLine($"Meal Number: {meal.MealNumber}\n" +
                       $"Meal Name: {meal.MealName}\n" +
                       $"Meal Description: {meal.MealDescription}\n" +
                       $"Meal Ingredients: {meal.MealIngredients}\n" +
                       $"Meal Price: {meal.MealPrice}");
 }
Пример #6
0
        public void AddMealToMenu_ShouldGetCorrectBool()
        {
            CafeMenuContent           meal       = new CafeMenuContent();
            CafeMenuContentRepository repository = new CafeMenuContentRepository();

            bool addResult = repository.AddMealToMenu(meal);

            Assert.IsTrue(addResult);
        }
        public readonly List <CafeMenuContent> _CafeMenu = new List <CafeMenuContent>(); //Creating the menu (list) and naming it _CafeMenu.

        public bool AddMealToMenu(CafeMenuContent meal)                                  //Method to verify that a meal was added to the menu.
        {
            int startingCount = _CafeMenu.Count;                                         //Reading the intial count...

            _CafeMenu.Add(meal);                                                         //Adding the meal...

            bool wasAddedd = (_CafeMenu.Count > startingCount) ? true : false;           //Asking if the new count is greater than the original count...

            return(wasAddedd);                                                           //Returning the value.
        }
Пример #8
0
        public void ReadMenu_ShouldReturnCorrectMenu()
        {
            CafeMenuContent           meal       = new CafeMenuContent();
            CafeMenuContentRepository repository = new CafeMenuContentRepository();

            repository.AddMealToMenu(meal);

            List <CafeMenuContent> meals = repository.ReadMenu();

            bool menuHasMeals = meals.Contains(meal);

            Assert.IsTrue(menuHasMeals);
        }
Пример #9
0
        public void TestMethod2_RemoveMenuItem()
        {
            //Arrange
            CafeMenuContent_Repository repo       = new CafeMenuContent_Repository();
            CafeMenuContent            oldContent = new CafeMenuContent(1, "The Morning Glory", "A breakfest burger to start your day off right.", "Bacon, egg, hash brown, lettuce, tomato, red onion, tomato relish & tarragon mayonnaise.", 10.95);

            repo.AddContentToList(oldContent);
            string mealName = "The Morning Glory";

            //Act
            bool remove = repo.RemoveMenuItem(mealName);

            //Assert
            Assert.IsTrue(remove);
        }
Пример #10
0
        public void TestMethod1_AddContent()
        {
            //Arrange
            CafeMenuContent            content   = new CafeMenuContent();
            CafeMenuContent_Repository repo      = new CafeMenuContent_Repository();
            List <CafeMenuContent>     localList = repo.ReturnMenu();

            //Act
            int beforeCount = localList.Count;

            repo.AddContentToList(content);
            int actual   = localList.Count;
            int expected = beforeCount + 1;

            //Assert

            Assert.AreEqual(expected, actual);
        }
Пример #11
0
        private void ShowMealByNumber()
        {
            Console.Clear();

            Console.WriteLine("Please enter a meal number.");
            int             mealNumberInput = Convert.ToInt32(Console.ReadLine());
            CafeMenuContent meal            = _CafeMenuRepository.GetMealByNumber(mealNumberInput);

            if (meal != null)
            {
                DisplayMenuItem(meal);
            }
            else
            {
                Console.WriteLine("Invalid Menu Number. Could not find any results for:");
                Console.WriteLine($"{mealNumberInput}");
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }
        private void Menu()
        {
            bool keepRunning = true;

            while (keepRunning)
            {
                Console.Clear();
                Console.WriteLine("----Welcome to the Komodo Cafe Menu Interface----");
                Console.WriteLine("What would you like to do?\n" +
                                  "1) Create new menu item\n" +
                                  "2) Delete menu item\n" +
                                  "3) Recieve the current list of menu items\n" +
                                  "4) Exit");
                string input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    AddMenuItem();
                    break;

                case "2":
                    DeleteMenuItem();
                    break;

                case "3":
                    ReturnMenu();
                    break;

                case "4":
                    Console.WriteLine("Goodbye!");
                    keepRunning = false;
                    break;

                default:
                    Console.WriteLine("Please enter a valid number.");
                    break;
                }
                Console.WriteLine("Press any key to continue...");
                Console.ReadLine();
                Console.Clear();
            }

            void AddMenuItem()
            {
                Console.Clear();
                CafeMenuContent newContent = new CafeMenuContent();

                //Meal Number
                Console.Write("Enter the meal number: ");
                string mealNumberString = Console.ReadLine();

                newContent.MealNumber = int.Parse(mealNumberString);

                //Meal Name
                Console.Write("Enter the meal name: ");
                newContent.MealName = Console.ReadLine();

                //Meal Description
                Console.Write("Enter the meal description: ");
                newContent.BriefDescription = Console.ReadLine();

                //List of Ingredients
                Console.Write("Enter the meal ingredients: ");
                newContent.ListOfIngredients = Console.ReadLine();

                //Meal Price
                Console.Write("Enter the meal price: ");
                string mealPriceString = Console.ReadLine();

                newContent.Price = double.Parse(mealPriceString);

                _repoCafeContent.AddContentToList(newContent);
            }

            void ReturnMenu()
            {
                List <CafeMenuContent> _listOfMenuItems = _repoCafeContent.ReturnMenu();

                Console.Clear();
                foreach (CafeMenuContent content in _listOfMenuItems)
                {
                    Console.WriteLine($"Meal Number: {content.MealNumber}\n" +
                                      $"Title: {content.MealName}\n" +
                                      $"Description: {content.BriefDescription}\n" +
                                      $"Ingredients: {content.ListOfIngredients}\n" +
                                      $"Price: ${content.Price}\n" +
                                      "-------------------------");
                }
            }

            void  DeleteMenuItem()
            {
                ReturnMenu();
                Console.Write("Enter the name of the meal you would like to delete: ");
                string userInput = Console.ReadLine();
                bool   deleted   = _repoCafeContent.RemoveMenuItem(userInput);

                if (deleted)
                {
                    Console.WriteLine("The content was successfully deleted.");
                }
                else
                {
                    Console.WriteLine("The content could not be deleted. Try again.");
                }
            }
        }
Пример #13
0
        public void GetMealByMealNumber_ShouldReturnCorrectMeal()
        {
            CafeMenuContent searchForMeal = _repository.GetMealByNumber(5);

            Assert.AreEqual(_meal, searchForMeal);
        }
Пример #14
0
 public void Arrange()
 {
     CafeMenuContent            content = new CafeMenuContent();
     CafeMenuContent_Repository repo    = new CafeMenuContent_Repository();
 }
        public bool DeleteMeal(CafeMenuContent existingMeal)
        {
            bool deleteMeal = _CafeMenu.Remove(existingMeal);

            return(deleteMeal);
        }