【问题标题】:NSubstitute: Checking DidNotReceive async methodNSubstitute:检查 DidNotReceive 异步方法
【发布时间】:2020-11-11 19:45:20
【问题描述】:

给定一个异步方法,NSubstitute 如何检查未收到调用?

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

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

DidNotReceive 的等价物是什么?

【问题讨论】:

    标签: .net-core nsubstitute


    【解决方案1】:

    我在这里创建/回答了我自己的问题,因为我发现这在 NSubstitute 中不直观。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-07
      • 1970-01-01
      • 2019-04-17
      • 1970-01-01
      • 2020-12-19
      相关资源
      最近更新 更多