コード例 #1
0
        public void Arrange()
        {
            _repo = new MenuRepo();

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

            listOfIngredients.Add("flour bun");
            listOfIngredients.Add("hamburger");
            listOfIngredients.Add("pickle");
            listOfIngredients.Add("onion");
            listOfIngredients.Add("cheese");

            _item = new Menu(3, "Cheeseburger", "Quarter pound beef cheeseburger.", listOfIngredients, 4.5);
            _repo.AddMenuItemToList(_item);

            List <string> listOfIngredients2 = new List <string>();

            listOfIngredients.Add("cheese");
            listOfIngredients.Add("flour");
            listOfIngredients.Add("garlic butter");
            listOfIngredients.Add("marinara sauce");

            Menu pizza = new Menu(1, "Pizza", "10 inch thin crust cheese pizza", listOfIngredients2, 5.75);

            _repo.AddMenuItemToList(pizza);

            // Test Add Method
        }
コード例 #2
0
        private void SeedContentList()
        {
            Menu hamburger   = new Menu("hamburger", "Regular Hamburger nothing special about it.", 1, IngredientList.Beef, 5.99);
            Menu sandwhich   = new Menu("Sandwhich", "Sandwhich on Rye.", 2, IngredientList.Chicken, 7.99);
            Menu wrap        = new Menu("Wrap", "Flour tortilla used to wrap your choice of protein", 3, IngredientList.Fish, 9.99);
            Menu dinnerPlate = new Menu("Dinner Plate", "Your choice of protein with mashed potatoes and a salad", 4, IngredientList.Steak, 14.99);

            _menuItems.AddMenuItemToList(hamburger);
            _menuItems.AddMenuItemToList(sandwhich);
            _menuItems.AddMenuItemToList(wrap);
            _menuItems.AddMenuItemToList(dinnerPlate);
        }
コード例 #3
0
        private void CreateNewMenuItem()
        {
            Console.Clear();
            Menu newMenuItem = new Menu();

            Console.WriteLine("Enter the order number for the meal:");

            string orderNumberAsString = Console.ReadLine();
            int    orderNumberAsInt    = int.Parse(orderNumberAsString);

            newMenuItem.OrderNumber = orderNumberAsInt;

            //create the name...
            Console.WriteLine("Enter the name of the meal:");
            var userInputMealName = Console.ReadLine();

            newMenuItem.MealName = userInputMealName;

            string userinput;
            bool   ison = true;

            while (ison)
            {
                Console.WriteLine("Would you like do add an ingredient  Y/N ");//create if in loop
                userinput = Console.ReadLine();
                if (userinput.ToLower() == "y")
                {
                    Console.WriteLine("Enter an  ingredient:");

                    userinput = Console.ReadLine();
                    newMenuItem.ListOfIngredients.Add(userinput);
                }
                else if (userinput.ToLower() == "n")
                {
                    ison = false;
                }
            }

            Console.WriteLine("Enter the description of the menu item:");
            newMenuItem.Description = Console.ReadLine();

            Console.WriteLine("Enter the price of the item:");

            string  priceAsString  = Console.ReadLine();
            decimal priceAsDecimal = int.Parse(priceAsString);

            newMenuItem.Price = priceAsDecimal;

            _menurepo.AddMenuItemToList(newMenuItem);
        }
コード例 #4
0
        public void Arrange()
        {
            _menurepo = new MenuRepo();
            _item     = new Menu(1, new List <string> {
                "Hamburger", "Cheese", "Bun", "Pickle", "Mustard", "Ketchup"
            },
                                 "Single Cheese burgar, Fries and a soft drink.", 5.32m, "Singal cheese burger meal");

            _menurepo.AddMenuItemToList(_item);
        }
コード例 #5
0
        // Create new menu item
        private void CreateNewMenuItem()
        {
            Console.Clear();
            Menu newItem = new Menu();

            // Meal Number
            Console.WriteLine("Enter the meal number for the new item:");
            string mealNumberAsString = Console.ReadLine();

            newItem.MealNumber = int.Parse(mealNumberAsString);
            // Meal Name
            Console.WriteLine("Enter the meal name for the new item:");
            newItem.MealName = Console.ReadLine();
            // Meal Description
            Console.WriteLine("Enter the meal description for the new item:");
            newItem.MealDescription = Console.ReadLine();
            // List of Ingredients
            Console.WriteLine("Enter ingredient for the new item:");
            newItem.ListOfIngredients.Add(Console.ReadLine());
            Console.WriteLine("Add another ingredient for the new item? (y/n)");
            string addAnotherIngredient = Console.ReadLine().ToLower();

            while (addAnotherIngredient != "n")
            {
                // Prompt user to enter another ingredient
                Console.WriteLine("Enter another ingredient for the new item:");
                // Add ingredient to list of ingredients for menu item
                newItem.ListOfIngredients.Add(Console.ReadLine());
                // Ask the user if they want to add another ingredient to the menu item
                Console.WriteLine("Add another ingredient for the new item? (y/n)");
                // Capture the user's answer
                addAnotherIngredient = Console.ReadLine().ToLower();
                // If addIngredient = no, then exit loop
            }
            // Meal Price
            Console.WriteLine("Enter the price of for the new item:");
            string mealPriceAsString = Console.ReadLine();

            newItem.MealPrice = double.Parse(mealNumberAsString);

            _menuRepo.AddMenuItemToList(newItem);
        }
コード例 #6
0
        public void AddToLIst_ShouldGetNotNull()
        {
            // Arrange
            Menu item = new Menu();

            item.MealName = "Hamburger";
            MenuRepo repo = new MenuRepo();

            // Act
            repo.AddMenuItemToList(item);
            Menu itemFromList = repo.GetMenuItemByName("Hamburger");

            // Assert
            Assert.IsNotNull(itemFromList);
        }
コード例 #7
0
        public void AddToList()
        {
            // Arrange
            Menu menu = new Menu();

            menu.MealName = "Burger";
            MenuRepo repo = new MenuRepo();

            // Act or run code we want to test
            repo.AddMenuItemToList(menu);
            Menu menuFromDirectory = repo.GetMenuItemByName("Burger");


            // Assert to verify expected outcome
            Assert.IsNotNull(menuFromDirectory);
        }
コード例 #8
0
        public void Addtolist_shouldnotnull()
        {
            List <Menu> listOfItem = new List <Menu>(); //Create new instance of menu list
            int         listcount  = listOfItem.Count;  //counts number of items in menu list


            Menu menuItem = new Menu();

            MenuRepo repo = new MenuRepo();

            repo.AddMenuItemToList(menuItem);

            List <Menu> repoList = repo.GetMenuList();

            Assert.AreEqual(listcount + 1, repoList.Count);
        }
コード例 #9
0
 public void Arrange()
 {
     _repo = new MenuRepo();
     _menu = new Menu("burger", "Basic beef hamburger", 1, IngredientList.Beef, 2.99);
     _repo.AddMenuItemToList(_menu);
 }