예제 #1
0
        public ActionResult Delete(int menuItemIngredientId)
        {
            MenuItemIngredient menuItemIngredient = MenuItemIngredient.Find(menuItemIngredientId);

            menuItemIngredient.Delete();
            return(RedirectToAction("Index"));
        }
        public void Delete_DeletesMenuItemIngredientFromDatabase()
        {
            //Arrange
            string             menuItemIngredientDescription = "Avocadoes";
            int                menuItemsId           = 1;
            int                storeId               = 1;
            MenuItemIngredient newMenuItemIngredient = new MenuItemIngredient(menuItemIngredientDescription, menuItemsId, storeId);

            newMenuItemIngredient.Save();
            newMenuItemIngredient.Delete();

            //Act
            List <MenuItemIngredient> newList = new List <MenuItemIngredient> {
                newMenuItemIngredient
            };
            List <MenuItemIngredient> resultList = MenuItemIngredient.GetAll();

            //Assert
            CollectionAssert.AreNotEqual(newList, resultList);
        }