Ejemplo n.º 1
0
        private async void MoreItemsRequest()
        {
            try
            {
                IsBusy              = true;
                HasErrors           = false;
                NoItems             = false;
                DataProviderRawData = string.Empty;
                Items.Clear();

                var items = await bingDataProvider.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;
            }
        }
Ejemplo n.º 2
0
        private async void GetMoreItems()
        {
            var items = await _bingDataProvider.LoadMoreDataAsync();

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Ejemplo n.º 3
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());
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
0
        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());

        }
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 7
0
 public override async Task <IEnumerable <BingSchema> > GetNextPageAsync()
 {
     return(await _dataProvider.LoadMoreDataAsync());
 }