Beispiel #1
0
        private void ViewAllMeals()
        {
            Console.Clear();
            List <Menu> listOfMeals = _cafeRepository.ViewFullMenu();

            foreach (Menu meal in listOfMeals)
            {
                Console.WriteLine($"Meal Number: {meal.MealNumber}\n" +
                                  $"Meal Name: {meal.MealName}\n" +
                                  $"Description: {meal.Description}\n" +
                                  $"Ingredients: {meal.Ingredients}\n" +
                                  $"Price: {meal.Price}\n");
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
        //testing the read method
        public void GetMeal_ShouldReturnCorrectCollection()
        {
            //arrange
            //creating the menu
            Menu menu = new Menu();
            //creating the repo
            CafeRepository repository = new CafeRepository();

            //adding to the repo(menu)
            repository.AddMealToDirectory(menu);
            //act
            //store list of meals w/n a variable
            List <Menu> menuList = repository.ViewFullMenu();
            //looks through our entire list and returns true if there is content
            bool directoryHasMeals = menuList.Contains(menu);

            //assert
            Assert.IsTrue(directoryHasMeals);
        }