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); }
public ActionResult <MainFood> Delete(int id) { try { return(Ok(_mainFoodService.DeleteMainFood(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }