Closed
Description
I'm not sure if it's something I'm doing, or a problem with a missing extension definition.
Our controller actions for an API project are defined as:
public async Task<ActionResult<IEnumerable<CustomerDto>>> Get()
{
return Ok(await _mediator.Send(new GetCustomerQuery());
}
In the test:
var result = await sut.Get();
result.Should().BeOkObjectResult(); //
The code actually doesn't compile, as the Should()
extension isn't detected properly. The extensions are defined as:
Should(this ActionResult actual);
Should(this IActionResult actual);
but the ActionResult is neither.
As a workaround, I've added an extension for Should(this IConvertToActionResult)
, and just call the .Convert()
method.
Is there a better, or different approach here?
Metadata
Metadata
Assignees
Labels
No labels