private void AddMenuItem()
        {
            Console.Clear();
            Meal newMeal = new Meal();

            //Food Type
            Console.WriteLine("Select a type of meal: \n" +
                              "1) Breakfast \n" +
                              "2) Lunch \n" +
                              "3) Dinner");
            string foodTypeString = Console.ReadLine();

            switch (foodTypeString.ToLower())
            {
            case "1":
            case "breakfast":
                newMeal.Type = FoodType.Breakfast;
                break;

            case "2":
            case "lunch":
                newMeal.Type = FoodType.Lunch;
                break;

            case "3":
            case "dinner":
                newMeal.Type = FoodType.Dinner;
                break;

            default:
                Console.WriteLine("Sorry you entered an invalid response. Your response was not recorded.");
                break;
            }
            //Name
            Console.WriteLine("Enter in the name of the meal: ");
            newMeal.Name = Console.ReadLine();
            //Number
            Console.WriteLine("Enter in the number of the meal: ");
            newMeal.Number = Convert.ToInt32(Console.ReadLine());
            //Description
            Console.WriteLine("Enter in a description of the meal: ");
            newMeal.Description = Console.ReadLine();
            //List of Ingredients
            Console.WriteLine("Enter in the ingredients of the meal(separate ingredients with a comma): ");
            string        ingredients = Console.ReadLine();
            List <string> newMealIng  = ingredients.Split(',').ToList <string>();

            newMeal.Ingredients = newMealIng;
            //Price
            Console.WriteLine("Enter in the cost of the meal: ");
            decimal mealPrice = decimal.Parse(Console.ReadLine(), NumberStyles.AllowCurrencySymbol | NumberStyles.Number);

            newMeal.Price = mealPrice;
            _mealRepo.AddMealsToMenu(newMeal);
            Console.WriteLine("\n Press any key to continue...");
            Console.ReadKey();
        }
Пример #2
0
        public void AddMealToMenu_ShouldReturnCorrectBool()
        {
            //Arrange
            //That was already done in the Test Initialize

            //ACT
            bool addResult = _mealRepo.AddMealsToMenu(_meal);

            //Assert
            Assert.IsTrue(addResult);
        }
Пример #3
0
        public void Arrange()
        {
            List <string> _ingredients = new List <string>();

            _ingredients.Add("chicken");
            _ingredients.Add("noodles");
            _ingredients.Add("veggies");
            _mealRepo = new MealRepository();
            _meal     = new Meal(FoodType.Lunch, "Chicken Soup", 5, "Noodles, chicken, and veggies", _ingredients, 12.99M);
            _mealRepo.AddMealsToMenu(_meal);
        }