Exemplo n.º 1
0
        public async Task LoadRss_RequestFailedException_Apache403()
        {
            var dataProvider = new RssDataProvider();
            IEnumerable <RssSchema> rssItems = null;
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.brunswickcps.org/apps/news/news_rss.jsp?id=0")
            };

            rssItems = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);

            config = new RssDataConfig()
            {
                Url = new Uri("http://www.vicoteka.mk/tvitoteka/feed/")
            };
            rssItems = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);

            config = new RssDataConfig()
            {
                Url = new Uri("http://www.vicoteka.mk/vicovi/vic-na-denot/feed")
            };
            rssItems = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 2
0
        public override async Task <IEnumerable <RssSchema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new RssDataConfig
            {
                Url = new Uri("http://myslo.ru/rss/lenta"),
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
Exemplo n.º 3
0
        public override async Task <IEnumerable <RssSchema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new RssDataConfig
            {
                Url = new Uri("https://github.com/ginkogrudev/Card-Game-Test/commits/master.atom"),
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
Exemplo n.º 4
0
        public override async Task <IEnumerable <RssSchema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new RssDataConfig
            {
                Url = new Uri("https://www.iamydp.cn/feed/"),
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
Exemplo n.º 5
0
        public async Task TestNullUrlConfig()
        {
            var config = new RssDataConfig
            {
                Url = null
            };

            var dataProvider = new RssDataProvider();

            ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync<ConfigParameterNullException>(async () => await dataProvider.LoadDataAsync(config));
            Assert.IsTrue(exception.Message.Contains("Url"));
        }
Exemplo n.º 6
0
        public async Task TestMaxRecords_Min()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };
            var maxRecords = 1;
            var dataProvider = new RssDataProvider();
            IEnumerable<RssSchema> rssItems = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, rssItems.Count());
        }
Exemplo n.º 7
0
        public async Task TestMaxRecords_Min()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };
            var maxRecords   = 1;
            var dataProvider = new RssDataProvider();
            IEnumerable <RssSchema> rssItems = await dataProvider.LoadDataAsync(config, maxRecords);

            Assert.AreEqual(maxRecords, rssItems.Count());
        }
Exemplo n.º 8
0
        public async Task LoadRss()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 9
0
        public async Task LoadRss_Encoding_ISO88591()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://feeds.folha.uol.com.br/colunas/jaimespitzcovsky/rss091.xml")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 10
0
        private async void Request()
        {
            try
            {
                IsBusy              = true;
                HasErrors           = false;
                NoItems             = false;
                DataProviderRawData = string.Empty;
                Items.Clear();
                var rssDataProvider = new RssDataProvider();
                var config          = new RssDataConfig {
                    Url = new Uri(RssQuery, UriKind.Absolute)
                };

                var rawParser = new RawParser();
                var rawData   = await rssDataProvider.LoadDataAsync(config, MaxRecordsParam, rawParser);

                DataProviderRawData = rawData.FirstOrDefault()?.Raw;

                var items = await rssDataProvider.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;
            }
        }
Exemplo n.º 11
0
        public async Task LoadRss()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://blogs.msdn.com/b/windows_app_studio_news/rss.aspx")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 12
0
        public async Task LoadRss_CatalanSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.hacesfalta.org/oportunidades/presencial/buscador/rss.aspx?c=oportunidadesPresenciales_hf&&idPais=60&enfamilia=0&engrupo=0")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Content.Contains("Ã")));
        }
Exemplo n.º 13
0
        public async Task LoadRss_GreekSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("https://www.tuc.gr/754.html?&tx_mmforum_pi1%5Bfid%5D=27")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Title.Contains("Î")));
        }
Exemplo n.º 14
0
        public async Task LoadRss_GermanSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.inforadio.de/nachrichten/index.xml/feed=rss.xml")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Content.Contains("Ã")));
        }
Exemplo n.º 15
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());
        }
Exemplo n.º 16
0
        public async void GetItems()
        {
            string rssQuery        = "http://www.blogger.com/feeds/6781693/posts/default";
            int    maxRecordsParam = 20;

            var rssDataProvider = new RssDataProvider();
            var config          = new RssDataConfig {
                Url = new Uri(rssQuery, UriKind.Absolute)
            };

            var items = await rssDataProvider.LoadDataAsync(config, maxRecordsParam);

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Exemplo n.º 17
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());
        }
Exemplo n.º 18
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");
        }
Exemplo n.º 19
0
        public async void GetItems()
        {
            string rssQuery = "http://www.blogger.com/feeds/6781693/posts/default";
            int maxRecordsParam = 20;
            string orderBy = "PublishDate";
            SortDirection sortDirection = SortDirection.Descending;

            _rssDataProvider = new RssDataProvider();
            this.Items = new ObservableCollection<object>();

            var config = new RssDataConfig
            {
                Url = new Uri(rssQuery, UriKind.Absolute),
                OrderBy = orderBy,
                SortDirection = sortDirection
            };

            var items = await _rssDataProvider.LoadDataAsync(config, maxRecordsParam);
            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Exemplo n.º 20
0
        public async void GetItems()
        {
            string        rssQuery        = "http://www.blogger.com/feeds/6781693/posts/default";
            int           maxRecordsParam = 20;
            string        orderBy         = "PublishDate";
            SortDirection sortDirection   = SortDirection.Descending;

            _rssDataProvider = new RssDataProvider();
            this.Items       = new ObservableCollection <object>();

            var config = new RssDataConfig
            {
                Url           = new Uri(rssQuery, UriKind.Absolute),
                OrderBy       = orderBy,
                SortDirection = sortDirection
            };

            var items = await _rssDataProvider.LoadDataAsync(config, maxRecordsParam);

            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
Exemplo n.º 21
0
        public async Task TestNullParser()
        {
            var dataProvider = new RssDataProvider();

            await ExceptionsAssert.ThrowsAsync <ParserNullException>(async() => await dataProvider.LoadDataAsync <RssSchema>(new RssDataConfig(), 20, null));
        }
Exemplo n.º 22
0
        public async Task TestNullConfig()
        {
            var dataProvider = new RssDataProvider();

            await ExceptionsAssert.ThrowsAsync <ConfigNullException>(async() => await dataProvider.LoadDataAsync(null));
        }
Exemplo n.º 23
0
        public async Task TestNullUrlConfig()
        {
            var config = new RssDataConfig
            {
                Url = null
            };

            var dataProvider = new RssDataProvider();

            ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config));

            Assert.IsTrue(exception.Message.Contains("Url"));
        }
Exemplo n.º 24
0
        public async Task LoadRss_RequestFailedException_Apache403()
        {
            var dataProvider = new RssDataProvider();
            IEnumerable<RssSchema> rssItems = null;
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.brunswickcps.org/apps/news/news_rss.jsp?id=0")
            };
            rssItems = await dataProvider.LoadDataAsync(config);
            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);

            config = new RssDataConfig()
            {
                Url = new Uri("http://www.vicoteka.mk/tvitoteka/feed/")
            };
            rssItems = await dataProvider.LoadDataAsync(config);
            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);

            config = new RssDataConfig()
            {
                Url = new Uri("http://www.vicoteka.mk/vicovi/vic-na-denot/feed")
            };
            rssItems = await dataProvider.LoadDataAsync(config);
            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 25
0
        public async Task TestNullConfig()
        {
            var dataProvider = new RssDataProvider();

            await ExceptionsAssert.ThrowsAsync<ConfigNullException>(async () => await dataProvider.LoadDataAsync(null));
        }
Exemplo n.º 26
0
        public async Task TestNullParser()
        {
            var dataProvider = new RssDataProvider();

            await ExceptionsAssert.ThrowsAsync<ParserNullException>(async () => await dataProvider.LoadDataAsync<RssSchema>(new RssDataConfig(), 20, null));
        }
Exemplo n.º 27
0
        public async Task LoadRss_GermanSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.inforadio.de/nachrichten/index.xml/feed=rss.xml")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Content.Contains("Ã")));
        }
Exemplo n.º 28
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");
        }
Exemplo n.º 29
0
        public async Task LoadRss_Encoding_ISO88591()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://feeds.folha.uol.com.br/colunas/jaimespitzcovsky/rss091.xml")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
        }
Exemplo n.º 30
0
        public async Task LoadRss_CatalanSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("http://www.hacesfalta.org/oportunidades/presencial/buscador/rss.aspx?c=oportunidadesPresenciales_hf&&idPais=60&enfamilia=0&engrupo=0")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Content.Contains("Ã")));
        }
Exemplo n.º 31
0
        public async Task LoadRss_GreekSpecialCharacters()
        {
            var config = new RssDataConfig()
            {
                Url = new Uri("https://www.tuc.gr/754.html?&tx_mmforum_pi1%5Bfid%5D=27")
            };

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

            Assert.IsNotNull(rssItems);
            Assert.AreNotEqual(rssItems.Count(), 0);
            Assert.IsFalse(rssItems.Any(x => x.Title.Contains("Î")));
        }