public void GetById_catch_exception() { FoodsController controller = GetController(throwException); var result = controller.GetById("id_test_food") as BadRequestObjectResult; var message = result.Value.GetType().Name; Assert.AreEqual(message, "Exception"); }
public void GetById_return_food() { FoodsController controller = GetController(doNotThrowException); var result = controller.GetById("id_test_food") as OkObjectResult; FoodsResponse response = result.Value as FoodsResponse; Assert.IsNotNull(response.Foods[0]); }