예제 #1
0
        public async Task TestVideos_Sorting()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = "windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            IEnumerable <YouTubeSchema> moreResult = await dataProvider.LoadMoreDataAsync();

            config = new YouTubeDataConfig
            {
                QueryType           = YouTubeQueryType.Videos,
                Query               = "windows app studio",
                SearchVideosOrderBy = YouTubeSearchOrderBy.Date
            };
            var sortingDataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> sortedResult = await sortingDataProvider.LoadDataAsync(config);

            IEnumerable <YouTubeSchema> moreSortedResult = await sortingDataProvider.LoadMoreDataAsync();


            Assert.AreNotEqual(result.FirstOrDefault().Title, sortedResult.FirstOrDefault().Title, "LoadDataAsync: YouTube sorting is not working");
            Assert.AreNotEqual(moreResult.FirstOrDefault().Title, moreSortedResult.FirstOrDefault().Title, "LoadMoreDataAsync: YouTube sorting is not working");
        }
 public Section7Section()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = Vault.YouTube
     });
 }
예제 #3
0
 public Season7Section()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = "AIzaSyD4IQJU9vG5cZDyBfx1swrAzwgsy-wMnEY"
     });
 }
 public ScorpIliskilerSection()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = "AIzaSyDqtZQEkgGKFhInigm_VVmEkRJ0FXePQu4"
     });
 }
예제 #5
0
 public YouTubeSection()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = "xxxxx"                //use your own key beginners learn more here https://appstudio.windows.com/fr-fr/home/howto#twitter //
     });
 }
예제 #6
0
 public InterestingVideosSection()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = "AIzaSyDqpTzCM67LhFABVmWc58_-8s4kxePK9fU"
     });
 }
예제 #7
0
 public Season6Section()
 {
     _dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens
     {
         ApiKey = "AIzaSyCnFTIV-3WRdG7foWvgUhb2Gpus1LjgVS4"
     });
 }
예제 #8
0
        private static int SandboxCode(SandboxOptions options, IServiceProvider serviceProvider)
        {
            var sw = Stopwatch.StartNew();

            var songsRepository        = serviceProvider.GetService <IDeletableEntityRepository <Song> >();
            var songMetadataRepository = serviceProvider.GetService <IDeletableEntityRepository <SongMetadata> >();
            var songsService           = serviceProvider.GetService <ISongsService>();
            var metadataService        = serviceProvider.GetService <ISongMetadataService>();
            var provider                 = new Top40ChartsDataProvider();
            var splitter                 = new SongNameSplitter();
            var youTubeDataProvider      = new YouTubeDataProvider();
            var lyricsPluginDataProvider = new LyricsPluginDataProvider();

            var songIds = songsRepository.All().Select(x => x.Id).ToList();

            for (var index = 0; index < songIds.Count; index++)
            {
                var songId = songIds[index];
                songsService.UpdateSongsSystemDataAsync(songId).GetAwaiter().GetResult();
                if (index % 100 == 0)
                {
                    songsRepository.DetachAll();
                }
            }

            Console.WriteLine(sw.Elapsed);
            return(0);
        }
예제 #9
0
 public async Task TestInvalidOperationLoadChannel()
 {
     var channel      = @"elrubiusOMG";
     var pageSize     = 1;
     var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
     InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreChannelAsync(channel, pageSize));
 }
예제 #10
0
        private void InitializeDataProvider()
        {
            string apiKey = "YourApiKey";

            _youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens {
                ApiKey = apiKey
            });
        }
        private async Task GetYouTubeRefrencesAsync()
        {
            await Task.Factory.StartNew(async() =>
            {
                if (this.YouTubeRefrences.Count != 0 || this.IsBusy)
                {
                    return;
                }

                await System.Windows.Application.Current.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                {
                    this.IsBusy = true;
                }));

                List <BaseSearchResult> results = new List <BaseSearchResult>();
                var youtubeDataProvider         = new YouTubeDataProvider(_fqdn, results, _cancellationToken, true, _domainParser);
                await youtubeDataProvider.LoadMoreItemsAsync(Int32.MaxValue);

                var items = results.Where(x => x.Source.Equals("YouTube"));
                var fdqn  = _fqdn.ToLowerInvariant();

                foreach (var item in items)
                {
                    var domain = item.Domains.FirstOrDefault(x => x.Address.ToLowerInvariant().Equals(fdqn));
                    if (domain != null)
                    {
                        var backRefrence           = new YouTubeBackLink();
                        backRefrence.Source        = "YouTube";
                        backRefrence.SourceAddress = item.SourceAddress;
                        backRefrence.FullAddress   = domain.FullAddress;
                        backRefrence.SearchResult  = (YouTubeSearchResult)item;

                        await System.Windows.Application.Current.Dispatcher.BeginInvoke(
                            System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                        {
                            this.YouTubeRefrences.Add(backRefrence);
                        }));
                    }
                }

                await System.Windows.Application.Current.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                {
                    this.IsBusy = false;
                    this.IsYouTubeReferencesAvailable = this.YouTubeRefrences.Count > 0 ? true : false;
                    if (this.IsYouTubeReferencesAvailable)
                    {
                        this.IsBackLinkCountVisible = true;
                        this.BackLinkCount          = this.YouTubeRefrences.Count.ToString("N0");
                        TotalVideoViews             = YouTubeRefrences.Select(x => x.SearchResult.ViewCount)
                                                      .Where(x => x.HasValue)
                                                      .Select(x => x.Value)
                                                      .Aggregate((x, y) => x + y);
                    }
                }));
            });
        }
예제 #12
0
 private void InitializeDataProvider()
 {
     youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens {
         ApiKey = ApiKey
     });
     rawDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens {
         ApiKey = ApiKey
     });
 }
예제 #13
0
 public async Task LoadMoreDataInvalidOperationChannel()
 {
     var config = new YouTubeDataConfig
     {
         QueryType = YouTubeQueryType.Channels,
         Query     = @"elrubiusOMG"
     };
     var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
     InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync());
 }
예제 #14
0
 public async Task LoadMoreDataInvalidOperationVideos()
 {
     var config = new YouTubeDataConfig
     {
         QueryType = YouTubeQueryType.Videos,
         Query     = @"windows app studio"
     };
     var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
     InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync());
 }
예제 #15
0
 public async Task LoadMoreDataInvalidOperationPlaylist()
 {
     var config = new YouTubeDataConfig
     {
         QueryType = YouTubeQueryType.Playlist,
         Query     = @"PLB9EA94DACBEC74A9"
     };
     var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
     InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync());
 }
예제 #16
0
        public async Task TestNullOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"lumia"
            };
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(null);

            await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config));
        }
예제 #17
0
        public async Task TestLoadChannel()
        {
            var channel = @"elrubiusOMG";
            var page    = 1;

            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadChannelAsync(channel, page);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #18
0
        public async Task TestRevokedOAuth()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"lumia"
            };

            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeRevokedKeys);

            await ExceptionsAssert.ThrowsAsync <RequestFailedException>(async() => await dataProvider.LoadDataAsync(config));
        }
예제 #19
0
        public async Task TestRevokedOAuth()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"lumia"
            };

            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeRevokedKeys);

            await ExceptionsAssert.ThrowsAsync<RequestFailedException>(async () => await dataProvider.LoadDataAsync(config));
        }
예제 #20
0
        public async Task TestVideos()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #21
0
        public async Task TestChannel()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #22
0
        public async Task TestMaxRecordsVideos()
        {
            int maxRecords = 50;
            var config     = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"Microsoft"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.IsTrue(result.Count() > 20);
        }
예제 #23
0
        public async Task TestPlaylist()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query     = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #24
0
        public async Task TestMaxRecordsPlaylist_Min()
        {
            int maxRecords = 1;
            var config     = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query     = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, result.Count());
        }
예제 #25
0
        public async Task TestMaxRecordsChannels_Min()
        {
            int maxRecords = 1;
            var config     = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query     = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, result.Count());
        }
예제 #26
0
        public async Task TestEmptyOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"lumia"
            };
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens());

            OAuthKeysNotPresentException exception = await ExceptionsAssert.ThrowsAsync <OAuthKeysNotPresentException>(async() => await dataProvider.LoadDataAsync(config));

            Assert.IsTrue(exception.Message.Contains("ApiKey"));
        }
예제 #27
0
        public async Task TestVideos()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #28
0
        public async Task TestChannel()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query     = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #29
0
        public async Task TestPlaylist()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #30
0
        public async Task TestVideos_AllOrderBy()
        {
            var enums = Enum.GetValues(typeof(YouTubeSearchOrderBy)).Cast <YouTubeSearchOrderBy>().Where(x => x != YouTubeSearchOrderBy.None);

            foreach (YouTubeSearchOrderBy orderby in enums)
            {
                var config = new YouTubeDataConfig
                {
                    QueryType           = YouTubeQueryType.Videos,
                    Query               = "windows app studio",
                    SearchVideosOrderBy = orderby
                };
                var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
                IEnumerable <YouTubeSchema> result = await dataProvider.LoadDataAsync(config, 5);
            }
        }
예제 #31
0
        public void TestMethod1()
        {
            string config = @".\config\config.ini";

            YouTubeDataProvider ydp      = new YouTubeDataProvider((new IniFile(config)["API", "key"]));
            Schedule            schedule = new Schedule(config);

            ChannelItem item = new ChannelItem();

            item.Initialize("https://www.youtube.com/channel/UC87o3e14Vh9lQ6BhZXqC6GQ", ydp, schedule);
            item.StartMoniterLiveStatus();

            Thread.Sleep(60000);

            Assert.AreEqual(DateTime.Now, item.LiveData.LastRequestTime);             // 実行結果の確認
        }
예제 #32
0
        private async void Request()
        {
            try
            {
                IsBusy              = true;
                HasErrors           = false;
                NoItems             = false;
                DataProviderRawData = string.Empty;
                Items.Clear();

                var youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens {
                    ApiKey = ApiKey
                });
                var config = new YouTubeDataConfig
                {
                    Query     = YouTubeQueryParam,
                    QueryType = YouTubeQueryTypeSelectedItem
                };

                var rawParser = new RawParser();
                var rawData   = await youTubeDataProvider.LoadDataAsync(config, MaxRecordsParam, rawParser);

                DataProviderRawData = rawData.FirstOrDefault()?.Raw;

                var items = await youTubeDataProvider.LoadDataAsync(config, MaxRecordsParam);

                NoItems = !items.Any();

                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                DataProviderRawData += ex.Message;
                DataProviderRawData += ex.StackTrace;
                HasErrors            = true;
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #33
0
        public async Task TestInvalidOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"lumia"
            };

            var tokens = new YouTubeOAuthTokens
            {
                ApiKey = "INVALID"
            };

            YouTubeDataProvider dataProvider = new YouTubeDataProvider(tokens);

            RequestFailedException exception = await ExceptionsAssert.ThrowsAsync <RequestFailedException>(async() => await dataProvider.LoadDataAsync(config));

            Assert.IsTrue(exception.Message.Contains("status code 400"));
        }
예제 #34
0
        public async void GetItems()
        {
            string           apiKey     = "YourApiKey";
            string           queryParam = "PLZCHH_4VqpRjpQP36-XM1jb1E_JIxJZFJ";
            YouTubeQueryType queryType  = YouTubeQueryType.Playlist;
            int maxRecordsParam         = 20;

            this.Items = new ObservableCollection <object>();
            var _youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens {
                ApiKey = apiKey
            });
            var config = new YouTubeDataConfig
            {
                Query     = queryParam,
                QueryType = queryType
            };

            var items = await _youTubeDataProvider.LoadDataAsync(config, maxRecordsParam);

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
예제 #35
0
        public async Task TestNullOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"lumia"
            };
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(null);

            await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config));
        }
예제 #36
0
        public async Task TestEmptyOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"lumia"
            };
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens());

            OAuthKeysNotPresentException exception = await ExceptionsAssert.ThrowsAsync<OAuthKeysNotPresentException>(async () => await dataProvider.LoadDataAsync(config));
            Assert.IsTrue(exception.Message.Contains("ApiKey"));
        }
예제 #37
0
        public async Task TestInvalidOAuth()
        {
            YouTubeDataConfig config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"lumia"
            };

            var tokens = new YouTubeOAuthTokens
            {
                ApiKey = "INVALID"
            };

            YouTubeDataProvider dataProvider = new YouTubeDataProvider(tokens);

            RequestFailedException exception = await ExceptionsAssert.ThrowsAsync<RequestFailedException>(async () => await dataProvider.LoadDataAsync(config));
            Assert.IsTrue(exception.Message.Contains("status code 400"));
        }
예제 #38
0
        public async Task TestNullConfig()
        {
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens());

            await ExceptionsAssert.ThrowsAsync<ConfigNullException>(async () => await dataProvider.LoadDataAsync(null));
        }
예제 #39
0
        public async Task TestMaxRecordsChannels_Min()
        {
            int maxRecords = 1;
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, result.Count());
        }
예제 #40
0
 private void InitializeDataProvider()
 {
     string apiKey = "YourApiKey";
     _youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens { ApiKey = apiKey });
 }
예제 #41
0
        public async Task TestVideos_Sorting()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = "windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config);
            IEnumerable<YouTubeSchema> moreResult = await dataProvider.LoadMoreDataAsync();

            config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = "windows app studio",
                SearchVideosOrderBy = YouTubeSearchOrderBy.Date
            };
            var sortingDataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> sortedResult = await sortingDataProvider.LoadDataAsync(config);
            IEnumerable<YouTubeSchema> moreSortedResult = await sortingDataProvider.LoadMoreDataAsync();


            Assert.AreNotEqual(result.FirstOrDefault().Title, sortedResult.FirstOrDefault().Title, "LoadDataAsync: YouTube sorting is not working");
            Assert.AreNotEqual(moreResult.FirstOrDefault().Title, moreSortedResult.FirstOrDefault().Title, "LoadMoreDataAsync: YouTube sorting is not working");
        }
예제 #42
0
 public async Task TestInvalidOperationLoadChannel()
 {
     var channel = @"elrubiusOMG";
     var pageSize = 1;
     var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
     InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync<InvalidOperationException>(async () => await dataProvider.LoadMoreChannelAsync(channel, pageSize));
 }
예제 #43
0
        public async Task TestPaginationLoadChannel()
        {
            var channel = @"elrubiusOMG";
            var page = 1;

            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadChannelAsync(channel, page);

            Assert.IsTrue(dataProvider.HasMoreItems);

            IEnumerable<YouTubeSchema> result = await dataProvider.LoadMoreChannelAsync(channel, page);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
예제 #44
0
        public async Task LoadMoreDataInvalidOperationChannel()
        {

            var config = new YouTubeDataConfig
            {

                QueryType = YouTubeQueryType.Channels,
                Query = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync<InvalidOperationException>(async () => await dataProvider.LoadMoreDataAsync());
        }
예제 #45
0
        public async Task TestMaxRecordsVideos()
        {
            int maxRecords = 50;
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"Microsoft"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.IsTrue(result.Count() > 20);
        }
예제 #46
0
        public async Task LoadMoreDataInvalidOperationVideos()
        {

            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync<InvalidOperationException>(async () => await dataProvider.LoadMoreDataAsync());
        }
예제 #47
0
        public async Task LoadMoreDataInvalidOperationPlaylist()
        {

            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync<InvalidOperationException>(async () => await dataProvider.LoadMoreDataAsync());
        }
예제 #48
0
 public async Task TestVideos_AllOrderBy()
 {
     var enums = Enum.GetValues(typeof(YouTubeSearchOrderBy)).Cast<YouTubeSearchOrderBy>().Where(x => x != YouTubeSearchOrderBy.None);
     foreach (YouTubeSearchOrderBy orderby in enums)
     {
         var config = new YouTubeDataConfig
         {
             QueryType = YouTubeQueryType.Videos,
             Query = "windows app studio",
             SearchVideosOrderBy = orderby
         };
         var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
         IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config, 5);              
     }
 }
예제 #49
0
        public async Task TestNullParser()
        {
            YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens());

            await ExceptionsAssert.ThrowsAsync<ParserNullException>(async () => await dataProvider.LoadDataAsync<YouTubeSchema>(new YouTubeDataConfig(), 20, null));
        }
예제 #50
0
 private void InitializeDataProvider()
 {
     youTubeDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens { ApiKey = ApiKey });
     rawDataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens { ApiKey = ApiKey });
 }
예제 #51
0
        public async Task TestMaxRecordsPlaylist_Min()
        {
            int maxRecords = 1;
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            IEnumerable<YouTubeSchema> result = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, result.Count());
        }