예제 #1
0
        private void AddNewMeal()
        {
            Console.Clear();
            //Build a new object
            Menu newMeal = new Menu();

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

            //ID Number
            Console.WriteLine("Enter the unique ID number for the Meal:");
            newMeal.MealIDNumber = Console.ReadLine();

            //Description
            Console.WriteLine("Describe the meal.");
            newMeal.MealIDNumber = Console.ReadLine();

            //List of Ingredients
            Console.WriteLine("Add the ingredients for the meal separated by commas.");
            newMeal.MealIDNumber = Console.ReadLine();

            //Price
            Console.WriteLine("What is the price of the meal?");
            string mealPrice       = Console.ReadLine();
            double mealPriceDouble = Convert.ToDouble(mealPrice);

            newMeal.MealPrice = mealPriceDouble;

            _MenuRepo.AddMealToList(newMeal);
        }
        public void Arrange()
        {
            _mealDirectory = new MenuRepo();
            _menu          = new Menu("The Spag Bol", "1", "A classic spaghetti with red sauce.", "1 Spaghetti, 1 Bologniase", 12.99);

            _mealDirectory.AddMealToList(_menu);
        }
        public void AddToMenu_ShouldGetNotNull()
        {
            //Arrange --> Setting up the Playing Field
            Menu     meal = new Menu("The Spag Bol", "1", "A classic spaghetti with red sauce.", "1 Spaghetti, 1 Bologniase", 12.99);
            MenuRepo repo = new MenuRepo();


            //Act --> Get/run the code we want to test
            repo.AddMealToList(meal);
            Menu mealFromDirectory = repo.GetMealByID("1");

            //Assert --> Use the assert class to verify the expected outcome.
            Assert.IsNotNull(mealFromDirectory);
        }
예제 #4
0
        public void AddToList_ShouldGetNotNull()
        {
            List <string> ingredList2 = new List <string>
            {
                "potatoes",
                "cheese",
                "bacon",
                "jalapenos"
            };
            Menu     meal       = new Menu(2, "Cheese Fries", "Crispy seasoned French fries topped with mixed cheeses, bacon, and fried jalapeños with ranch", ingredList2, 6.99);
            MenuRepo repository = new MenuRepo();

            repository.AddMealToList(meal);
            Menu mealAddToList = repository.GetMealByName("Cheese Fries");

            Assert.IsNotNull(mealAddToList);
        }
예제 #5
0
        //Create a new meal
        private void AddMeal()
        {
            List <Menu>   listOfMeals = _menuRepo.ReadMealList();
            List <string> ingredList  = new List <string>();
            int           newNum      = listOfMeals.Count + 1;

            for (int j = 0; j < listOfMeals.Count; j++)
            {
                Menu numCheck = _menuRepo.GetMealByNumber(j + 1);
                if (numCheck == null)
                {
                    newNum = j + 1;
                }
            }
            Console.WriteLine("Enter the name of the new meal.");
            string newName = Console.ReadLine();

            Console.WriteLine("Please enter a description for the new meal.");
            string newDescription = Console.ReadLine();

            Console.WriteLine("Please enter the price of the new meal.");
            double newPrice = double.Parse(Console.ReadLine());
            bool   added    = false;

            while (!added)
            {
                Console.WriteLine("\nEnter the ingredients for this meal.\n" +
                                  "Press return / enter between each ingredient\n" +
                                  "Enter 'Done' when complete\n");
                string addIngred = Console.ReadLine().ToLower();
                while (addIngred != "done")
                {
                    ingredList.Add(addIngred);
                    addIngred = Console.ReadLine().ToLower();
                }
                added = true;
            }
            Menu newMeal = new Menu(newNum, newName, newDescription, ingredList, newPrice);

            _menuRepo.AddMealToList(newMeal);
        }
예제 #6
0
 public void Arrange()
 {
     _repo = new MenuRepo();
     _menu = new Menu(1, "Wings", "Traditional hand-breaded wings tossed in your choice of Buffalo or Spicy Buffalo sauce with celery sticks and ranch or blue cheese for dipping", ingredList1, 10.99);
     _repo.AddMealToList(_menu);
 }