Example #1
0
 public void ReadArticles()
 {
     var feedXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
         "<feed xmlns=\"http://www.w3.org/2005/Atom\">" +
         "  <title>Example Feed</title>" +
         "  <link href=\"http://example.org/\"/>" +
         "  <updated>2003-12-13T18:30:02Z</updated>" +
         "  <author>" +
         "    <name>John Doe</name>" +
         "  </author>" +
         "  <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>" +
         "  <entry>" +
         "    <title>Atom-Powered Robots Run Amok</title>" +
         "    <link href=\"http://example.org/2003/12/13/atom03\"/>" +
         "    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>" +
         "    <published>2003-12-13T18:30:02Z</published>" +
         "    <updated>2004-01-13T18:30:02Z</updated>" +
         "    <summary>Some text.</summary>" +
         "  </entry>" +
         "</feed>";
     var feed = new Feed();
     _target.Read(feed, XDocument.Parse(feedXml));
     Assert.That(feed.GetHeadChunk(null).Articles.Count, Is.EqualTo(1));
     var art = feed.GetHeadChunk(null).Articles.First();
     Assert.That(art.Title, Is.EqualTo("Atom-Powered Robots Run Amok"));
     Assert.That(art.Link, Is.EqualTo(new Uri("http://example.org/2003/12/13/atom03")));
     Assert.That(art.PublishDate, Is.EqualTo(new DateTime(2003, 12, 13, 18, 30, 2)));
     Assert.That(art.Summary, Is.EqualTo("Some text."));
     Assert.That(art.UniqueId, Is.EqualTo("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
 }
Example #2
0
 public void Article()
 {
     var feedText = "<?xml version=\"1.0\" ?>" +
         "<rss version=\"2.0\">" +
         "  <channel>" +
         "    <title>StrongBad!!!1</title>" +
         "    <description>Kangaroo Jack's colby jack</description>" +
         "    <link>http://strongbad.example.org/feed</link>" +
         "    <item>" +
         "      <title>Incredipede</title>" +
         "      <description>This is a multiline sequence possibly containing HTML.</description>" +
         "      <link>https://dignitas.com/team/tamewymild</link>" +
         "      <author>Team Dignitas</author>" +
         "      <pubDate>Sun, 19 May 2002 15:21:36 GMT</pubDate>" +
         "    </item>" +
         "  </channel>" +
         "</rss>";
     var feed = new Feed();
     _target.Read(feed, XDocument.Parse(feedText));
     var article = feed.GetHeadChunk(null).Articles.First();
     Assert.That(article.Title, Is.EqualTo("Incredipede"));
     Assert.That(article.Description, Is.EqualTo("This is a multiline sequence possibly containing HTML."));
     Assert.That(article.Link, Is.EqualTo(new Uri("https://dignitas.com/team/tamewymild")));
     Assert.That(article.Authors.Count, Is.EqualTo(1));
     Assert.That(article.Authors.First().Name, Is.EqualTo("Team Dignitas"));
     Assert.That(article.PublishDate, Is.EqualTo(new DateTime(2002, 5, 19, 15, 21, 36)));
 }