Is there an sample code that shows unit testing a controller that inherits from the api controller? I am trying to unit test a POST but it is failing. I believe I need to set up
Using AutoFixture, I usually do something like this:
[Theory, AutoCatalogData]
public void PostToCollectionReturnsCorrectResponse(
CategoriesController sut,
CategoryRendition categoryRendition)
{
HttpResponseMessage response = sut.Post(categoryRendition);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
}
See this other SO answer for more details about this approach.