Inheritance: IFeedParaseService
示例#1
0
        public void RandomTest()
        {
            var feedParser = new FeedParserService();
            var podcast = feedParser.GetPodcastAsync("http://monstercat.com/podcast/feed.xml").Result;

            Assert.AreEqual(true, true);
        }
示例#2
0
        public void TestDownload()
        {
            var localStorage = new LocalPodcastService("podcasts.json");
            var feedParser = new FeedParserService();
            var fileManager = new FileDownloadService();
            var podcastService = new PodcastService(feedParser, localStorage, fileManager);

            var podcastFromService = podcastService.GetPodcastAsync("http://monstercat.com/podcast/feed.xml").Result;
            podcastService.DownloadEpisodeAsync(podcastFromService.Episodes.OrderByDescending(e => e.Published).ToList()[0]).Wait();
        }
示例#3
0
        public void TestLocalStorage()
        {
            var localStorage = new LocalPodcastService("podcasts.json");
            var feedParser = new FeedParserService();
            var podcastService = new PodcastService(feedParser, localStorage, null);

            var podcasts = new List<Podcast>();
            var podcast = podcastService.GetPodcastAsync("http://monstercat.com/podcast/feed.xml").Result;
            podcasts.Add(podcast);

            podcastService.SavePodcastsAsync(podcasts).Wait();

            var podcastsFromStorage = podcastService.GetPodcastsAsync().Result.ToList();
            Assert.AreEqual(podcasts.Count, podcastsFromStorage.Count);

            for (int i = 0; i < podcasts.Count; i++)
            {
                Assert.AreEqual(true, podcasts[i].Equals(podcastsFromStorage[i]));
            }
        }