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