【发布时间】:2016-11-02 02:45:32
【问题描述】:
我正在尝试通过查看有多少结果传递到我的Save method 来测试我的一种方法。相关行是:
await paymentSampleRepository.Received()
.SaveSamplesAsync(Arg.Do<List<PaymentSamplePopulation>>(x =>
Assert.Equal(sampleCount, x.Count())
), modifiedBy);
我显然遗漏了一些关于如何测试这个的东西......我如何测试传递给SaveSamplesAsync的Count
这总是显示为通过。我在Assert 中尝试过sampleCount 和sampleCount + 1,它们都显示为通过!
如果需要,我可以展示整个测试方法。
【问题讨论】:
-
显示重现问题的minimal reproducible example
标签: c# unit-testing asp.net-core xunit.net nsubstitute