I have an ASP.NET Web API application, with an ApiController that features asynchronous methods, returning Task<>
objects and marked with the async
keyword.
public class MyApiController : ApiController
{
public async Task<MyData> GetDataById(string id)
{
...
}
}
How can I write NUnit tests for the ApiController's asynchronous methods? If I need to use another testing framework I'm open for that too. I'm fairly new to .NET unit testing in general, so I'm interested in learning best practices.