public async Task FetchAsyncEmptyUrl() { var downloader = new FeedDownloader(_folder); var feedInfo = new FeedInfo { Name = "Doesn't exist", Url = "" }; SyndicationFeed feed = await downloader.DownloadAsync(feedInfo, false); Assert.IsNull(feed); }
public async Task FetchAsyncInvalidRss() { var downloader = new FeedDownloader(_folder); var feedInfo = new FeedInfo { Name = "Doesn't exist", Url = "https://example.com" }; SyndicationFeed feed = await downloader.DownloadAsync(feedInfo, false); Assert.IsNull(feed); }
public async Task FetchAsyncOnline(string name, string url) { var downloader = new FeedDownloader(_folder); var feedInfo = new FeedInfo { Name = name, Url = url }; SyndicationFeed feed = await downloader.DownloadAsync(feedInfo, false); Assert.IsTrue(feed.Items.Count() > 0); }
public async Task FetchAsyncFromCache() { var downloader = new FeedDownloader(_folder); var feedInfo = new FeedInfo { Name = "Visual Studio Blog", Url = "https://devblogs.microsoft.com/visualstudio/rss" }; _ = await downloader.DownloadAsync(feedInfo, false); var file = Path.Combine(_folder, feedInfo.Name + ".xml"); DateTime lastModified = File.GetLastWriteTime(file); _ = await downloader.DownloadAsync(feedInfo, false); DateTime lastModified2 = File.GetLastWriteTime(file); Assert.AreEqual(lastModified, lastModified2); }
protected override void When() { Feed = FeedDownloader.DownloadFeed(PodcastFeedFormat.RSS, Address, "fred"); }
public RssListView() : base("RssListView", null) { _items = new List <NewsItem>(); _feedDownloader = new FeedDownloader(_items); }
private static void SetupServices(IConfigurationRoot configuration) { m_FeedDownloader = new FeedDownloader(); m_WebScraper = new WebScraper(); m_ContentAnalyzer = new ContentAnalyzer(configuration["CognitiveServicesKeys:TextAnalyticsAPI"], configuration["CognitiveServicesKeys:VisionAPI"], configuration["CognitiveServicesKeys:VideoIndexerAPI"]); }
public void IssueWebRequest_should_request_resource_stream_with_iTunes_user_agent() { // Arrange var subjectUnderTest = new FeedDownloader(new ITunesOnlyDictionaryResourceAccessor(_resources)); var state = _downloadFeedState; // Act var response = subjectUnderTest.IssueWebRequest(state); // Assert response.FeedResponse.Should().Be(EmptyResource); }