I am testing a method for a service that makes a Web API call. Using a normal HttpClient works fine for unit tests if I also run the web service (l
API
HttpClient
With Mock.Of<...>(...) for async method you can use Task.FromResult(...):
Mock.Of<...>(...)
async
Task.FromResult(...)
var client = Mock.Of(c => c.PostAsync(It.IsAny(), It.IsAny()) == Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)) );