コード例 #1
0
        public void Challenge1_menuRepo_ShouldReturnCountWith1()
        {
            Menu one = new Menu(1, "Cake", "yummy", "cakemix", 5);

            menuRepo.AddItemToList(one);

            var actual   = menuRepo.GetList().Count;
            var expected = 1;

            Assert.AreEqual(actual, expected);
        }
コード例 #2
0
        public void Seed()
        {
            _menuRepository = new MenuRepository();
            _Hotdog         = new MenuItem(2, "Hotdog", "Sausage in a bun.", 1.00m, "Sausage, Bread, Ketchup, Mustard");
            MenuItem Cheeseburger = new MenuItem(
                1,
                "Cheeseburger",
                "Hamburger topped with cheese.",
                3.00m,
                "Bread, Beef, Cheeese, Tomato, Lettuce, Onion");

            _menuRepository.AddItemToList(Cheeseburger);
            _menuRepository.AddItemToList(_Hotdog);
        }
コード例 #3
0
        private void CreateNewItem()
        {
            Console.Clear();
            MenuItem newItem = new MenuItem();

            Console.WriteLine("Enter the Name of the Item: ");
            newItem.MealName = Console.ReadLine();

            Console.WriteLine("Enter the Description of the Item: ");
            newItem.MealDescription = Console.ReadLine();

            Console.WriteLine("Enter the Ingredients of the Item: ");
            newItem.MealIngredients = Console.ReadLine();

            Console.WriteLine("Enter the Number of the Item: ");
            string itemNumberString = Console.ReadLine();

            newItem.MealNumber = int.Parse(itemNumberString);

            Console.WriteLine("Enter the Price of the Item");
            string priceString = Console.ReadLine();

            newItem.MealPrice = decimal.Parse(priceString);

            _menuRepo.AddItemToList(newItem);
            Console.Clear();
        }
コード例 #4
0
        public void MenuRepository_RemoveItem_CountShouldDecrease()
        {
            //-- Arrange
            Menu meal = new Menu(1, "Waffles", "Some more waffles.", "Even more waffles and syrup.", 10.00m);

            menuRepo.AddItemToList(meal);
            menuRepo.RemoveItemFromList(1);
            List <Menu> menuListTest = menuRepo.GetList();

            //--Act
            int actual   = menuListTest.Count;
            int expected = 0;

            //-- Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void AddItemToListTest()
        {
            MenuItem Hamburger = new MenuItem(
                2,
                "Hamburger",
                "Beef on a bun.",
                2.00m,
                "Bread, Beef, Tomato, Lettuce, Onion");
            bool wasAdded = _menuRepository.AddItemToList(Hamburger);

            Assert.IsTrue(wasAdded);
        }
コード例 #6
0
        private void AddItemToList()
        {
            CafeMenu item = new CafeMenu();

            Console.Write("Please enter a meal: ");
            item.Meal = Console.ReadLine();

            Console.Write("Please enter a meal description: ");
            item.MealDescription = Console.ReadLine();

            Console.Write("Please enter a price: ");
            item.Price = decimal.Parse(Console.ReadLine());

            Console.Write("Please enter a menu item iD: ");
            item.MenuItemID = int.Parse(Console.ReadLine());

            Console.Write("Please enter the ingredients: ");
            item.Ingredients = Console.ReadLine();

            _itemRepo.AddItemToList(item);
        }
コード例 #7
0
        public void RemoveFromListTest()
        {
            //Arrange
            MenuRepository itemRepo = new MenuRepository();
            CafeMenu       item     = new CafeMenu("Salmon Piccata", "Salmon filet grilled to perfection.", 45, 2, "Salmon");

            //Act
            itemRepo.AddItemToList(item);
            bool wasRemoved = itemRepo.RemoveItemFromList(item);

            //Assert
            Assert.IsTrue(wasRemoved);
        }
コード例 #8
0
        public void GetItemByIngredientsTest()
        {
            //Arrange
            MenuRepository itemRepo = new MenuRepository();
            CafeMenu       item     = new CafeMenu("Salmon Piccata", "Salmon filet grilled to perfection.", 45, 2, "Salmon");

            //Act
            itemRepo.AddItemToList(item);
            CafeMenu actual = itemRepo.GetItemByIngredients("Salmon");

            //Assert
            Assert.AreEqual(item, actual);
        }
コード例 #9
0
        public void MenuRepositoryAddToList()
        {
            //Arrange
            MenuRepository itemRepo = new MenuRepository();
            CafeMenu       item     = new CafeMenu("Salmon Piccata", "Salmon filet grilled to perfection.", 45, 2, "Salmon");

            //Act
            _itemRepo.AddItemToList(item);

            int expected = 0;
            int actual   = itemRepo.GetCafeMenuList().Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }