When I run the following code:
[Test]
public async Task Can_Test_Update()
{
var response = await _controller.UpdateAsync(Guid.NewGuid());
response.Valid.Should().BeTrue();
_commands.Received().UpdateAsync(
Arg.Is<Something>(
l => l.Status == Status.Updated));
}
If I add "await
" preceding the "_commands.Received().UpdateAsync
", it throws a null reference exception. How can I stop this happening, or is await
not necessary?
I found an answer here.