Created
December 6, 2011 09:32
-
-
Save biac/1437545 to your computer and use it in GitHub Desktop.
FeedReader: 非同期実行中の例外をシミュレートする仕掛け
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
public class FeedReader | |
{ | |
#if DEBUG | |
public string test__RaiseErrorUrl; | |
public Exception test__RaiseException; | |
#endif | |
// (略) | |
private async Task<FeedData> ReadAsync(Uri feedUri) | |
{ | |
SyndicationClient client = new SyndicationClient() { BypassCacheOnRetrieve = true }; | |
SyndicationFeed feed = await client.RetrieveFeedAsync(feedUri); | |
#if DEBUG | |
if (feedUri.OriginalString == this.test__RaiseErrorUrl) | |
throw this.test__RaiseException; | |
#endif | |
return feed.ToFeedData(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment