Beispiel #1
0
        private void CreateNewMeal()
        {
            Console.Clear();
            Menu menu = new Menu();

            Console.WriteLine("\n\nWelcome to the Cafe Menu Page\n" +
                              "\nPlease enter Meal Number:");
            menu.MealNumber = int.Parse(Console.ReadLine());
            Console.WriteLine("Please enter a name for the meal:");
            menu.MealName = Console.ReadLine();
            Console.WriteLine("Please enter a description:");
            menu.Description = Console.ReadLine();
            Console.WriteLine("Please enter the ingredients:");
            menu.Ingredients = Console.ReadLine();
            Console.WriteLine("Please enter the meal price");
            menu.Price = decimal.Parse(Console.ReadLine());
            _cafeRepository.AddMealToDirectory(menu);
        }
        //Testing the Create method
        public void AddMealToDir_ShouldGetCorrectBoolean()
        {
            //Arrange, Act, Assert
            //Arrange -> Overall Setup
            Menu           menu       = new Menu();
            CafeRepository repository = new CafeRepository();
            //Act -> Get/Run the code to test
            bool addResult = repository.AddMealToDirectory(menu);

            //Assert -> Get expected outcome of the test
            Assert.IsTrue(addResult);
        }
 public void Arrange()
 {
     _repo = new CafeRepository();
     _meal = new Menu(1, "Hamburger\n", "Fresh never frozen beef on a sesame seed bun with fries\n",
                      "Sesame Seed Bun\n " +
                      "Beef Patty\n" +
                      "Lettuce\n" +
                      "Tomato\n" +
                      "Onions" +
                      "Ketchup\n",
                      5.00m);
     _repo.AddMealToDirectory(_meal);
 }
        //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);
        }