To Devs, I would be mocking HttpMessageHandler to test an HttpClient, my question is how would I mock based on the URL and Http Method? So the response would be a function of the Method and URL:
Get + "http://testdoc.com/run?test=true&t2=10 => return X
Get + "http://testdoc.com/walk?test=true&t2=10 => return Y
Post + "http://testdoc.com/walk => return Z
All 3 calls would return something different.
My current unit test catches everything:
var mockMessageHandler = new Mock<HttpMessageHandler>();
mockMessageHandler.Protected()
.Setup<Task<HttpResponseMessage>>("SendAsync", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>())
.ReturnsAsync(new HttpResponseMessage
{ ... });
Thanks,