public void TryGetTopCharts_ShouldInvokePodcastChartsUnitTest(PodHead sut, IPodcastCharts podcastCharts, PodcastGenre podcastGenre, uint limit)
        {
            sut.SetField(typeof(IPodcastCharts), podcastCharts);
            bool success = sut.TryGetTopCharts(podcastGenre, out IEnumerable <PodcastFeed> podcasts, out string errors, limit);

            Assert.IsTrue(success);
            Assert.IsNull(errors);
            podcastCharts.Received(1).GetPodcasts(podcastGenre, limit);
        }
        public void TrySearch_ShouldInvokePodcastSearchUnitTest(PodHead sut, IPodcastSearch podcastSearch, string searchTerm, uint limit)
        {
            sut.SetField(typeof(IPodcastSearch), podcastSearch);
            bool success = sut.TrySearch(searchTerm, out IEnumerable <PodcastFeed> podcasts, out string errors, limit);

            Assert.IsTrue(success);
            Assert.IsNull(errors);
            podcastSearch.Received(1).Search(searchTerm, limit);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieves and Loads Podcast Feeds by Search Term.
        /// In this example the search term happens to be the title of the podcast.
        /// </summary>
        private static void SearchForPodcast(string podcastTitle)
        {
            PodHead podHead = new PodHead();

            //Get a collection of podcast feeds returned by the search. (May throw exceptions).
            IEnumerable <PodcastFeed> podcastFeeds = podHead.Search(podcastTitle, maxNumberOfFeeds: 5);

            //Get the podcast feed that matches the title, and print its data.
            PodcastFeed nprNewsPodcastFeed = podcastFeeds.FirstOrDefault(podcastFeed => podcastFeed.Title == podcastTitle);

            if (nprNewsPodcastFeed != null)
            {
                LoadPodcastEpisodes(nprNewsPodcastFeed);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieves and Loads Podcast Feeds by Search Term.
        /// In this example the search term happens to be the title of the podcast.
        /// </summary>
        private static void TrySearchForPodcast(string podcastTitle)
        {
            PodHead podHead = new PodHead();

            //Get a collection of podcast feeds returned by the search.
            if (podHead.TrySearch(podcastTitle, out IEnumerable <PodcastFeed> podcastFeeds, out string errorMessage, maxNumberOfFeeds: 5))
            {
                //Get the podcast feed that matches the title, and print its data.
                PodcastFeed podcastFeed = podcastFeeds.FirstOrDefault(feed => feed.Title == podcastTitle);
                if (podcastFeed != null)
                {
                    LoadPodcastEpisodes(podcastFeed);
                    //Download latest episode
                    DownloadEpisode(podcastFeed.PodcastEpisodes.First());
                }
            }
Exemplo n.º 5
0
 public void SetUp()
 {
     _podHead = new PodHead();
 }
 public void GetTopCharts_ShouldInvokePodcastChartsUnitTest(PodHead sut, IPodcastCharts podcastCharts, PodcastGenre podcastGenre, uint limit)
 {
     sut.SetField(typeof(IPodcastCharts), podcastCharts);
     sut.GetTopCharts(podcastGenre, limit);
     podcastCharts.Received(1).GetPodcasts(podcastGenre, limit);
 }
 public void Search_ShouldInvokePodcastSearchUnitTest(PodHead sut, IPodcastSearch podcastSearch, string searchTerm, uint limit)
 {
     sut.SetField(typeof(IPodcastSearch), podcastSearch);
     sut.Search(searchTerm, limit);
     podcastSearch.Received(1).Search(searchTerm, limit);
 }