private async Task SyncDomainsAsync(DomainsResponse serverDomains) { if (serverDomains == null) { return; } var eqDomains = new List <IEnumerable <string> >(); if (serverDomains.EquivalentDomains != null) { eqDomains.AddRange(serverDomains.EquivalentDomains); } if (serverDomains.GlobalEquivalentDomains != null) { eqDomains.AddRange(serverDomains.GlobalEquivalentDomains.Select(d => d.Domains)); } try { await _settingsRepository.UpsertAsync(new SettingsData { Id = _authService.UserId, EquivalentDomains = JsonConvert.SerializeObject(eqDomains) }); } catch (SQLite.SQLiteException) { } }
private async Task SyncSettingsAsync(string userId, DomainsResponse response) { var eqDomains = new List <List <string> >(); if (response != null && response.EquivalentDomains != null) { eqDomains = eqDomains.Concat(response.EquivalentDomains).ToList(); } if (response != null && response.GlobalEquivalentDomains != null) { foreach (var global in response.GlobalEquivalentDomains) { if (global.Domains.Any()) { eqDomains.Add(global.Domains); } } } await _settingsService.SetEquivalentDomainsAsync(eqDomains); }
public void DomainsResponse() { var response = new DomainsResponse(_jToken); Assert.AreEqual(2, response.Data.Domains.Count); }