我在C#和Framework 6中有一个项目。我有一个WEB API来调用这些方法。 为异步WebAPI方法编写单元测试的最佳方式是什么?如何编写异步Web API的单元测试
这是我的方法:
[HttpGet]
[Route("GetYears")]
public async Task<IEnumerable<Year>> GetYears()
{
IEnumerable<Year> newYears;
newYears = await creditApplicationsRepository.GetYearsAsync();
return newYears;
}
你需要'GetYearsTest' async –
确定我的不好,因为'await'。 –
感谢您的工作解决方案。 –