public async Task SearchItemsAsync() { var testindex = new[] { 5 }; foreach (int i in testindex) { List <VideoItemPOCO> lst = await YouTubeSite.SearchItemsAsync("russia", "RU", i).ConfigureAwait(false); Assert.AreEqual(lst.Count(), i); } }
public async Task Search(Dictionary <string, string> dic) { if (string.IsNullOrEmpty(SearchKey)) { return; } switch (SelectedSite.Cred.Site) { case SiteType.YouTube: if (SelectedCountry.Key == dlindex) { SelectedCountry = Countries.First(); } SelectedCountry.Value.Clear(); List <VideoItemPOCO> lst = await YouTubeSite.SearchItemsAsync(SearchKey, SelectedCountry.Key, 50).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; } }