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)); }
public async Task LoadMoreDataInvalidOperationBing() { var config = new BingDataConfig { Query = "Windows App Studio", Country = BingCountry.UnitedStates }; var dataProvider = new BingDataProvider(); InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync()); }
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 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 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 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); } }
private async void Request() { try { IsBusy = true; HasErrors = false; NoItems = false; DataProviderRawData = string.Empty; Items.Clear(); var config = new BingDataConfig() { Query = BingQueryParam, Country = BingCountrySelectedItem }; var items = await bingDataProvider.LoadDataAsync(config, MaxRecordsParam); NoItems = !items.Any(); foreach (var item in items) { Items.Add(item); } var rawParser = new RawParser(); var rawData = await rawDataProvider.LoadDataAsync(config, MaxRecordsParam, rawParser); DataProviderRawData = rawData.FirstOrDefault()?.Raw; } catch (Exception ex) { DataProviderRawData += ex.Message; DataProviderRawData += ex.StackTrace; HasErrors = true; } finally { IsBusy = false; } }