示例#1
0
        /// <summary>
        /// Constructs the episode.
        /// </summary>
        /// <param name="id">The id of the episode.</param>
        /// <param name="date">The date of the episode.</param>
        /// <param name="title">The title of the episode.</param>
        /// <param name="description">The description.</param>
        /// <param name="mediaUrl">The media URL.</param>
        /// <param name="podCast">The pod cast.</param>
        /// <param name="pendingDownload">if set to <c>true</c> [pending download].</param>
        /// <returns>The episode.</returns>
        /// <exception cref="Uncas.PodCastPlayer.Model.ModelException"></exception>
        public static Episode ConstructEpisode(
            string id,
            DateTime date,
            string title,
            string description,
            Uri mediaUrl,
            PodCast podCast,
            bool pendingDownload)
        {
            if (mediaUrl == null)
            {
                throw new ModelException("MediaUrl is required");
            }

            var result =
                new Episode(
                    id,
                    date,
                    title,
                    description);

            result.PodCast         = podCast;
            result.MediaUrl        = mediaUrl;
            result.PendingDownload = pendingDownload;
            return(result);
        }
        public void DownloadEpisodeList_Blog_NoEnclosures()
        {
            // Arrange:
            var podCast =
                new PodCast(
                    1,
                    "hanselman.com",
                    new Uri("http://feeds.feedburner.com/ScottHanselman"));

            // Act:
            var episodes =
                this.downloader.DownloadEpisodeList(
                podCast);

            // Assert:
        }
        public void DownloadEpisodeList_Fake_OK()
        {
            // Arrange:
            PodCast podCast =
                new PodCast(
                1,
                "test",
                new System.Uri("http://fake.uncas.dk"));

            // Act:
            var episodes =
                this.downloader.DownloadEpisodeList(
                podCast);

            // Assert:
            Assert.IsTrue(podCast.Episodes.Count <= episodes.Count);
        }
示例#4
0
        public void PodCast0()
        {
            string name = "Hanselminutes";
            Uri url
                = new Uri(
                    "http://feeds.feedburner.com/HanselminutesCompleteMP3");

            // Testing:
            var podcast
                = new PodCast(
                    1,
                    name,
                    url);

            // Asserting:
            Assert.AreEqual(name, podcast.Name);
            Assert.AreEqual(url, podcast.Url);
            Trace.Write(podcast.ToString());
        }
        public void DownloadEpisodeList_Hanselminutes_OK()
        {
            // Arrange:
            var podCast =
                new PodCast(
                    1,
                    "hanselminutes",
                    GetUri());

            // Act:
            var episodes =
                this.downloader.DownloadEpisodeList(
                podCast);

            // Assert:
            Assert.IsTrue(0 < episodes.Count);
            foreach (var episode in episodes)
            {
                Trace.WriteLine(episode.ToString());
                Trace.WriteLine("---");
            }
        }
        public void SavePodCast_NonExisting_OK()
        {
            // Arrange:
            var podCast = new PodCast(
                null,
                "x",
                new Uri("http://test.dxxxxx"),
                "x",
                "x");

            // Act:
            this.PodCastRepository.SavePodCast(podCast);

            // Assert:
            Assert.IsNotNull(podCast.Id);
        }