当前位置: 首页>>代码示例>>C#>>正文


C# Feed.GetHeadChunk方法代码示例

本文整理汇总了C#中Feed.GetHeadChunk方法的典型用法代码示例。如果您正苦于以下问题:C# Feed.GetHeadChunk方法的具体用法?C# Feed.GetHeadChunk怎么用?C# Feed.GetHeadChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feed的用法示例。


在下文中一共展示了Feed.GetHeadChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadArticles

 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"));
 }
开发者ID:dhasenan,项目名称:pierce,代码行数:30,代码来源:ReadAtomTest.cs

示例2: Article

 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)));
 }
开发者ID:dhasenan,项目名称:pierce,代码行数:27,代码来源:ReadRssTest.cs


注:本文中的Feed.GetHeadChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。