public override Integration CreateIntegration(dynamic parameters)
        {
            var config         = new KeepTruckinHttpConfiguration();
            var employeeClient = new KeepTruckinHttpWriteClient <Employee>(_httpClientFactory, new EmployeeConfiguration(config));

            employeeClient.SetApiKey(parameters.ApiKey);

            return(new KeepTruckin(_logger, new KeepTruckinEmployeeProvider(employeeClient)));
        }
Beispiel #2
0
        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 KeepTruckinHttpConfiguration();
            var implementation = new KeepTruckinHttpWriteClient <Employee>(_httpClient, new EmployeeConfiguration(config));

            //Act
            implementation.SetApiKey("1234");

            //Assert
            Assert.IsTrue(implementation.HttpClient.DefaultRequestHeaders.Contains("X-Key"));
            Assert.IsTrue(implementation.HttpClient.DefaultRequestHeaders.First(f => f.Key == "X-Key").Value.Contains("1234"));
        }
Beispiel #3
0
 public override void BuildClients()
 {
     _employeeClient = new KeepTruckinHttpWriteClient <Employee>(_httpClient, _employeeConfiguration);
     _employeeClient.SetApiKey(_apiKey);
 }