public async Task GetPopularItemsAsync() { // var testindex = new[] { 1, 2, 25, 26, 27, 49, 50, 51 }; var testindex = new[] { 2 }; foreach (int i in testindex) { List <VideoItemPOCO> lst = await YouTubeSite.GetPopularItemsAsync("ru", i).ConfigureAwait(false); Assert.AreEqual(lst.Count(), i); } }
public async Task FillPopular(Dictionary <string, string> dic) { if (SelectedCountry.Key == dlindex) { return; } SelectedCountry.Value.Clear(); switch (SelectedSite.Cred.Site) { case SiteType.YouTube: List <VideoItemPOCO> lst = await YouTubeSite.GetPopularItemsAsync(SelectedCountry.Key, 30).ConfigureAwait(true); if (lst.Any()) { foreach (IVideoItem item in lst.Select(poco => VideoItemFactory.CreateVideoItem(poco, SiteType.YouTube))) { item.IsHasLocalFileFound(DirPath); string title; if (dic.TryGetValue(item.ParentID, out title)) { // подсветим видео, если канал уже есть в подписке item.SyncState = SyncState.Added; item.ParentTitle = title; item.WatchState = await db.GetItemWatchStateAsync(item.ID).ConfigureAwait(false); } SelectedCountry.Value.Add(item); } RefreshItems(); } break; } RefreshView("ViewCount"); }