mardi 2 février 2016

How write a unit test for asynchronous Web API

I have a project in C# and Framework 6. I have a WEB API to call the methods. what is the best way to write a unit test for async WebAPI methods?

This is the method I have:

[HttpGet]
[Route("GetYears")]
public async Task<IEnumerable<Year>>  GetYears()
{
     IEnumerable<Year> newYears;    
     newYears = await creditApplicationsRepository.GetYearsAsync();
     return newYears;
}

Aucun commentaire:

Enregistrer un commentaire