public void GetByName_ShouldReturnCorrectName()
        {
            //Arrange
            MenuContent        content   = new MenuContent(1, "Pasta", "Italian", "Flour, Eggs, Salt, Water", 5);
            List <MenuContent> menuItems = _repo.GetMenu();

            menuItems.Add(content);

            //Act

            MenuContent actual   = _repo.GetMenuByName("Pasta");
            MenuContent expected = content;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void DeleteItem_ShouldReturnTrue()
        {
            //Arrange
            MenuContent        newContent = new MenuContent(2, "Hamburger", "American", "Flour, Eggs, Salt, Water", 9);
            List <MenuContent> newList    = _repo.GetMenu();

            newList.Add(newContent);

            //Act

            _repo.RemoveItemFromList(newContent);
            bool isRemoved = newList.Contains(newContent);

            //Act

            Assert.IsFalse(isRemoved);
        }
Ejemplo n.º 3
0
        private void SeedItemList()
        {
            MenuContent breakfastSandwich = new MenuContent(1, "Morning Sandwich", "Grilled Cheese Sandwich with Ham and Egs", 10.99m, "Cheese, Bread, Ham and egs");
            MenuContent scrambledEgs      = new MenuContent(2, "Breakfast Eggs", "Scrambled Eggs with fresh cucumbers,wheat bread and sausages", 7m, "Egs, sausages, vegetables, bread");
            MenuContent burrito           = new MenuContent(3, "Morning Burito", "Scrambled Eggs in a buritto wrapp,added chease, chicken nuggets and hashbrown", 12.50m, "Egs, wrap, cheese, chicken nuggets and potato hasbrown");

            _repoContent.AddItemToList(breakfastSandwich);
            _repoContent.AddItemToList(scrambledEgs);
            _repoContent.AddItemToList(burrito);

            MenuContent breakfastSandwichIng = new MenuContent("Morning Sandwich -> Tasty provalone cheese, brown baked bread, sweet ham  and fresh egs -> 749 Calories");
            MenuContent scrambledEgsIng      = new MenuContent("Breakfast Eggs -> Cage free egs, jucy pork sausages, whole wheat bread and fresh vegetables -> 600 Calories ");
            MenuContent burritoIng           = new MenuContent("Morning Burito -> Cage free egs, flour burrito wrap, tasty provolane cheese, frozen chicken nuggets and potato hasbrown -> 923 Calories");

            _repoContent.AddIngredientsList(burritoIng);
            _repoContent.AddIngredientsList(scrambledEgsIng);
            _repoContent.AddIngredientsList(burritoIng);
        }
        public void Arrange()
        {
            _menuRepo = new MenuContentRepository();
            _content  = _menuRepo.GetMenuContent();

            MenuContent content      = new MenuContent(1, "Tuna Salad Sandwich", "Tuna salad on Wheat Bread with a side", "Wheat bread and tuna salad", 7.50m);
            MenuContent contentTwo   = new MenuContent(2, "Hamburger and fries Combo", "Beef burger on bun with fries", "All beef patty and bun", 9.0m);
            MenuContent contentThree = new MenuContent(3, "Spinach salad with dressing choice", "Spinach salad with choice of dressing", "spinach and veggies", 10.0m);
            MenuContent contentFour  = new MenuContent(4, "Soup of the Day combo", "Daily soup with choice of side", "Broth with veeggies", 6.50m);
            MenuContent contentFive  = new MenuContent(5, "Slice of Pizza combo", "Daily slice of pizza with choice of side", "Cheese with toppings and crust", 7.50m);


            _menuRepo.AddContentToMenu(content);
            _menuRepo.AddContentToMenu(contentTwo);
            _menuRepo.AddContentToMenu(contentThree);
            _menuRepo.AddContentToMenu(contentFour);
            _menuRepo.AddContentToMenu(contentFive);
        }
Ejemplo n.º 5
0
        private void CreateNewMenuItem()
        {
            Console.Clear();
            MenuContent newMenuItem = new MenuContent();

            Console.WriteLine("Enter the menu number:");
            newMenuItem.MealNumber = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter meal name:");
            newMenuItem.MealName = Console.ReadLine();
            Console.WriteLine("Enter meal description:");
            newMenuItem.Description = Console.ReadLine();
            Console.WriteLine("Enter all meal ingredients (separated by commas):");
            newMenuItem.Ingredients = Console.ReadLine();
            Console.WriteLine("Enter price (do not enter $, just numbers):");
            newMenuItem.Price = Convert.ToDecimal(Console.ReadLine());

            _menuRepo.AddContentToMenu(newMenuItem);
        }
Ejemplo n.º 6
0
        private void DeleteContentByTitle()
        {
            ShowAllContent();
            Console.WriteLine("Enter the menu name for the content you would like to delete.");
            string titleToDelete = Console.ReadLine();

            MenuContent contentToDelete = _repo.GetContentByTitle(titleToDelete);
            bool        wasDeleted      = _repo.DeleteExistingContent(contentToDelete);

            if (wasDeleted)
            {
                Console.WriteLine("This content was successfully deleted.");
            }
            else
            {
                Console.WriteLine("Content could not be deleted");
            }
        }
Ejemplo n.º 7
0
        private void ShowContentByTitle()
        {
            Console.Clear();

            Console.WriteLine("Enter the title of the content you'd like to see.");
            string title = Console.ReadLine();

            MenuContent content = _repo.GetContentByTitle(title);

            if (content != null)
            {
                DisplayContent(content);
            }
            else
            {
                Console.WriteLine("That title doesn't exist.");
            }
            Console.ReadKey();
        }
Ejemplo n.º 8
0
        public async Task <int> AddMenu(MenuInput input)
        {
            int  id;
            Menu menu;

            if (input.Id == 0)
            {
                menu = new Menu()
                {
                    MenuName = input.Name.Sluggify(),
                    IsActive = input.IsActive,
                    Id       = input.Id,
                    Order    = _menuRepository.Count() + 1
                };
                id = await _menuManager.AddMenuAsync(menu);
            }
            else
            {
                menu          = _menuRepository.Get(input.Id);
                menu.IsActive = input.IsActive;
                menu.MenuName = input.Name.Sluggify();
                id            = await _menuManager.AddMenuAsync(menu);
            }

            foreach (var inputAvailableLang in input.AvailableLangs)
            {
                if (string.IsNullOrEmpty(inputAvailableLang.DisplayText))
                {
                    continue;
                }
                if (inputAvailableLang.Id == 0)
                {
                    await _menuManager.AddMenuContentAsync(MenuContent.CreateMenuContent(inputAvailableLang.Lang, inputAvailableLang.DisplayText, "", menu));
                }
                else
                {
                    var langContent = _menuContentRepository.Get(inputAvailableLang.Id);
                    langContent.Text = inputAvailableLang.DisplayText;
                    await _menuManager.AddMenuContentAsync(langContent);
                }
            }
            return(id);
        }
Ejemplo n.º 9
0
        public void AddNewMenuItems()
        {
            Console.Clear();
            MenuContent newItem = new MenuContent();

            Console.WriteLine("Enter new meal reference number:");
            newItem.MealNumber = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter new meal item name :");
            newItem.MealName = Console.ReadLine();
            Console.WriteLine("Enter new description for item:");
            newItem.Description = Console.ReadLine();
            Console.WriteLine("Enter new ingredients for item:");
            newItem.Ingredients = Console.ReadLine();
            Console.WriteLine("Enter new price for item:");
            newItem.Price = decimal.Parse(Console.ReadLine());

            _repoContent.AddItemToList(newItem);
            _repoContent.AddIngredientsList(newItem);
        }
Ejemplo n.º 10
0
        private void CreateNewContent()
        {
            Console.Clear();

            MenuContent newContent = new MenuContent();

            Console.WriteLine("Please enter the new item's name.");
            newContent.MealName = Console.ReadLine();

            Console.WriteLine("Please enter a description.");
            newContent.Description = Console.ReadLine();

            Console.WriteLine("Please enter a Meal Number (1 - 20) for this content.");
            string mealNumberAsString = Console.ReadLine();
            double mealNumberAsDouble = double.Parse(mealNumberAsString);

            newContent.MealNumber = mealNumberAsDouble;


            Console.WriteLine("Please enter a price for the new menu item.");
            string priceInput = Console.ReadLine();
            int    priceAsInt = int.Parse(priceInput);

            newContent.Price = priceAsInt;


            Console.WriteLine("Please enter the list of ingredients seperated by commas.");
            newContent.Ingredients = Console.ReadLine();



            bool wasAdded = _repo.AddContentToDirectory(newContent);

            if (wasAdded == true)
            {
                Console.WriteLine("Your content was succesfully added.");
            }
            else
            {
                Console.WriteLine("Oops something went wrong. Your content was not added.");
            }
        }
        private void AddContentToDirectory()
        {
            MenuContent contents = new MenuContent();

            Console.WriteLine("Hello there, please enter a meal name.");
            contents.MealName = Console.ReadLine();

            Console.WriteLine("What is the meal number?");
            contents.MealNumber = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter a Description");
            contents.Description = Console.ReadLine();

            Console.WriteLine("What is the Price?");
            contents.Price = Convert.ToInt32(Console.ReadLine());

            _Repo.AddContentToDirectory(contents);
            Console.WriteLine("Your content has been added! Press any key to return to the main menu");
            Console.ReadKey();
        }
Ejemplo n.º 12
0
        private void DisplayMenuItemByNumber()
        {
            Console.Clear();
            Console.WriteLine("Enter menu number:");
            int menuNumber = Convert.ToInt32(Console.ReadLine());

            MenuContent content = _menuRepo.GetContentByMenuNumber(menuNumber);

            if (content != null)
            {
                Console.WriteLine($"Menu number: {content.MealNumber}\n" +
                                  $"Meal name: {content.MealName}\n" +
                                  $"Meal description: {content.Description}\n" +
                                  $"Meal ingredients: {content.Ingredients}\n" +
                                  $"Meal price: {content.Price}");
            }
            else
            {
                Console.WriteLine("No item by that number");
            }
        }
Ejemplo n.º 13
0
        // Create new MenuContent
        private void CreatNewContent()
        {
            Console.Clear();

            //MealName
            MenuContent newContent = new MenuContent();

            Console.WriteLine("Enter the MealName");
            newContent.MealName = Console.ReadLine();
            //Description
            Console.WriteLine("Enter the description from the content:");
            newContent.DescriptionType = Console.ReadLine();
            //Ingredident list
            Console.WriteLine("Enter the ingredients  for the content (Burgers, Salads, Fries, Desserts, Coffee etc):");
            newContent.Ingredientlist = Console.ReadLine();
            //MealPrice
            Console.WriteLine("Enter the the Meal price for the content(10, 7, 3, 5, 2 etc):");
            string mealpriceAsString = Console.ReadLine();

            //Mealtype
            Console.WriteLine("Would you like to enter the order content of your meal you would like?(y/n)");
            string TypeOfMealString = Console.ReadLine().ToLower();


            if (TypeOfMealString == "y")
            {
                Console.WriteLine("Enter the meal you would like:\n" +
                                  "1.Burgers" +
                                  "2.Salad" +
                                  "3.Fries" +
                                  "4.Deserts" +
                                  "5.Coffee");

                string TypeofMealAsString = Console.ReadLine();
                int    TypeofMealAsInt    = int.Parse(TypeofMealAsString);
                newContent.TypeOfmeal = (MealType)TypeofMealAsInt;

                _contentRepo.AddContentToList(newContent);
            }
        }
Ejemplo n.º 14
0
        public void GetRepository_ShouldReturnCorrectRepo()
        {
            //arrange
            MenuContent _newObject  = new MenuContent();
            MenuRepo    repo        = new MenuRepo();
            MenuContent _dishObject = new MenuContent("#1", "Sesame Chicken", "Chicken in sesame sauce with vegetables.", "chicken, sesame sauce, broccoli, carrots, water chestnuts", 8.95);

            repo.AddContentToRepo(_dishObject);
            MenuContent _dishObject2 = new MenuContent("#2", "Beef Lo Mein", "Beef and noodles with vegetables.", "beef, lo mein sauce, broccoli, carrots, water chestnuts", 9.95);

            repo.AddContentToRepo(_dishObject2);

            repo.AddContentToRepo(_newObject);

            //act
            List <MenuContent> listOfDishes = repo.GetContents();

            //assert
            bool repoHasContent = listOfDishes.Contains(_newObject);

            Assert.IsTrue(repoHasContent);
        }
        private void CreateNewContent()
        {
            Console.WriteLine("Your current menu items:");
            ShowAllContent();
            MenuContent content = new MenuContent();

            Console.WriteLine("Please enter the number of the menu item:");
            // may have to get the array number and put in a string?
            string menuNumber = Console.ReadLine();

            content.MenuNumber = menuNumber;
            Console.WriteLine("Please enter the name of the menu item:");
            content.MenuName = Console.ReadLine();
            Console.WriteLine($"Please enter the description of the menu item number {content.MenuNumber}:");
            content.MenuDescription = Console.ReadLine();
            Console.WriteLine($"Please enter the list of ingredients for iten {content.MenuNumber}:");
            content.MenuListOfIngredients = Console.ReadLine();
            Console.WriteLine($"Please enter the menu item price for item {content.MenuNumber}:");
            content.MenuPrice = Console.ReadLine();
            //pass to add method
            _menuRepo.AddContentToDirectory(content);
        }
Ejemplo n.º 16
0
        public void RemoveItemFromListTest()
        {
            // Arrange
            SeedItemList();
            int realMealNum = 1;

            //Act
            MenuContent item = _testRepo.GetItemsByNumber(realMealNum);

            if (item == null)
            {
                Assert.Fail("Number does not exist in repository");
            }
            else
            {
                _testRepo.RemoveItemFromList(realMealNum);
            }

            item = _testRepo.GetItemsByNumber(realMealNum);

            // Assert
            Assert.IsNull(item);
        }
Ejemplo n.º 17
0
        private void CreateMenu()       //Change color to green and create content
        {
            MenuContent content = new MenuContent();

            Console.ForegroundColor = ConsoleColor.Green;
            // public Menu(int mealNumber, string title, string description, double price)   //just listing the data needed to sent in
            Console.WriteLine("ENTER THE MENU NUMBER. \n");                //ASK FOR (Meal Number)
            content.MealNumber = Int32.Parse(Console.ReadLine());

            Console.WriteLine("ENTER THE MEAL NAME \n");                  //ASK FOR (Meal Name)
            content.MealName = Console.ReadLine();

            Console.WriteLine($"ENTER THE DESCRIPTION FOR {content.MealName}. \n");  //ASK FOR (Description)
            content.Description = Console.ReadLine();

            Console.WriteLine($"ENTER THE PRICE {content.MealName} WITHOUT A $ SIGN. \n"); //ASK FOR (Price)
            content.Price = double.Parse(Console.ReadLine());

            Console.WriteLine($"ENTER THE LIST OF INGREDIENTS {content.MealName} AND PRESS ENTER. \n"); //ASK FOR (Price)
            content.ListOfIngredients = Console.ReadLine();

            _menuRepository.AddContentToDirectory(content);
        }
        //delete from menu
        private void DeleteContent()
        {
            //Ask the user which one they want to remove
            Console.WriteLine("Which item would you like to remove?");
            //need a list of the items
            List <MenuContent> contentList = _menuRepo.GetContents();
            int count = 0;

            foreach (var content in contentList)
            {
                count++;
                Console.WriteLine($"{count}) {content.Name}");
            }
            //take in user response
            int targetContentID = int.Parse(Console.ReadLine());
            int correctIndex    = targetContentID - 1;

            if (correctIndex >= 0 && correctIndex < contentList.Count)
            {
                MenuContent SelectedContent = contentList[correctIndex];
                //Remove that item
                if (_menuRepo.DeleteExistingContent(SelectedContent))
                {
                    Console.WriteLine($"Item deleted.");
                }
                else
                {
                    Console.WriteLine("Delete failed.");
                }
            }
            else
            {
                Console.WriteLine("Invalid");
            }
            Console.WriteLine("Press any key to continue....");
            Console.ReadKey();
        }
Ejemplo n.º 19
0
        private void DeleteMenuItems()
        {
            Console.WriteLine("Which menu item would you like to remove?");
            //DISPLAY LIST OF THE ITEMS AVAILABLE
            List <MenuContent> contentList = _menuRepository.GetContents();

            int count = 0;

            foreach (var content in contentList)
            {
                count++;
                Console.WriteLine($"{count}:: {content.MealName}");
            }

            int targetMenuID = int.Parse(Console.ReadLine());
            int correctIndex = targetMenuID - 1;                       //subtract 1 here because it starts at 0 in memory

            if (correctIndex >= 0 && correctIndex < contentList.Count) //Remove Item
            {
                MenuContent desiredContent = contentList[correctIndex];
                if (_menuRepository.DeleteMenuItems(desiredContent))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"{desiredContent.MealName} has been removed from the database.");
                }
                else
                {
                    Console.WriteLine("Current task request can not be completed");
                }
            }
            else
            {
                Console.WriteLine("INVALID OPTION");
            }
            Console.WriteLine("Press any key to continue.........");
            Console.ReadKey();
        }
Ejemplo n.º 20
0
        private void CreateNewMenuItem()
        {
            Console.Clear();
            MenuContent newItem = new MenuContent();

            //Meal Name
            Console.WriteLine("Enter the name of the new menu item");
            newItem.MealName = Console.ReadLine();
            Console.Clear();

            //Meal Number
            Console.WriteLine("Enter the meal number of the new menu item");
            string itemNumber = Console.ReadLine();

            newItem.MealNumber = int.Parse(itemNumber);
            Console.Clear();

            //Description
            Console.WriteLine("Enter the description of the menu item");
            newItem.Description = Console.ReadLine();
            Console.Clear();

            //List of Ingredients
            Console.WriteLine("Please list all of the ingredients of the new menu item");
            newItem.ListOfIngredients = Console.ReadLine();
            Console.Clear();

            //Price
            Console.WriteLine("What is the price of the item?");
            Console.Write("$");
            string itemPrice = Console.ReadLine();

            newItem.Price = decimal.Parse(itemPrice);
            Console.Clear();

            _itemRepo.AddItemsToList(newItem);
        }
        private void OnResult(int count)
        {
            MenuContent[] contents = null;

            if (count > 0)
            {
                contents = new MenuContent[count];
                for (int i = 0; i < count; i++)
                {
                    Location location  = LocationDatabase.GetLocationFromSearch(i);
                    Sprite   thumbnail = null;

                    if (location is Place)
                    {
                        Place building = location as Place;
                        thumbnail = building.thumbnail;
                    }

                    contents[i] = new MenuContent(thumbnail, location.displayedName);
                }
            }

            SetContents(contents);
        }
Ejemplo n.º 22
0
        //View existing Content by MealName
        private void DisplayContentbyMealName()
        {
            Console.Clear();
            //Prompt the user to give me a mealname
            Console.WriteLine("Enter the MealName of the content you would like to see");
            // Get the Users Input
            string MealName = Console.ReadLine();
            //find content by that MealName
            MenuContent content = _contentRepo.GetContentByMealName(MealName);

            //Display said content if not null
            if (content != null)
            {
                Console.WriteLine($"MealName: {content.MealName}\n" +
                                  $"Discription: {content.DescriptionType}\n" +
                                  $"IngredientList: {content.Ingredientlist}\n" +
                                  $"MealPrice: {content.MealPrice}\n" +
                                  $"TypeOfMeal: {content.TypeOfmeal}");
            }
            else
            {
                Console.WriteLine("No content by that MealName");
            }
        }
Ejemplo n.º 23
0
        public void AddItemToMenu()
        {
            Console.Clear();
            MenuContent newContent = new MenuContent();

            Console.WriteLine("What number would you like to assign to this Meal?");
            newContent.MealNumber = int.Parse(Console.ReadLine());

            Console.WriteLine("\nWhat is the name for this Meal?");
            newContent.Name = Console.ReadLine();

            Console.WriteLine("\nAdvise the description of the Meal?");
            newContent.Description = Console.ReadLine();

            Console.WriteLine("\nAdvise the ingredients for this Meal?");
            newContent.Ingredients = Console.ReadLine();

            Console.WriteLine("\nWhat will be the price for this Meal-Enter your $ Amount?");
            newContent.Price = int.Parse(Console.ReadLine());

            Console.WriteLine($"{newContent} will be added to the Menu. Press any key to continue...");
            _menuRepository.AddItemToMenu(newContent);
            Console.ReadLine();
        }
Ejemplo n.º 24
0
 public void AddMenu(MenuContent menu)
 {
     menuStack.Add(menu);
 }
 public void Arrange()
 {
     _repo    = new KCafe_Repo();
     _content = new MenuContent( );
     _repo.AddContentToDirectory(_content);
 }
Ejemplo n.º 26
0
        public void GetbyNumber_ShouldReturnCorrectContent()
        {
            MenuContent searchResult = _repo.GetContentItemByMenuNumber("1");

            Assert.AreEqual(_content, searchResult);
        }
Ejemplo n.º 27
0
 public void Arrange()
 {
     _repo    = new MenuContentRepository();
     _content = new MenuContent("1", "Pizza", "Thick crust pepperoni pizza", "Dough, Sauce, Pizza", "12.00");
     _repo.AddContentToDirectory(_content);
 }
Ejemplo n.º 28
0
        //Seed method
        private void SeedContentlist()
        {
            MenuContent FoodOptions = new MenuContent("FoodOptions", "Burgers.", "is a healthy option", "OrganicMeet", 10, MealType.Fries);

            _contentRepo.AddContentToList(FoodOptions);
        }
 private void DisplaySimple(MenuContent content)
 {
     Console.WriteLine($"{content.MenuNumber}\n" +
                       $"{content.MenuDescription}\n" +
                       $"---------------------------");
 }
        public override void LoadContent()
        {
            base.LoadContent();

            background = MenuContent.Load <Texture2D>("background");
        }
Ejemplo n.º 31
0
 public void AddMenu(MenuContent m)
 {
     menus.Add(m);
 }