public void UpdateExistingMeal_ShouldReturnTrue()
        {
            //Arrange
            //TestInitialize
            KomodoMenu newMeal = new KomodoMenu(01, "Tex Mex Eggrolls", "Eggrolls stuffed with spicy chicken mix. Served with Avocado Cream and Pico de Gallo", "Spicy Chicken, corn, black beans, peppers, onions and melted cheese.", 12.49, FoodType.Appetizer);

            //Act
            bool updateResult = _repo.UpdateExistingMeal(01, newMeal);

            //Assert
            Assert.IsTrue(updateResult);
        }
Пример #2
0
        //Update existing meal
        private void UpdateExistingMeal()
        {
            //Display all meals
            DisplayAllMeals();

            //Ask for the Meal Number of meal to update
            Console.WriteLine("\nEnter the 'Meal Number' of the meal you would like to update:");

            //Get that meal
            int oldMealNumber = int.Parse(Console.ReadLine());

            //build a new object
            KomodoMenu newMeal = new KomodoMenu();

            //Meal Number
            Console.WriteLine("Enter the updated meal number for the meal:");
            newMeal.MealNumber = int.Parse(Console.ReadLine());

            //Meal Name
            Console.WriteLine("Enter the updated name for the meal:");
            newMeal.MealName = Console.ReadLine();

            //Meal Description
            Console.WriteLine("Enter the updated description for the meal:");
            newMeal.MealDescription = Console.ReadLine();

            //List of Ingredients
            Console.WriteLine("Enter the updated list of ingredients for the meal:");
            newMeal.ListOfIngredients = Console.ReadLine();

            //Meal Price
            Console.WriteLine("Enter the updated price for the meal (9.99, 16.99, 19.99)");
            newMeal.MealPrice = double.Parse(Console.ReadLine());

            //Meal type
            Console.WriteLine("Enter the Meal Type number:\n" +
                              "1. Appetizer\n" +
                              "2. Salad\n" +
                              "3. Entree\n" +
                              "4. Dessert");

            int foodAsInt = int.Parse(Console.ReadLine());

            newMeal.TypeOfFood = (FoodType)foodAsInt;

            //verify the update worked
            bool wasUpdated = _mealRepo.UpdateExistingMeal(oldMealNumber, newMeal);

            if (wasUpdated)
            {
                Console.WriteLine("Meal was successfully updated!");
            }
            else
            {
                Console.WriteLine("Meal was not able to be updated...");
            }
        }