public void Create_bad_test() { EditedFoodCategory category = new EditedFoodCategory() { Name = "Category invalid test" }; FoodCategoriesController controller = GetFoodCategoriesController(doNotThrowException); var response = controller.Create(category).GetType().Name; Assert.AreEqual("BadRequestObjectResult", response); }
public void Create_catch_exception() { EditedFoodCategory category = new EditedFoodCategory() { Name = "Exception" }; FoodCategoriesController controller = GetFoodCategoriesController(throwException); var response = controller.Create(category) as BadRequestObjectResult; var message = response.Value.GetType().Name; Assert.AreEqual("Exception", message); }