NSubstitute:检查 DidNotReceive 异步方法

NSubstitute: Checking DidNotReceive async method

给定异步方法,NSubstitute 如何检查未收到呼叫?

使用 NSubstitute,我们可以使用以下命令检查一个(或多个)异步方法是否按顺序接收:

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

DidNotReceive 的等价物是什么?

我 created/answered 我自己的问题在这里,因为我发现这在 NSubstitute 中不直观。

await client.DidNotReceive().SendAsync(Arg.Any<string>());