【发布时间】:2015-06-23 07:06:05
【问题描述】:
当我运行以下代码时:
[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));
}
如果我在“_commands.Received().UpdateAsync”之前添加“await”,则会引发空引用异常。我怎样才能阻止这种情况发生,或者await 没有必要?
【问题讨论】:
标签: c# asynchronous async-await nsubstitute