コード例 #1
0
        //Update items dialog
        private void UpdateItem()
        {
            //Display options for update
            DisplayAllItems();
            //Get item they want to update
            Console.WriteLine("Enter the item # you'd like to update: ");
            string menuNumAsString = Console.ReadLine();
            int    originalNum     = int.Parse(menuNumAsString);
            //Take in updated info
            MenuItems newMenuItem = new MenuItems();

            //MenuItem.MealNum = _menuItemsRepo.MenuItemNum();
            Console.WriteLine("Enter the new meal name: ");
            newMenuItem.MealName = Console.ReadLine();
            //MenuItem Description
            Console.WriteLine("Enter the meal description: ");
            newMenuItem.MealDesc = Console.ReadLine();
            //Ingredients
            Console.WriteLine("Please enter the ingredients: ");
            newMenuItem.Ingredients = Console.ReadLine();
            //Price ;
            Console.WriteLine("Please enter the price: ");
            string priceAsString = Console.ReadLine();

            newMenuItem.Price = double.Parse(priceAsString);
            _menuItemsRepo.UpdateItemByNum(originalNum, newMenuItem);
            Console.WriteLine("Item was successfully updated.");
        }
コード例 #2
0
        public void UpdateContentShouldUpdate()
        {
            MenuItems newItem = new MenuItems(_repo.MenuItemNum(), "Eggs", "Eggs with toast", "eggs, butter, bread", 99.99);

            _repo.UpdateItemByNum(3, newItem);
            double expected = 99.99;
            double actual   = _repo.GetMenuItemsByNum(3).Price;

            Assert.AreEqual(expected, actual);
        }