Beispiel #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");
        }
Beispiel #2
0
        private async void MoreItemsRequest()
        {
            try
            {
                IsBusy              = true;
                HasErrors           = false;
                NoItems             = false;
                DataProviderRawData = string.Empty;
                Items.Clear();

                var items = await youTubeDataProvider.LoadMoreDataAsync();

                NoItems = !items.Any();

                foreach (var item in items)
                {
                    Items.Add(item);
                }

                var rawData = await rawDataProvider.LoadMoreDataAsync <RawSchema>();

                DataProviderRawData = rawData.FirstOrDefault()?.Raw;
            }
            catch (Exception ex)
            {
                DataProviderRawData += ex.Message;
                DataProviderRawData += ex.StackTrace;
                HasErrors            = true;
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #3
0
        private async void GetMoreItems()
        {
            var items = await _youTubeDataProvider.LoadMoreDataAsync();

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Beispiel #4
0
        public async Task TestPaginationChannel()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query     = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Beispiel #5
0
        public async Task TestPaginationVideos()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query     = @"windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Beispiel #6
0
        public async Task TestPaginationPlaylist()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query     = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
 public override async Task <IEnumerable <YouTubeSchema> > GetNextPageAsync()
 {
     return(await _dataProvider.LoadMoreDataAsync());
 }
Beispiel #8
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");
        }
Beispiel #9
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());
        }
Beispiel #10
0
        public async Task TestPaginationChannel()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Channels,
                Query = @"elrubiusOMG"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Beispiel #11
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());
        }
Beispiel #12
0
        public async Task TestPaginationVideos()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Videos,
                Query = @"windows app studio"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

            IEnumerable<YouTubeSchema> result = await dataProvider.LoadMoreDataAsync();
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Beispiel #13
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());
        }
Beispiel #14
0
        public async Task TestPaginationPlaylist()
        {
            var config = new YouTubeDataConfig
            {
                QueryType = YouTubeQueryType.Playlist,
                Query = @"PLB9EA94DACBEC74A9"
            };
            var dataProvider = new YouTubeDataProvider(OAuthKeys.YouTubeValidKeys);
            await dataProvider.LoadDataAsync(config, 2);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Beispiel #15
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());
 }
Beispiel #16
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());
 }
Beispiel #17
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());
 }