public void Reuse_last_used_credentials() { // Arrange var cache = new HttpCredentialCache { new BasicCredentials(new Uri("http://example.org"), username: "", password: "") }; var authService = new CredentialService(cache); var request = new HttpRequestMessage(){RequestUri = new Uri("http://example.org")}; authService.CreateAuthenticationHeaderFromChallenge(request, new[] { new AuthenticationHeaderValue("basic", "") }); // Act var header = authService.CreateAuthenticationHeaderFromRequest(request); // Assert Assert.Equal("basic", header.Scheme); }
public AuthMessageHandler(HttpMessageHandler innerHandler, CredentialService credentialService) { InnerHandler = innerHandler; _credentialService = credentialService; }