When setting up an IProtectedMock
, you should use Moq.Protected.ItExpr
instead of Moq.It
.
Here is the corrected implementation of what I was trying to do in my question:
_innerHandler.Protected()
.Setup<Task<HttpResponseMessage>>("SendAsync", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>())
.ReturnsAsync(responseMessage);