Beispiel #1
0
        public void Arrange()
        {
            _restClientMock = new Mock <IRestClient>();
            _restClientMock.Setup(c => c.ExecuteTaskAsync(It.IsAny <IRestRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(GetValidResponse(new []
            {
                new ProviderTestData
                {
                    Ukprn = 123,
                    Name  = "Test",
                },
            }));

            _messageBuilderMock = new Mock <IUkrlpSoapMessageBuilder>();
            _messageBuilderMock.Setup(b => b.BuildMessageToGetUpdatesSince(It.IsAny <DateTime>(), It.IsAny <string>()))
            .Returns("some-soap-xml-request");

            _configuration = new UkrlpApiConfiguration
            {
                Url           = "https://ukrlp.test.local",
                StakeholderId = "123",
            };

            _client = new UkrlpSoapApiClient(_restClientMock.Object, _messageBuilderMock.Object, _configuration);
        }
 public UkrlpSoapApiClient(
     HttpClient httpClient,
     UkrlpApiConfiguration configuration,
     ILogger <UkrlpSoapApiClient> logger)
     : this(httpClient, configuration, logger, new RequestSerializer(), new ResponseDeserializer())
 {
 }
Beispiel #3
0
 internal UkrlpSoapApiClient(IRestClient restClient, IUkrlpSoapMessageBuilder messageBuilder,
                             UkrlpApiConfiguration configuration)
 {
     _restClient         = restClient;
     _restClient.BaseUrl = new Uri(configuration.Url, UriKind.Absolute);
     _messageBuilder     = messageBuilder;
 }
Beispiel #4
0
        public void Arrange()
        {
            _httpClientMock = new HttpClientMock();
            _httpClientMock
            .SetDefaultResponse(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("<element />", Encoding.UTF8, "text/xml")
            });

            _configuration = new UkrlpApiConfiguration
            {
                WebServiceUrl = "http://localhost:1234",
                StakeholderId = 123,
            };

            _logger = new Mock <ILogger <UkrlpSoapApiClient> >();

            _requestSerializer = new Mock <IRequestSerializer>();
            _requestSerializer.Setup(serializer => serializer.Serialize(It.IsAny <ProviderQueryRequest>()))
            .Returns("<unit-test>testing</unit-test>");

            _responseDeserializer = new Mock <IResponseDeserializer>();
            _responseDeserializer.Setup(deserializer => deserializer.DeserializeResponse(It.IsAny <string>()))
            .Returns(new Provider[0]);

            _client = new UkrlpSoapApiClient(
                _httpClientMock.AsHttpClient(),
                _configuration,
                _logger.Object,
                _requestSerializer.Object,
                _responseDeserializer.Object);
        }
        internal UkrlpSoapApiClient(
            HttpClient httpClient,
            UkrlpApiConfiguration configuration,
            ILogger <UkrlpSoapApiClient> logger,
            IRequestSerializer requestSerializer,
            IResponseDeserializer responseDeserializer)
        {
            _httpClient             = httpClient;
            _httpClient.BaseAddress = new Uri(configuration.WebServiceUrl, UriKind.Absolute);

            _configuration        = configuration;
            _logger               = logger;
            _requestSerializer    = requestSerializer;
            _responseDeserializer = responseDeserializer;
        }
        public void Arrange()
        {
            _restClientMock = new Mock <IRestClient>();
            _restClientMock.Setup(c => c.ExecuteTaskAsync(It.IsAny <IRestRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(GetValidResponse(123, "Test"));

            _messageBuilderMock = new Mock <IUkrlpSoapMessageBuilder>();
            _messageBuilderMock.Setup(b => b.BuildMessageToGetSpecificUkprns(It.IsAny <long[]>(), It.IsAny <string>()))
            .Returns("some-soap-xml-request");

            _configuration = new UkrlpApiConfiguration
            {
                Url           = "https://ukrlp.test.local",
                StakeholderId = "123",
            };

            _client = new UkrlpSoapApiClient(_restClientMock.Object, _messageBuilderMock.Object, _configuration);
        }
Beispiel #7
0
 public UkrlpSoapApiClient(IRestClient restClient, UkrlpApiConfiguration configuration)
     : this(restClient, new UkrlpSoapMessageBuilder(configuration.StakeholderId), configuration)
 {
 }