public async Task TestMultipleParameterRequestAddsAuthenticationParameters() { using (var mockHttp = new MockHttpMessageHandler()) { mockHttp .Expect("https://www.example.com") .WithQueryString(new Dictionary <string, string> { { "test-name-1", "test-value-1" }, { "test-name-2", "test-value-2" } }) .Respond(HttpStatusCode.OK); var client = QueryStringParameterAuthenticatedHttpClient.GetClient(new MultipleQueryStringParameterAuthenticatedHttpClientOptions { Parameters = new Dictionary <string, string> { { "test-name-1", "test-value-1" }, { "test-name-2", "test-value-2" } } }, mockHttp); await client.GetStringAsync(new Uri("https://www.example.com")).ConfigureAwait(false); mockHttp.VerifyNoOutstandingExpectation(); } }
public async Task TestRequestReplacesAuthenticationParameter() { var mockHttp = new MockHttpMessageHandler(); mockHttp .Expect("https://www.example.com") .WithQueryString(new Dictionary <string, string> { { "test-name", "test-value" } }) .Respond(HttpStatusCode.OK); var client = QueryStringParameterAuthenticatedHttpClient.GetClient(new QueryStringParameterAuthenticatedHttpClientOptions { Name = "test-name", Value = "test-value" }, mockHttp); var responseContent = await client.GetStringAsync("https://www.example.com?test-name=incorrect-value"); mockHttp.VerifyNoOutstandingExpectation(); }