コード例 #1
0
        public void deleteWithoutIdLowerThan1()
        {
            var menu = new MainFood()
            {
                Id = 0
            };
            Exception ex = Assert.ThrowsException <ArgumentException>(() =>
                                                                      mainFoodService.DeleteMainFood(menu.Id));

            Assert.AreEqual("ID requires to be greater than 0.", ex.Message);
        }
コード例 #2
0
        public ActionResult <MainFood> Delete(int id)
        {
            try
            {
                return(Ok(_mainFoodService.DeleteMainFood(id)));
            }

            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }