public override Integration CreateIntegration(dynamic parameters) { var config = new JjKellerHttpConfiguration(); var employeeClient = new JjKellerHttpWriteClient <Employee>(_httpClientFactory, new EmployeeConfiguration(config)); employeeClient.SetApiKey(parameters.ApiKey); return(new JjKeller(_logger, new JjKellerEmployeeProvider(employeeClient))); }
public void ShouldSetApiKeyHeader() { //Arrange _fakeHttpMessageHandler.Setup(f => f.Send(It.IsAny <HttpRequestMessage>())) .Returns(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(string.Empty) }); var config = new JjKellerHttpConfiguration(); var implementation = new JjKellerHttpWriteClient <Employee>(_httpClient, new EmployeeConfiguration(config)); //Act implementation.SetApiKey("1234"); //Assert Assert.IsTrue(implementation.HttpClient.DefaultRequestHeaders.Contains("Keller-API-Key")); Assert.IsTrue(implementation.HttpClient.DefaultRequestHeaders.First(f => f.Key == "Keller-API-Key").Value.Contains("1234")); }