SavePodcastsAsync() public method

public SavePodcastsAsync ( IEnumerable podcasts ) : System.Threading.Tasks.Task
podcasts IEnumerable
return System.Threading.Tasks.Task
Example #1
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]));
            }
        }