public When_ProviderReferenceDataClient_Is_Called_To_GetAll()
        {
            var lastUpdateDate = new DateTime(2019, 5, 6);
            var logger         = new NullLogger <ProviderReferenceDataClient>();

            _client = Substitute.For <IProviderQueryPortTypeClient>();
            var r = new response
            {
                ProviderQueryResponse = new ProviderQueryResponse
                {
                    MatchingProviderRecords = new ProviderRecordStructure[1]
                }
            };

            r.ProviderQueryResponse.MatchingProviderRecords[0] =
                new ProviderRecordStructure
            {
                ProviderName = "ProviderName",
                UnitedKingdomProviderReferenceNumber = "123"
            };

            _client.retrieveAllProvidersAsync(Arg.Any <ProviderQueryParam>())
            .Returns(Task.FromResult(r));

            var providerReferenceDataClient = new ProviderReferenceDataClient(logger, _client);

            _result = providerReferenceDataClient.GetAllAsync(lastUpdateDate).GetAwaiter().GetResult();
        }
Ejemplo n.º 2
0
        private async Task <response> RetrieveAllAsync(ProviderQueryParam query)
        {
            try
            {
                var response = await _providerQueryPortTypeClient.retrieveAllProvidersAsync(query);

                return(response);
            }
            catch (Exception e)
            {
                if (_providerQueryPortTypeClient.State == CommunicationState.Faulted)
                {
                    _providerQueryPortTypeClient.Abort();
                }

                _logger.LogError($"Error Executing ProviderQueryPortTypeClient Internal Exception ==> {e}");
            }

            return(null);
        }