5

Given an async method, how can NSubstitute check a call was not received?

With NSubstitute, we can check a async method (or many) were received in order using:

Received.InOrder(async () =>
{
    await client.SendAsync(Arg.Any<string>())
});

What is the equivalent for DidNotReceive?

0909EM
  • 4,761
  • 3
  • 29
  • 40

1 Answers1

6

I created/answered my own question here because I found this unintuitive in NSubstitute.

await client.DidNotReceive().SendAsync(Arg.Any<string>());
0909EM
  • 4,761
  • 3
  • 29
  • 40