public void MenuRepo_AddItem_ShouldIncreaseCountByOne()
        {
            //Arrange
            Menu meal = new Menu("Fish", 5, "greasy and fried", "flour tortilla and fryer", 3.33m);

            //act
            menuRepoTests.AddItem(meal);
            var actual   = menuRepoTests.GetMenuList().Count;
            var expected = 1;

            //assert
            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void Test_AddItem()
        {
            var menurepo = new MenuRepo();

            Menu.Item item = new Menu.Item();
            menurepo.AddItem(item);
            var addList   = menurepo.GetItemList();
            var addcount  = addList.Count;
            var listcount = _listofItems.Count;

            Assert.AreNotEqual(listcount, addList);
        }
        private void AddItem()
        {
            System.Console.Clear();
            var newmeal = new Menu.Item();

            System.Console.WriteLine("Enter the Meal Number: ");
            string mealnumstring = (System.Console.ReadLine());



            int mealnum = Convert.ToInt32(mealnumstring);

            newmeal.MealNumber = mealnum;

            System.Console.WriteLine("Enter the Meal Name: ");
            string mealname = System.Console.ReadLine();

            newmeal.MealName = mealname;

            System.Console.WriteLine("Enter a description for the new meal item: ");
            string mealdescription = System.Console.ReadLine();

            newmeal.Description = mealdescription;

            System.Console.WriteLine("Please write a list of the meal ingredients(separated by commas): ");
            string ingredients = System.Console.ReadLine();

            newmeal.ListOfIngredients = ingredients;

            System.Console.WriteLine("Enter the new meal price(as a decimal value(i.e. '1.99')): ");
            string  mealpricestring = System.Console.ReadLine();
            decimal mealprice       = Convert.ToDecimal(mealpricestring);

            newmeal.Price = mealprice;

            _menuRepo.AddItem(newmeal);
        }