예제 #1
0
        public void GetItemByNumber_ShouldReturnCorrectItem()
        {
            KomodoCafeItem menuItem = new KomodoCafeItem(5, "Corndog", "Corn with dog meat", new List <string>()
            {
                "bread", "meat", "starch", "sugar"
            }, 5.95);
            KomodoCafeItem menuItem2 = new KomodoCafeItem(4, "Burger", "Cow meat with cheese", new List <string>()
            {
                "wild cow", "ketchup", "Fries", "relish"
            }, 7.95);

            KomodoCafeRepository repository = new KomodoCafeRepository();

            repository.AddNewMenuItem(menuItem);
            repository.AddNewMenuItem(menuItem2);

            KomodoCafeItem retrievedItem = repository.GetItemByNumber(4);

            Console.WriteLine($"Retrieved Item Name: {retrievedItem.MealName}\n" +
                              $"Retrieved Item Ingredients: {retrievedItem.Ingredients[0]}");
            Assert.AreEqual("Burger", retrievedItem.MealName);


            KomodoCafeItem retrievedItem2 = repository.GetItemByNumber(5);

            Console.WriteLine($"Retrieved Item Name: {retrievedItem2.MealName}\n" +
                              $"Retrieved Item Ingredients: {retrievedItem2.Ingredients[0]}");
            Assert.AreEqual("Corndog", retrievedItem2.MealName);
        }
예제 #2
0
 public void Arrange()
 {
     _fullMenu = new KomodoCafeRepository();
     _menuItem = new KomodoCafeItem(4, "Burger", "Cow meat with cheese", new List <string>()
     {
         "wild cow", "ketchup", "Fries", "relish"
     }, 7.95);
     _fullMenu.AddNewMenuItem(_menuItem);
 }
예제 #3
0
        public void AddNewMenuItem_ShouldReturnCorrectBool()
        {
            KomodoCafeItem       menuItem   = new KomodoCafeItem();
            KomodoCafeRepository repository = new KomodoCafeRepository();

            bool itemAdded = repository.AddNewMenuItem(menuItem);

            Console.WriteLine($"Was item added?: {itemAdded}");
            Assert.IsTrue(itemAdded);
        }
예제 #4
0
        public void DeleteMenuItem_ShouldReturnTrue()
        {
            bool           itemWasDeleted = _fullMenu.DeleteMenuItem(4);
            KomodoCafeItem checkForItem   = _fullMenu.GetItemByNumber(4);

            if (checkForItem == null)
            {
                Console.WriteLine($"Get all menu items null triggered");
            }
            Assert.IsTrue(itemWasDeleted);
        }
예제 #5
0
        public void GetAllMenuItems_ShouldReturnCollection()
        {
            KomodoCafeItem       menuItem   = new KomodoCafeItem();
            KomodoCafeRepository repository = new KomodoCafeRepository();

            repository.AddNewMenuItem(menuItem);

            List <KomodoCafeItem> fullMenu = repository.GetAllMenuItems();
            bool menuContainsItems         = fullMenu.Contains(menuItem);

            Assert.IsTrue(menuContainsItems);
        }
        public void SeedMenuList()
        {
            KomodoCafeItem menuItem = new KomodoCafeItem(1, "Corndog", "Corn with dog meat", new List <string>()
            {
                "bread", "meat", "starch", "sugar"
            }, 5.95);
            KomodoCafeItem menuItem2 = new KomodoCafeItem(2, "Burger", "Cow meat with cheese", new List <string>()
            {
                "wild cow", "ketchup", "Fries", "relish"
            }, 7.95);
            KomodoCafeItem menuItem3 = new KomodoCafeItem(3, "Pulled Pork Sandwich", "Pulled pork on artisan bun with bbq sauce", new List <string>()
            {
                "bread", "pork", "high fructose corn syrup"
            }, 8.99);
            KomodoCafeItem menuItem4 = new KomodoCafeItem(4, "Chicken Salad", "Mixed greens with grilled chicken", new List <string>()
            {
                "chicken", "iceberg lettuce", "tomatoes", "kale"
            }, 9.99);

            _repo.AddNewMenuItem(menuItem);
            _repo.AddNewMenuItem(menuItem2);
            _repo.AddNewMenuItem(menuItem3);
            _repo.AddNewMenuItem(menuItem4);
        }
        public void AddItem()
        {
            Console.Clear();
            KomodoCafeItem newItem = new KomodoCafeItem();

            List <KomodoCafeItem> fullmenu = _repo.GetAllMenuItems();
            int count = fullmenu.Count();

            bool invalidMealNumber = true;

            while (invalidMealNumber)
            {
                Console.WriteLine("Enter the MealNumber\n" +
                                  $"Number must be {count + 1} or greater.");
                int newMealNumber = Convert.ToInt32(Console.ReadLine());
                if (newMealNumber <= count)
                {
                    Console.WriteLine("That meal number is taken.");
                }
                else
                {
                    newItem.MealNumber = newMealNumber;
                    invalidMealNumber  = false;
                }
            }

            Console.WriteLine("Enter Mealname:");
            newItem.MealName = Console.ReadLine();

            Console.WriteLine("Enter Description:");
            newItem.Description = Console.ReadLine();

            List <string> newIngredientList  = new List <string>();
            bool          addMoreIngredients = true;

            while (addMoreIngredients)
            {
                Console.WriteLine("Enter Ingredient:\n" +
                                  "Enter \"Done\" when finished");
                string userInput = Console.ReadLine();

                if (userInput.ToLower() == "done")
                {
                    addMoreIngredients = false;
                }
                else
                {
                    newIngredientList.Add(userInput);
                    Console.WriteLine("Ingredient Added");
                }
            }
            newItem.Ingredients = newIngredientList;

            Console.WriteLine("Enter Price:");
            newItem.Price = Convert.ToDouble(Console.ReadLine());

            bool wasAddedCorrectly = _repo.AddNewMenuItem(newItem);

            if (wasAddedCorrectly)
            {
                Console.WriteLine("New Menu Item Succesfully Added");
            }
            else
            {
                Console.WriteLine("Error adding menu item");
            }
        }