Exemplo n.º 1
0
        private void CreateNewMeal()
        {
            Console.Clear();
            MealContent newMeal = new MealContent();

            Console.WriteLine("Please enter the meal number:");
            string mealAsString = Console.ReadLine();

            newMeal.MealNumber = int.Parse(mealAsString);

            Console.WriteLine("Please enter the meal name:");
            newMeal.MealName = Console.ReadLine();

            Console.WriteLine("Please enter the meals description:");
            newMeal.MealDescription = Console.ReadLine();

            Console.WriteLine("What's the meals price?");
            string priceAsString = Console.ReadLine();

            newMeal.Price = double.Parse(priceAsString);

            Console.WriteLine("Which type of meal are you adding?\n" +
                              "1) Breakfast\n" +
                              "2) Lunch\n" +
                              "3) Dinner");

            string todAsString = Console.ReadLine();
            int    todAsInt    = int.Parse(todAsString);

            newMeal.TypeOfMeal = (MealType)todAsInt;

            _mealContentRepo.AddMealToMenuList(newMeal);
        }
Exemplo n.º 2
0
        private void SeedMealList()
        {
            MealContent gyoza = new MealContent(1, "gyoza"
                                                , "pork dumpling thats seared"
                                                , 5.99
                                                , new List <string> {
                "pork", "onions", "cabbage", "sake", "baking powder", "dumpling wrapper"
            });
            MealContent shumai = new MealContent(2, "shumai"
                                                 , "shrimp based dumpling"
                                                 , 5.99
                                                 , new List <string> {
                "shrimp", "onion", "cabbage", "mushroom", "sake", "ginger", "dumpling wrapper"
            });
            MealContent ramen = new MealContent(3, "ramen"
                                                , "pork based noodle soup dish"
                                                , 8.99
                                                , new List <string> {
                "noodles", "pork broth", "wakame", "egg", "green onions", "chashu", "menma", "kamaboko"
            });
            MealContent ramune = new MealContent(4, "ramune"
                                                 , "fruit flavored pop drink"
                                                 , 3.99
                                                 , new List <string> {
                "sugar", "artificial flavor", "carbonation"
            });

            _mealContents.AddToMenu(gyoza);
            _mealContents.AddToMenu(ramune);
            _mealContents.AddToMenu(ramen);
            _mealContents.AddToMenu(shumai);
        }
Exemplo n.º 3
0
        public void Arrange()
        {
            _repo        = new MenuMethodRepo();
            _mealContent = new MealContent(5, "gyoza", "pork based dumpling", 5.99m,
                                           new List <string> {
                "gyoza", "onion"
            });

            _repo.AddToMenu(_mealContent);
        }
        public void SetMealName()
        {
            MealContent content = new MealContent();

            content.MealName = "Cheese Burger";

            string expected = "Cheese Burger";
            string actual   = content.MealName;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void SetMealNumber_ShouldSetCorrectNum()
        {
            MealContent content = new MealContent();                    //Testing propery

            content.MealName = "Large Fiesta Salad Combo";

            string expected = "Large Fiesta Salad Combo";
            string actual   = content.MealName;

            Assert.AreEqual(expected, actual);
        }
        public void SetDescription()
        {
            MealContent content = new MealContent();

            content.Description = "Tasty burger with cheese";

            string expected = "Tasty burger with cheese";
            string actual   = content.Description;

            Assert.AreEqual(expected, actual);
        }
        public void DeleteMeal_True()
        {
            // Arrange
            MealContentRepo repo = new MealContentRepo();
            MealContent     meal = new MealContent(5, "Turkey Breakfast", "Toast, turkey sausage, egg whites, wheat toast, and Milk.", 9, MealType.Breakfast);
            // Act
            bool deleteThisTest = repo.DeleteMeal(meal.MealNumber);

            // Assert
            Assert.IsTrue(deleteThisTest);
        }
        public void GetMenuList_NotBeNull()
        {
            // Arrange
            MealContentRepo mealTestRepo = new MealContentRepo();
            MealContent     mealTestCont = new MealContent();

            // Act
            List <MealContent> listFromTestRepo = mealTestRepo.GetMenuList();

            // Assert
            Assert.IsNotNull(listFromTestRepo);
        }
Exemplo n.º 9
0
        private void AddSomeMeals()
        {
            MealContent bigbkfst     = new MealContent(1, "Big Breakfast", "Pancakes, sausage, eggs, biscuits, and OJ.", 8, MealType.Breakfast);
            MealContent lilbkfst     = new MealContent(2, "Little Breakfast", "Mini pancakes, turkey bacon, toast, and milk.", 5, MealType.Breakfast);
            MealContent burgerMeal   = new MealContent(4, "Cheese Burgers", "Double cheese burger, fries, pie, and Soda.", 11, MealType.Dinner);
            MealContent healthyLunch = new MealContent(3, "Grilled Chicken Salad", "Grilled chicken salad, 1/2 of an avocado sandwich, and green tea.", 9, MealType.Lunch);

            _mealContentRepo.AddMealToMenuList(bigbkfst);
            _mealContentRepo.AddMealToMenuList(lilbkfst);
            _mealContentRepo.AddMealToMenuList(healthyLunch);
            _mealContentRepo.AddMealToMenuList(burgerMeal);
        }
Exemplo n.º 10
0
        public void AddToList_ShouldNotGetNull()
        {
            MealContent content = new MealContent();

            content.MealName = "Gyoza";
            MenuMethodRepo repository = new MenuMethodRepo();

            repository.AddToMenu(content);
            MealContent contentFromDirectory = repository.GetMealByName("Gyoza");

            Assert.IsNotNull(contentFromDirectory);
        }
        public void TestForGetMealByNum2()
        {
            MealContentRepo mealTestRepo = new MealContentRepo();           //Extra test
            MealContent     mealTestCont = new MealContent();

            mealTestRepo.AddMealToMenuList(mealTestCont);

            //Act
            MealContent mealByNum = mealTestRepo.GetMealByMealNumber(mealTestCont.MealNumber);

            bool menuNumsAreEqual = mealTestCont.MealName == mealByNum.MealName;

            Assert.IsTrue(menuNumsAreEqual);
        }
        public void TestForGetMealByNum()
        {
            //Arrange
            MealContentRepo repo = new MealContentRepo();
            MealContent     meal = new MealContent(5, "Turkey Breakfast", "Toast, turkey sausage, egg whites, wheat toast, and Milk.", 9, MealType.Breakfast);

            repo.AddMealToMenuList(meal);

            //Act
            MealContent mealByNum = repo.GetMealByMealNumber(meal.MealNumber);

            //Assert
            Assert.AreEqual(meal, mealByNum);
        }
Exemplo n.º 13
0
        private void CreateNewMeal()
        {
            Console.Clear();

            MealContent   mealContent       = new MealContent();
            List <string> listOfIngredients = new List <string>();

            Console.WriteLine("Please enter a number to associate with the meal:\n" +
                              "example: 4 or 10 ");
            string numAsString = Console.ReadLine();
            int    mealNum     = int.Parse(numAsString);

            mealContent.MealNumber = mealNum;

            Console.WriteLine("Please enter a name for the meal: ");
            mealContent.MealName = Console.ReadLine().ToLower();

            Console.WriteLine("Please enter a description of the meal: ");
            mealContent.Description = Console.ReadLine();

            Console.WriteLine("Please enter a price for the meal:\n" +
                              "example: 12.99");
            string doubleAsString = Console.ReadLine();
            double dubNum         = double.Parse(doubleAsString);

            mealContent.Price = dubNum;

IngredientList:
            Console.WriteLine("Please enter an ingredient: ");
            string ingredients = Console.ReadLine();

            listOfIngredients.Add(ingredients);

            Console.WriteLine("Would you like to add another ingredient? yes or no:");
            string ingreAnswer = Console.ReadLine();

            switch (ingreAnswer)
            {
            case "yes":
                goto IngredientList;

            case "no":
                mealContent.ListOfIngredients.AddRange(listOfIngredients);
                _mealContents.AddToMenu(mealContent);
                break;

            default:
                break;
            }
        }
Exemplo n.º 14
0
        public void UpdateExistingContent_ShouldMatchGivenBool(string originalMeal, bool shouldUpdate)
        {
            //TestInitialize
            MealContent newContent = new MealContent(5, "Gyoza",
                                                     "is a pork based dumpling with vegetable steamed and finished off with a sear",
                                                     5.99m, new List <string> {
                "gyoza", "onion"
            });

            //Act
            bool updateResult = _repo.UpdateExistingMenu(originalMeal, newContent);

            //Assert
            Assert.AreEqual(shouldUpdate, updateResult);
        }
Exemplo n.º 15
0
        private void SeedMethod()
        {
            MealContent gyoza = new MealContent(1, "gyoza", "japanese dumpling with pork and veggies", 5.99m, new List <string> {
                "pork", "green onions", "cornstarch", "sake", "soy sauce", "ginger", "sesame oil"
            });
            MealContent ramen = new MealContent(2, "Shoyu Ramen", "japanese noodle soup with pork base broth", 8.99m, new List <string> {
                "pork brother", "egg", "menma", "green onions", "ramen noodles", "pork"
            });
            MealContent shushi = new MealContent(3, "Rainbow Roll", "raw fish rolled in seedweed paper with steamed rice", 10.99m, new List <string> {
                "salmon", "seedweed paper", "rice", "sesame seeds", "rice vinegar"
            });


            _mealRepo.AddToMenu(gyoza);
            _mealRepo.AddToMenu(ramen);
            _mealRepo.AddToMenu(shushi);
        }
Exemplo n.º 16
0
        public void UpdateToList_ShouldReturnTrue()
        {
            //Arrange


            //TestInitialize
            MealContent newContent = new MealContent(5, "Gyoza",
                                                     "is a pork based dumpling with vegetable steamed and finished off with a sear",
                                                     5.99m, new List <string> {
                "gyoza", "onion"
            });

            //Act
            bool updateResult = _repo.UpdateExistingMenu("gyoza", newContent);

            //Assert
            Assert.IsTrue(updateResult);
        }
Exemplo n.º 17
0
        private void AddMealToMenu()
        {
            Console.Clear();

            MealContent   newMeal           = new MealContent();
            List <string> listOfIngredients = new List <string>();

            Console.WriteLine("Please enter a meal number");
            string numberString = Console.ReadLine();
            int    mealNumber   = int.Parse(numberString);

            newMeal.MealNumber = mealNumber;

            Console.WriteLine("Please enter the name of the meal");
            string mealName = Console.ReadLine();

            newMeal.MealName = mealName;

            Console.WriteLine("Please eneter a description of the meal.");
            string mealScript = Console.ReadLine();

            newMeal.Description = mealScript;

Ingredient:
            Console.WriteLine("Please enter a ingredient.");
            string ingredient = Console.ReadLine();

            listOfIngredients.Add(ingredient);

            Console.WriteLine("Would you like to add another ingredient? yes or no");
            string anotherAnswer = Console.ReadLine();

            if (anotherAnswer == "yes")
            {
                goto Ingredient;
            }

            Console.WriteLine("Please enter the price of the meal");
            decimal mealPrice = Convert.ToDecimal(Console.ReadLine());

            newMeal.Price = mealPrice;

            _mealRepo.AddToMenu(newMeal);
        }
Exemplo n.º 18
0
        private void DisplayMealByName()
        {
            Console.Clear();

            Console.WriteLine("Please enter the name of a meal: ");
            string mealName = Console.ReadLine().ToLower();

            MealContent content = _mealContents.GetMealByName(mealName);

            if (content != null)
            {
                Console.WriteLine($"Name: {content.MealName}\n" +
                                  $"MealNumber: {content.MealNumber}\n" +
                                  $"Description: {content.Description}\n" +
                                  $"Price: {content.Price}\n" +
                                  $"Ingredients: {content.ListOfIngredients}");
            }
            else
            {
                Console.WriteLine("Could not find the meal by that name");
            }
        }
Exemplo n.º 19
0
        private void SeeMealByNumber()
        {
            Console.Clear();
            Console.WriteLine("Which meal number would you like to see?");

            string mealAsString = Console.ReadLine();
            int    mealNumber   = int.Parse(mealAsString);

            MealContent meal = _mealContentRepo.GetMealByMealNumber(mealNumber);

            if (meal != null)
            {
                Console.WriteLine($"Meal Number: {meal.MealNumber}\n" +
                                  $"Menu Type: {meal.TypeOfMeal}\n" +
                                  $"Meal Name: {meal.MealName}\n" +
                                  $"Description: {meal.MealDescription}\n" +
                                  $"Price: {meal.Price}");
            }
            else
            {
                Console.WriteLine("No content by that title.");
            }
        }
        public void AddToMenu_ShouldGetNotNull()
        {
            // Arrange = Setting up the playing field
            MealContentRepo repo = new MealContentRepo();
            MealContent     meal = new MealContent(5, "Turkey Breakfast", "Toast, turkey sausage, egg whites, wheat toast, and Milk.", 9, MealType.Breakfast);

            // Act = Get/run the code we want to test
            repo.AddMealToMenuList(meal);

            // Assert = Use the assert class to verify the expected outcome
            List <MealContent> listOfMeals = repo.GetMenuList();

            bool menuNumEqual = false;

            foreach (MealContent food in listOfMeals)
            {
                if (food.MealNumber == meal.MealNumber)
                {
                    menuNumEqual = true;
                    break;
                }
            }
            Assert.IsTrue(menuNumEqual);
        }
Exemplo n.º 21
0
        private void UpdateExistingMeal()
        {
            Console.Clear();
            List <string> listOfIngredients = new List <string>();

            DisplayAllMeals();

            Console.WriteLine("Please enter the name of a meal to update");
            string oldMeal = Console.ReadLine();

            MealContent mealContent = new MealContent();

            Console.WriteLine("Please enter a number to associate with the meal:\n" +
                              "example: 4 or 10 ");
            string numAsString = Console.ReadLine();
            int    mealNum     = int.Parse(numAsString);

            mealContent.MealNumber = mealNum;

            Console.WriteLine("Please enter a name for the meal: ");
            mealContent.MealName = Console.ReadLine().ToLower();

            Console.WriteLine("Please enter a description of the meal: ");
            mealContent.Description = Console.ReadLine();

            Console.WriteLine("Please enter a price for the meal:\n" +
                              "example: 12.99");
            string doubleAsString = Console.ReadLine();
            double dubNum         = double.Parse(doubleAsString);

            mealContent.Price = dubNum;

Ingredient:
            Console.WriteLine("Please enter an ingredients: ");
            string ingredients = Console.ReadLine();

            listOfIngredients.Add(ingredients);

            Console.WriteLine("Would you like to add another ingredient? yes or no:");
            string ingreAnswer = Console.ReadLine();

            switch (ingreAnswer)
            {
            case "yes":
                goto Ingredient;

            case "no":
                mealContent.ListOfIngredients.AddRange(listOfIngredients);
                _mealContents.AddToMenu(mealContent);
                break;

            default:
                break;
            }

            bool wasUpdated = _mealContents.UpdateExistingMenu(oldMeal, mealContent);

            if (wasUpdated)
            {
                Console.WriteLine("The meal was successfully updated.");
            }
            else
            {
                Console.WriteLine("Could not update the meal");
            }
        }
Exemplo n.º 22
0
        private void UpdateMenuList()
        {
            Console.Clear();

            MealContent   newMeal           = new MealContent();
            List <string> listOfIngredients = new List <string>();

            //Display
            ViewAllMeals();

            //Get input
            Console.WriteLine("Please enter the meal name to be updated");
            string oldMeal = Console.ReadLine();

            //Update
            Console.WriteLine("Please enter a meal number");
            string numberString = Console.ReadLine();
            int    mealNumber   = int.Parse(numberString);

            newMeal.MealNumber = mealNumber;

            Console.WriteLine("Please enter the name of the meal");
            string mealName = Console.ReadLine();

            newMeal.MealName = mealName;


            Console.WriteLine("Please eneter a description of the meal.");
            string mealScript = Console.ReadLine();

            newMeal.Description = mealScript;

Ingredient:
            Console.WriteLine("Please enter a ingredient.");
            string ingredient = Console.ReadLine();

            listOfIngredients.Add(ingredient);

            Console.WriteLine("Would you like to add another ingredient? yes or no");
            string anotherAnswer = Console.ReadLine();

            if (anotherAnswer == "yes")
            {
                goto Ingredient;
            }

            Console.WriteLine("Please enter the price of the meal");
            decimal mealPrice = Convert.ToInt32(Console.ReadLine());

            newMeal.Price = mealPrice;

            bool wasUpdated = _mealRepo.UpdateExistingMenu(oldMeal, newMeal);

            if (wasUpdated)
            {
                Console.WriteLine("Content was succesfully updated");
            }
            else
            {
                Console.WriteLine("Could not update the content");
            }
        }