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"); }
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; } }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Videos, Query = @"UCU9L-bCLXEW3tBdeKgqM4nQ/videos", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PL0D0919552167FDA0", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Videos, Query = @"UCoo875FS1OUFcvXDkUgJKhg/videos", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Videos, Query = @"UC_7tE8ya2caKRAdAO1M7H6w/videos", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Videos, Query = @"channel/UC1vjbXkIvjEkL9sW1lTk31Q/videos", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLFI3QY0RfMcjh2brKwwiEdM7hhlFpOoqg", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLNDEdDyEUuMqYVZ73GEd-6dsjvgQFyOBe", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PL6jk7-ujY14QdUy5fZYlfuFOPSdZUMRY1", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLc9NGm66XDpYirHnpR4Wvj9MvBcwKGnt_", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLIPLqGm8fkLrUeprU2QH0M0D4H-3bbNi4", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Channels, Query = @"teletula71", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLnHaBymr53cbbkddkjrBLaRaJgdd7e1eO", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Videos, Query = @"UCAyQ1mYchR0NPIco10lWHiw", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
public override async Task <IEnumerable <YouTubeSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new YouTubeDataConfig { QueryType = YouTubeQueryType.Playlist, Query = @"PLGLfVvz_LVvSX7fVd4OUFp_ODd86H0ZIY", }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
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)); }
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()); }
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()); }
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()); }
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()); }
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); }
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()); }
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()); }
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()); }
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()); }
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); } }
public async void GetItems() { string queryParam = "PLZCHH_4VqpRjpQP36-XM1jb1E_JIxJZFJ"; YouTubeQueryType queryType = YouTubeQueryType.Playlist; int maxRecordsParam = 20; YouTubeSearchOrderBy orderBy = YouTubeSearchOrderBy.None; InitializeDataProvider(); this.Items = new ObservableCollection <object>(); var config = new YouTubeDataConfig { Query = queryParam, QueryType = queryType, SearchVideosOrderBy = orderBy }; var items = await _youTubeDataProvider.LoadDataAsync(config, maxRecordsParam); foreach (var item in items) { Items.Add(item); } }
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); } }
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")); }
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); } }
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 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")); }
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()); }
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); }
public async Task TestNullParser() { YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens()); await ExceptionsAssert.ThrowsAsync <ParserNullException>(async() => await dataProvider.LoadDataAsync <YouTubeSchema>(new YouTubeDataConfig(), 20, null)); }
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")); }
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()); }
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)); }
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)); }
public async Task TestNullConfig() { YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens()); await ExceptionsAssert.ThrowsAsync<ConfigNullException>(async () => await dataProvider.LoadDataAsync(null)); }
public async Task TestNullParser() { YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens()); await ExceptionsAssert.ThrowsAsync<ParserNullException>(async () => await dataProvider.LoadDataAsync<YouTubeSchema>(new YouTubeDataConfig(), 20, null)); }
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")); }
public async Task TestNullConfig() { YouTubeDataProvider dataProvider = new YouTubeDataProvider(new YouTubeOAuthTokens()); await ExceptionsAssert.ThrowsAsync <ConfigNullException>(async() => await dataProvider.LoadDataAsync(null)); }