public async Task <ApplicationProductList> GetAllProductsAsync() { var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/all"); ApplicationProductList result = await _requestProvider.GetAsync <ApplicationProductList>(uri); _applicationProductList = result; if (Beverages != null) { Beverages.Clear(); CannedGoods.Clear(); Cleaners.Clear(); DryGoods.Clear(); PaperGoods.Clear(); PersonalCare.Clear(); Others.Clear(); } // populate product types foreach (var i in result.Items) { if (i.Type == null) { i.Type = "others"; } switch (i.Type.ToLower()) { case "beverage": Beverages.Add(new ProductModel(i)); break; case "canned goods": CannedGoods.Add(new ProductModel(i)); break; case "cleaners": Cleaners.Add(new ProductModel(i)); break; case "dry goods": DryGoods.Add(new ProductModel(i)); break; case "paper goods": PaperGoods.Add(new ProductModel(i)); break; case "personal care": PersonalCare.Add(new ProductModel(i)); break; default: Others.Add(new ProductModel(i)); break; } } Beverages = SortCategory(_beverages); CannedGoods = SortCategory(_cannedGoods); Cleaners = SortCategory(_cleaners); DryGoods = SortCategory(_dryGoods); PaperGoods = SortCategory(_paperGoods); PersonalCare = SortCategory(_personalCare); Others = SortCategory(_others); return(result); }
public void CleanBasicDataBadParamTest() { // compose basic data Cleaners.ConvertHistoryToBasic(history, "E"); }
public DnsConfig() { _Config = new ConfigurationBuilder() .AddJsonFile("dns.json", optional: false, reloadOnChange: true) .Build(); var serverAliases = _Config.GetSection("serverAliases"); var dnsServers = _Config.GetSection("dnsServers"); var searchDomains = _Config.GetSection("searchDomains"); var hostOverrides = _Config.GetSection("hostOverrides"); var dnsZones = _Config.GetSection("dnsZones"); var fileZones = _Config.GetSection("fileZones"); var blackLists = _Config.GetSection("blackLists"); if (ConfigSectionArray(dnsServers)) { foreach (var dnsServer in dnsServers.GetChildren()) { AddDnsServer(dnsServer.Value); } } else { DnsServers.Add(Cleaners.MakeDnsIPEndPoint(dnsServers.Value)); } if (ConfigSectionArray(searchDomains)) { foreach (var searchDomain in searchDomains.GetChildren()) { AddSearchDomain(searchDomain.Value); } } else { SearchDomains.Add(Cleaners.MakeDnsZoneProper(searchDomains.Value)); } if (ConfigSectionArray(hostOverrides)) { foreach (var hostOverride in hostOverrides.GetChildren()) { AddHostOverride(hostOverride); } } else { AddHostOverride(hostOverrides.GetChildren().First()); } if (ConfigSectionArray(dnsZones)) { foreach (var dnsZone in dnsZones.GetChildren()) { AddDnsZone(dnsZone); } } else { AddDnsZone(dnsZones); } if (ConfigSectionArray(blackLists)) { foreach (var blackList in blackLists.GetChildren()) { AddBlackList(blackList); } } else { AddBlackList(blackLists); } Logger.Info("Configuration file has been loaded"); }
public void NoBasicData() { List <Quote> h = new List <Quote>(); Cleaners.ConvertHistoryToBasic(h); }
public void NoHistory() { List <Quote> badHistory = new List <Quote>(); Cleaners.ValidateHistory(badHistory); }
public void NoBasicData() { List <BasicData> bd = new List <BasicData>(); Cleaners.PrepareBasicData(bd); }
public void NoHistory() { List <Quote> badHistory = new List <Quote>(); Cleaners.PrepareHistory(badHistory); }
public void BadHistoryEmptyTest() { List <Quote> badHistory = new List <Quote>(); Cleaners.PrepareHistory(badHistory); }