Mid Testing

How do you mock asynchronous methods with Moq?

mockService.Setup(s => s.GetDataAsync()).ReturnsAsync("Async Data");

Moq supports ReturnsAsync to mock async methods returning Task<T>.

More from C# Programming Tutorial

All questions for this course