public override void Setup() { base.Setup(); MockGraphqlClientConfig.With(x => x.GraphqlEndpoint, "http://www.google.com"); MockAnalyticsService.With(x => x.AnalyticsOperationHeaders, new Dictionary <string, string>()); MockAuthenticatedAccessToken.With(x => x.AdditionalHeaders, new Dictionary <string, string>()); AddService(x => MockGraphqlClientConfig.Object); AddService(x => MockAuthenticatedAccessToken.Object); }
public void SHOULD_Add_AnalyticsHeaders() { //Act MockAnalyticsService.With(x => x.AnalyticsOperationHeaders, new Dictionary <string, string> { ["headerKey"] = "headerValue" }); //Act var result = Sut.CreateClient(""); //Assert Assert.That(result.DefaultRequestHeaders.First(x => x.Key == "headerKey").Value.First(), Is.EqualTo("headerValue")); }
public async Task SHOULD_append_analytics_headers_if_present() { //Arrange MockAnalyticsService.With(x => x.AnalyticsOperationHeaders, new Dictionary <string, string> { { "analyticsHeaderKey", "analyticsHeaderValue" } }); var wrapper = GetWrapper(); MockHttpClientFactory.Where_CreateClient_returns(new HttpClient(MockMessageHandler.Build().Object)); //Act await ExecuteAsync(wrapper, CancellationToken.None); //Assert MockMessageHandler.VerifyHeader("analyticsHeaderKey", "analyticsHeaderValue"); }