aboutsummaryrefslogtreecommitdiff
path: root/Aggregator/Tests/ParserServiceTests.cs
blob: 99dab421023c3eabd4b05763e06457ef7c641eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Aggregator;
using Classes;
using Xunit;

namespace Aggregator.Tests {
    public class ParserServiceTests {
        private static Config TestConfig = new Config()
        {
            Source = "BBC",
            Title = 0,
            Description = 1,
            ArticleLink = 2,
            ImageLink = 5,
            PublishDate = 4
        };

        [Fact]
        public async void Test_Parse() {
            string xml = await Download.DownloadXML("http://feeds.bbci.co.uk/news/rss.xml");
            List<Article> articles = ParserService.Parse(xml, TestConfig).ToList();
            Assert.True(articles != null);
            Assert.True(articles.Count > 0);
        }
    }
}