public override async Task <IEnumerable <BingSchema> > GetDataAsync(SchemaBase connectedItem = null) { var config = new BingDataConfig { Country = BingCountry.France, Query = @"college rodin" }; return(await _dataProvider.LoadDataAsync(config, MaxRecords)); }
private async void Request() { try { IsBusy = true; HasErrors = false; NoItems = false; DataProviderRawData = string.Empty; Items.Clear(); var bingDataProvider = new BingDataProvider(); var config = new BingDataConfig() { Query = BingQueryParam, Country = BingCountrySelectedItem }; var rawParser = new RawParser(); var rawData = await bingDataProvider.LoadDataAsync(config, MaxRecordsParam, rawParser); DataProviderRawData = rawData.FirstOrDefault()?.Raw; var items = await bingDataProvider.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 async Task TestNullQueryConfig() { var config = new BingDataConfig { Query = null, Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("Query")); }
public async Task TestMaxRecords() { int maxRecords = 50; var config = new BingDataConfig { Query = "Microsoft", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); IEnumerable <BingSchema> data = await dataProvider.LoadDataAsync(config, maxRecords); Assert.IsTrue(data.Count() > 20); }
public async Task TestMaxRecords_Min() { int maxRecords = 1; var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); IEnumerable <BingSchema> data = await dataProvider.LoadDataAsync(config, maxRecords); Assert.AreEqual(maxRecords, data.Count()); }
public async Task LoadBing() { var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); IEnumerable <BingSchema> data = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(data); Assert.AreNotEqual(data.Count(), 0); }
public async Task LoadBing() { var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); IEnumerable<BingSchema> data = await dataProvider.LoadDataAsync(config); Assert.IsNotNull(data); Assert.AreNotEqual(data.Count(), 0); }
public async void GetItems() { string bingQueryParam = "Windows App Studio"; BingCountry bingCountrySelectedItem = BingCountry.UnitedStates; int maxRecordsParam = 20; _bingDataProvider = new BingDataProvider(); this.Items = new ObservableCollection<object>(); var config = new BingDataConfig() { Query = bingQueryParam, Country = bingCountrySelectedItem }; var items = await _bingDataProvider.LoadDataAsync(config, maxRecordsParam); foreach (var item in items) { Items.Add(item); } }
public async Task LoadPaginationBing() { var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); await dataProvider.LoadDataAsync(config, 20); Assert.IsTrue(dataProvider.HasMoreItems); IEnumerable<BingSchema> result = await dataProvider.LoadMoreDataAsync(); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async Task LoadPaginationBing() { var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); await dataProvider.LoadDataAsync(config, 20); Assert.IsTrue(dataProvider.HasMoreItems); IEnumerable <BingSchema> result = await dataProvider.LoadMoreDataAsync(); Assert.IsNotNull(result); Assert.IsTrue(result.Any()); }
public async void GetItems() { string bingQueryParam = "Windows App Studio"; BingCountry bingCountrySelectedItem = BingCountry.UnitedStates; int maxRecordsParam = 20; Items.Clear(); var bingDataProvider = new BingDataProvider(); var config = new BingDataConfig() { Query = bingQueryParam, Country = bingCountrySelectedItem }; var items = await bingDataProvider.LoadDataAsync(config, maxRecordsParam); foreach (var item in items) { Items.Add(item); } }
public async Task TestNullParser() { var dataProvider = new BingDataProvider(); await ExceptionsAssert.ThrowsAsync <ParserNullException>(async() => await dataProvider.LoadDataAsync <BingSchema>(new BingDataConfig(), 20, null)); }
public async Task TestNullConfig() { var dataProvider = new BingDataProvider(); await ExceptionsAssert.ThrowsAsync <ConfigNullException>(async() => await dataProvider.LoadDataAsync(null)); }
public async Task TestNullQueryConfig() { var config = new BingDataConfig { Query = null, Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config)); Assert.IsTrue(exception.Message.Contains("Query")); }
public async Task TestNullParser() { var dataProvider = new BingDataProvider(); await ExceptionsAssert.ThrowsAsync<ParserNullException>(async () => await dataProvider.LoadDataAsync<BingSchema>(new BingDataConfig(), 20, null)); }
public async Task TestNullConfig() { var dataProvider = new BingDataProvider(); await ExceptionsAssert.ThrowsAsync<ConfigNullException>(async () => await dataProvider.LoadDataAsync(null)); }