I have a xUnit test like:
[Fact]
public async void GetLocationsCountAsync_WhenCalled_ReturnsLocationsCount()
{
_locationsService.Setup(s => s.GetLocat
The issue is wrapping it in Ok. If you return the object itself, Value is populated correctly.
If you look at Microsoft's examples in the docs, they only use the controller methods for non-default responses like NotFound:
[HttpGet("{id}")]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public ActionResult GetById(int id)
{
if (!_repository.TryGetProduct(id, out var product))
{
return NotFound();
}
return product;
}