Beispiel #1
0
        private void DeleteExistingContent()
        {
            Console.Clear();
            Console.Write("Please choose the item you'd like to remove: \n");
            List <KomodoCafeContent> contentList = _kcRepo.GetAllContent();

            int count = 0;

            foreach (KomodoCafeContent content in contentList)
            {
                count++;
                Console.Write($"{count} - {content.MealName} \n");
            }
            int targetContentID = int.Parse(Console.ReadLine());
            int targetIndex     = targetContentID - 1;

            if (targetIndex >= 0 && targetIndex < contentList.Count)
            {
                KomodoCafeContent desiredContent = contentList[targetIndex];
                if (_kcRepo.DeleteExistingContent(desiredContent))
                {
                    Console.Write($"{desiredContent.MealName} has been removed ");
                }
                else
                {
                    Console.Write("Sorry, but you can't do that ");
                }
            }
            else
            {
                Console.Write("There has been an error, please try again \n" +
                              "Please press any key to continue");
                Console.ReadKey();
            }
        }
        public void Arrange()
        {
            _content = new KomodoCafeContent(1, "HumCar", "Hummus and Baby Carrots", "Hummus, Baby Carrots", 2.99);
            _repo    = new MenuContentRepository();

            _repo.AddMenuItems(_content);
        }
Beispiel #3
0
        private void AddNewItems()
        {
            KomodoCafeContent newItems = new KomodoCafeContent();

            Console.WriteLine("Please enter the menu item number:");
            string mealNumberString = Console.ReadLine();

            newItems.MealNumber = int.Parse(mealNumberString);

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

            Console.WriteLine("Please enter the meal description:");
            newItems.MealDescription = Console.ReadLine();

            Console.WriteLine("Please enter the meal ingredients:");
            newItems.MealIngredients = Console.ReadLine();

            Console.WriteLine("Please enter the meal price:");
            newItems.MealPrice = Convert.ToDouble(Console.ReadLine());
            //string mealPriceAsString = Console.ReadLine();
            //newItems.MealPrice = double.Parse(mealPriceAsString);

            _contentRepo.AddMenuItems(newItems);
        }
Beispiel #4
0
 private void DisplayContent(KomodoCafeContent content)
 {
     Console.WriteLine($"Meal Number: {content.MealNumber} \n" +
                       $"Meal Name: {content.MealName} \n" +
                       $"Description: {content.Description} \n" +
                       $"Ingredient(s): {content.Ingredient} \n" +
                       $"Price: {content.Price}");
 }
Beispiel #5
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            KomodoCafeContent toBeDeleted = _kcrepo.GetContentByTitle("Derp");

            bool removeResult = _kcrepo.DeleteExistingContent(toBeDeleted);

            Assert.IsTrue(removeResult);
        }
Beispiel #6
0
        public void Arrange()
        {
            _kcrepo  = new KomodoCafeRepo();
            _content = new KomodoCafeContent(9, "Derp", "Derpina", IngredientList.Mayonaise, 10.10m);
            _kcrepo.AddContentToDirectory(_content);

            //Stopped here because I remembered we only needed to test our methods for challenge one.
        }
Beispiel #7
0
        public void AddContentToDirectory_ShouldGetCorrectBool()
        {
            KomodoCafeContent content = new KomodoCafeContent();
            KomodoCafeRepo    repo    = new KomodoCafeRepo();

            bool addResult = repo.AddContentToDirectory(content);

            Assert.IsTrue(addResult);
        }
Beispiel #8
0
        private void SeedMenu()
        {
            KomodoCafeContent itemOne   = new KomodoCafeContent(1, "HumCar", "Hummus and Baby Carrots", "Hummus, Baby Carrots", 2.99);
            KomodoCafeContent itemTwo   = new KomodoCafeContent(2, "Cheesers", "Cheese and Crackers", "Cheddar Cheese, Water Crackers", 3.99);
            KomodoCafeContent itemThree = new KomodoCafeContent(3, "BeastSam", "Roast Beef and Sourdough Bread", "Roast Beef, Sourdough Bread", 4.99);

            _contentRepo.AddMenuItems(itemOne);
            _contentRepo.AddMenuItems(itemTwo);
            _contentRepo.AddMenuItems(itemThree);
        }
Beispiel #9
0
        public void GetAllDirectory_ShouldReturnCorrectList()
        {
            KomodoCafeContent testContent = new KomodoCafeContent();
            KomodoCafeRepo    repo        = new KomodoCafeRepo();

            repo.AddContentToDirectory(testContent);

            List <KomodoCafeContent> testList = repo.GetAllContent();
            bool directoryHasContent          = testList.Contains(testContent);

            Assert.IsTrue(directoryHasContent);
        }
        public void AddToList_ReturnNotNull()
        {
            KomodoCafeContent content = new KomodoCafeContent();

            content.MealName = "HumCar";
            MenuContentRepository repository = new MenuContentRepository();

            repository.AddMenuItems(content);
            KomodoCafeContent contentfromMenu = repository.GetMenuItemsToDelete("HumCar");

            Assert.IsNotNull(contentfromMenu);
        }
Beispiel #11
0
        private void CreateNewContent()
        {
            Console.Clear();
            KomodoCafeContent content = new KomodoCafeContent();

            Console.Write("Please enter a meal number: (ex: 1, 2, 3, etc... ");
            content.MealNumber = int.Parse(Console.ReadLine());

            Console.Write("Please enter a meal name: ");
            content.MealName = Console.ReadLine();

            Console.Write("Please enter a description: ");
            content.Description = Console.ReadLine();

            Console.WriteLine("Please select an ingredient(s): \n" +
                              "1) Lettuce \n" +
                              "2) Mayonaise \n" +
                              "3) Tomato \n" +
                              "4) Onion \n" +
                              "5) Cheese \n" +
                              "6) Patty");

            string ingredientChoice = Console.ReadLine();
            int    ingredientID     = int.Parse(ingredientChoice);

            content.Ingredient = (IngredientList)ingredientID;

            Console.Write("Please enter a price in dollars: (ex: 4.99, 6.37, 10.34, etc... ");
            content.Price = decimal.Parse(Console.ReadLine());

            bool added = _kcRepo.AddContentToDirectory(content);

            if (added)
            {
                Console.Write("Your items have been added \n" +
                              "Please press any key to continue");
                Console.ReadKey();
            }
            else
            {
                Console.Write("There has been an error, please try again \n" +
                              "Please press any key to continue");
                Console.ReadKey();
            }
        }
        public void ViewMenuItems_ReturnMenu()


        {
            KomodoCafeContent content = new KomodoCafeContent();

            content.MealNumber      = 1;
            content.MealName        = "HumCar";
            content.MealDescription = "Hummus and Baby Carrots";
            content.MealIngredients = "Hummus, Baby Carrots";
            content.MealPrice       = 2.99;

            Assert.AreEqual(content.MealNumber, 1);
            Assert.AreEqual(content.MealName, "HumCar");
            Assert.AreEqual(content.MealDescription, "Hummus and Baby Carrots");
            Assert.AreEqual(content.MealIngredients, "Hummus, Baby Carrots");
            Assert.AreEqual(content.MealPrice, 2.99);
        }
Beispiel #13
0
        private void SeedContentList()
        {
            //  Meal Number
            //  Meal Name
            //  Description
            //  Ingredient
            //  Price
            KomodoCafeContent dodecaDiabetesBurger = new KomodoCafeContent(1, "Dodeca Diabetes Burger", "Our signature burger will give you diabetes faster than any other!", IngredientList.Patty /*12 Patties */, 19.99m);

            _kcRepo.AddContentToDirectory(dodecaDiabetesBurger);
            KomodoCafeContent justCheese = new KomodoCafeContent(2, "Just Cheese", "Simple, yet elegant.  Our Just Cheese burger just has cheese!", IngredientList.Cheese, 99.99m);

            _kcRepo.AddContentToDirectory(justCheese);
            KomodoCafeContent bltMayo = new KomodoCafeContent(3, "BLT Mayo", "The Burger, Lettuce, Tomato, Mayo is back! But without bacon and a mayonaise infused burger instead!", IngredientList.Lettuce, 1.00m);

            _kcRepo.AddContentToDirectory(bltMayo);
            KomodoCafeContent megaOnion = new KomodoCafeContent(4, "Mega Onion", "You want onions? Oh we'll give you onions! A whole crap ton of them! Can you resist the tears?", IngredientList.Onion, 1050.99m);

            _kcRepo.AddContentToDirectory(megaOnion);
        }