This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from drago-draganov/dev
Category is omitted when reading RSS Item.
- Loading branch information
Showing
6 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,16 +35,23 @@ public async Task WriteCategory() | |
{ | ||
var sw = new StringWriterWithEncoding(Encoding.UTF8); | ||
|
||
var cat1 = new SyndicationCategory("Test Category 1") { | ||
Scheme = "http://example.com/test" | ||
}; | ||
|
||
var cat2 = new SyndicationCategory("Test Category 2"); | ||
|
||
using (var xmlWriter = XmlWriter.Create(sw)) | ||
{ | ||
var writer = new RssFeedWriter(xmlWriter); | ||
|
||
await writer.Write(new SyndicationCategory("Test Category")); | ||
await writer.Write(cat1); | ||
await writer.Write(cat2); | ||
await writer.Flush(); | ||
} | ||
|
||
string res = sw.ToString(); | ||
Assert.True(res == "<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\"><channel><category>Test Category</category></channel></rss>"); | ||
Assert.True(res == $"<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\"><channel><category domain=\"{cat1.Scheme}\">{cat1.Name}</category><category>{cat2.Name}</category></channel></rss>"); | ||
} | ||
|
||
[Fact] | ||
|
@@ -165,6 +172,8 @@ public async Task WriteItem() | |
|
||
item.AddContributor(new SyndicationPerson("person", "[email protected]")); | ||
|
||
item.AddCategory(new SyndicationCategory("Test Category")); | ||
|
||
// | ||
// Write | ||
var sw = new StringWriterWithEncoding(Encoding.UTF8); | ||
|
@@ -178,7 +187,7 @@ public async Task WriteItem() | |
} | ||
|
||
string res = sw.ToString(); | ||
Assert.True(res == $"<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\"><channel><item><title>First item on ItemWriter</title><link>{url}</link><enclosure url=\"{url}\" length=\"4123\" type=\"audio/mpeg\" /><comments>{url}</comments><source url=\"{url}\">Anonymous Blog</source><guid>{item.Id}</guid><description>Brief description of an item</description><author>[email protected]</author><pubDate>{item.Published.ToRfc1123()}</pubDate></item></channel></rss>", res); | ||
Assert.True(res == $"<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.0\"><channel><item><title>First item on ItemWriter</title><link>{url}</link><enclosure url=\"{url}\" length=\"4123\" type=\"audio/mpeg\" /><comments>{url}</comments><source url=\"{url}\">Anonymous Blog</source><guid>{item.Id}</guid><description>Brief description of an item</description><author>[email protected]</author><category>Test Category</category><pubDate>{item.Published.ToRfc1123()}</pubDate></item></channel></rss>", res); | ||
} | ||
|
||
[Fact] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters