///<inheritdoc/> public HttpClient CreateClient(string name) { Mock <HttpMessageHandler> mockHttpMessageHandler = new Mock <HttpMessageHandler>(); mockHttpMessageHandler.Protected() .Setup <Task <HttpResponseMessage> >("SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>()) .Callback <HttpRequestMessage, CancellationToken>((message, token) => RequestMessages.Push(message)) .ReturnsAsync(ResponseMessages.Pop()); HttpClient client = new HttpClient(mockHttpMessageHandler.Object) { BaseAddress = new System.Uri(BaseAddress) }; return(client); }