Solocast.Services.PodcastService.SavePodcastAsync C# (CSharp) Method

SavePodcastAsync() public method

public SavePodcastAsync ( Podcast podcast ) : System.Threading.Tasks.Task
podcast Podcast
return System.Threading.Tasks.Task
        public async Task SavePodcastAsync(Podcast podcast)
        {
            await storageService.SaveAsync(podcast);
        }

Usage Example

Beispiel #1
0
        public void TestSQLiteStorage()
        {
            var sqliteStorage = new SQLitePodcastService();
            sqliteStorage.Migrate();
            var feedParser = new FeedParserService();
            var podcastService = new PodcastService(feedParser, sqliteStorage, null);

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

            podcastService.SavePodcastAsync(podcast).Wait();
            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]));
            }
        }