Пример #1
0
        public async Task <findLearnerByULNResponse> FetchLearnerDetailsAsync(RegisteredLearnerDetails learnerDetails)
        {
            try
            {
                var learnerRequest = new learnerByULNRequest
                {
                    FindLearnerByULN = new LearnerByULNRqst
                    {
                        UKPRN       = _configuration.LearningRecordServiceSettings.Ukprn,
                        UserName    = _configuration.LearningRecordServiceSettings.Username,
                        OrgPassword = _configuration.LearningRecordServiceSettings.Password,
                        ULN         = learnerDetails.Uln.ToString(),
                        GivenName   = learnerDetails.Firstname,
                        FamilyName  = learnerDetails.Lastname,
                        FindType    = Constants.LearnerByULNFindType
                    }
                };

                return(await _learnerPortTypeClient.learnerByULNAsync(learnerRequest));
            }
            catch (Exception ex)
            {
                if (_learnerPortTypeClient.State == CommunicationState.Faulted)
                {
                    _learnerPortTypeClient.Abort();
                }

                _logger.LogError($"Error while executing FetchLearnerDetailsAsync. Exception = {ex}");
                return(null);
            }
        }
Пример #2
0
 public override void Given()
 {
     _apiClient = new LearnerServiceApiClient(_logger, _learnerPortTypeClient, _configuration);
     _learnerPortTypeClient.learnerByULNAsync(Arg.Any <learnerByULNRequest>()).Returns(_mockHttpResult);
 }