示例#1
0
        public async Task <List <string> > GetEmailsAsync(long providerId, string lastUpdateEmail)
        {
            List <string> addresses;

            if (!_configuration.UseProviderEmail)
            {
                _logger.Info($"Getting provider test email (${string.Join(", ", _configuration.ProviderTestEmails)})");
                return(_configuration.ProviderTestEmails);
            }

            if (!string.IsNullOrEmpty(lastUpdateEmail))
            {
                return new List <string> {
                           lastUpdateEmail
                }
            }
            ;

            addresses = await _idamsEmailServiceWrapper.GetEmailsAsync(providerId);

            if (addresses.Any())
            {
                return(addresses);
            }

            addresses = await _idamsEmailServiceWrapper.GetSuperUserEmailsAsync(providerId);

            if (addresses.Any())
            {
                return(addresses);
            }

            if (GetProviderAddresses(providerId, out addresses))
            {
                return(addresses);
            }

            if (!addresses.Any())
            {
                _logger.Warn($"Could not find any email adresses for provider: {providerId}");
            }

            return(addresses);
        }
示例#2
0
 public void ShouldThrowIfGetUsersResponseIsEmpty()
 {
     Assert.ThrowsAsync <ArgumentException>(() => _sut.GetEmailsAsync(10005143L));
 }
        public async Task ShouldReturnEmpltyListIfResponseIsEmpty()
        {
            var res = await _sut.GetEmailsAsync(10005143L);

            res.Count.ShouldBeEquivalentTo(0);
        }