Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static analysis error #597

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ internal static Mock<IHttpClientFactory> GetHttpClientFactoryMock(
int? numberOfFailuresBeforeOk = null,
bool? shouldThrowException = false)
{
HttpMessageHandler messageHandler =
HttpClientHandler messageHandler =
(shouldThrowException, numberOfFailuresBeforeOk) switch
{
(true, _) => new MockedHttpExceptionMessageHandler(message),
(_, null) => new MockedHttpMessageHandler(message),
(_, int n) => new MockedRepeatedErrorsHttpMessageHandler(message, n)
};
messageHandler.CheckCertificateRevocationList = true;

HttpClient httpClientMock = new(messageHandler);

Expand Down Expand Up @@ -146,7 +147,7 @@ internal static void SetLocalServiceInfo()
}
}

internal class MockedHttpMessageHandler : HttpMessageHandler
internal class MockedHttpMessageHandler : HttpClientHandler
{
private readonly HttpResponseMessage m_response;

Expand All @@ -163,7 +164,7 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
/// Returns 500 for a given number of times before returning the given response.
/// The pattern is recursive, so after returning an OK response, it returns an originally given number of 500 responses.
/// </summary>
internal class MockedRepeatedErrorsHttpMessageHandler : HttpMessageHandler
internal class MockedRepeatedErrorsHttpMessageHandler : HttpClientHandler
{
private readonly HttpResponseMessage m_response;
private readonly int m_failureTimes;
Expand All @@ -189,7 +190,7 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
}
}

internal class MockedHttpExceptionMessageHandler : HttpMessageHandler
internal class MockedHttpExceptionMessageHandler : HttpClientHandler
{
private readonly HttpResponseMessage m_response;

Expand Down