Skip to content

Instantly share code, notes, and snippets.

@biac
Created Dec 6, 2011
Embed
What would you like to do?
FeedReader: 非同期実行中の例外をシミュレートする仕掛け
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