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);
        }
Ejemplo n.º 2
0
        public void TrySearchFunctionalTest(PodcastFeed expectedPodcastFeed)
        {
            bool success = _podHead.TrySearch(expectedPodcastFeed.Title, out IEnumerable <PodcastFeed> podcastFeeds, out string errorMessage);

            Assert.IsTrue(success);
            Assert.IsNull(errorMessage);
            PodcastFeed feed = podcastFeeds.FirstOrDefault(p => p.Title == expectedPodcastFeed.Title);

            Assert.IsNotNull(feed);
            expectedPodcastFeed.AssertEqual(feed);
        }
Ejemplo 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 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());
                }
            }