Пример #1
0
        private async void MoreItemsRequest()
        {
            try
            {
                IsBusy              = true;
                HasErrors           = false;
                NoItems             = false;
                DataProviderRawData = string.Empty;
                Items.Clear();

                var items = await rssDataProvider.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;
            }
        }
Пример #2
0
        private async void GetMoreItems()
        {
            var items = await _rssDataProvider.LoadMoreDataAsync();

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Пример #3
0
        public async Task LoadRss_OrderBy_InvalidProperty()
        {
            var config = new RssDataConfig()
            {
                Url     = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy = "InvalidProperty"
            };

            var dataProvider = new RssDataProvider();
            IEnumerable <RssSchema> rssItems = await dataProvider.LoadDataAsync(config, 5);

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Пример #4
0
        public async Task LoadPaginationRss()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

            var dataProvider = new RssDataProvider();
            await dataProvider.LoadDataAsync(config, 2);

            Assert.IsTrue(dataProvider.HasMoreItems);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Пример #5
0
        public async Task LoadRss_OrderByPublishDate()
        {
            var config = new RssDataConfig()
            {
                Url            = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy        = nameof(RssSchema.PublishDate),
                OrderDirection = SortDirection.Ascending
            };

            var dataProvider = new RssDataProvider();
            IEnumerable <RssSchema> rssItems = await dataProvider.LoadDataAsync(config, 5);

            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadMoreDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadMoreDataAsync: Rss sorting (ascending) is not working");

            config = new RssDataConfig()
            {
                Url            = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy        = nameof(RssSchema.PublishDate),
                OrderDirection = SortDirection.Descending
            };

            dataProvider = new RssDataProvider();
            rssItems     = await dataProvider.LoadDataAsync(config, 5);

            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadMoreDataAsync: Rss sorting (descending) is not working");
            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadMoreDataAsync: Rss sorting (descending) is not working");
        }
Пример #6
0
 public override async Task <IEnumerable <RssSchema> > GetNextPageAsync()
 {
     return(await _dataProvider.LoadMoreDataAsync());
 }
Пример #7
0
        public async Task LoadMoreDataInvalidOperationRss()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

            var dataProvider = new RssDataProvider();
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync<InvalidOperationException>(async () => await dataProvider.LoadMoreDataAsync());
        }
Пример #8
0
        public async Task LoadPaginationRss()
        {

            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

            var dataProvider = new RssDataProvider();
            await dataProvider.LoadDataAsync(config, 2);

            Assert.IsTrue(dataProvider.HasMoreItems);

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

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Any());
        }
Пример #9
0
        public async Task LoadRss_OrderBy_InvalidProperty()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy = "InvalidProperty"                
            };

            var dataProvider = new RssDataProvider();
            IEnumerable<RssSchema> rssItems = await dataProvider.LoadDataAsync(config, 5);

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Пример #10
0
        public async Task LoadRss_OrderByPublishDate()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy = nameof(RssSchema.PublishDate),
                OrderDirection = SortDirection.Ascending
            };

            var dataProvider = new RssDataProvider();
            IEnumerable<RssSchema> rssItems = await dataProvider.LoadDataAsync(config, 5);

            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadMoreDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderBy(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadMoreDataAsync: Rss sorting (ascending) is not working");

            config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx"),
                OrderBy = nameof(RssSchema.PublishDate),
                OrderDirection = SortDirection.Descending
            };

            dataProvider = new RssDataProvider();
            rssItems = await dataProvider.LoadDataAsync(config, 5);

            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");
            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadDataAsync: Rss sorting (ascending) is not working");

            rssItems = await dataProvider.LoadMoreDataAsync();

            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).FirstOrDefault(), rssItems.ToList()[0].PublishDate, "LoadMoreDataAsync: Rss sorting (descending) is not working");
            Assert.AreEqual(rssItems.OrderByDescending(x => x.PublishDate).Select(x => x.PublishDate).LastOrDefault(), rssItems.ToList()[rssItems.Count() - 1].PublishDate, "LoadMoreDataAsync: Rss sorting (descending) is not working");
        }
Пример #11
0
        public async Task LoadMoreDataInvalidOperationRss()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

            var dataProvider = new RssDataProvider();
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync());
        }