Пример #1
0
        public void TestPlayPodcastAlreadyPaused()
        {
            Dictionary <String, String> input = new Dictionary <string, string>
            {
                { "Command", "podcast" },
                { "Subcommand", "playnext" },
                { "Podcast", "Test Podcast" },
            };
            IConfigurationManager configMan = GetConfigurationManager();

            Mock <IMediaFilePlayer> mediaPlayer = new Mock <IMediaFilePlayer>(MockBehavior.Strict);

            mediaPlayer.Setup(s => s.IsValid).Returns(true);
            mediaPlayer.Setup(s => s.CurrentState).Returns(PlayerState.Paused);
            mediaPlayer.Setup(s => s.StopAudioFile());
            mediaPlayer.Setup(s => s.PlayAudioFile("http://www.podtrac.com/pts/redirect.mp3/twit.cachefly.net/audio/tnt/tnt1129/tnt1129.mp3"));
            AddComponentToConfigurationManager(mediaPlayer.Object);

            PodcastInfo info = new PodcastInfo("Test Podcast", new Uri(Directory.GetCurrentDirectory() + "/testRssFeed.xml", UriKind.Absolute), false);

            info.Initialize(configMan);

            CurrentConversation = new PodcastConversation(configMan, new List <PodcastInfo> {
                info
            });

            Assert.AreEqual("", RunSingleConversation <PodcastConversation>(input));

            mediaPlayer.Verify(s => s.CurrentState, Times.Exactly(1));
            mediaPlayer.Verify(s => s.StopAudioFile(), Times.Exactly(1));
            mediaPlayer.Verify(s => s.PlayAudioFile("http://www.podtrac.com/pts/redirect.mp3/twit.cachefly.net/audio/tnt/tnt1129/tnt1129.mp3"), Times.Exactly(1));
        }
Пример #2
0
        public void TestResumePodcastAlreadyStopped()
        {
            Dictionary <String, String> input = new Dictionary <string, string>
            {
                { "Command", "podcast" },
                { "Subcommand", "resume" },
            };
            IConfigurationManager configMan = GetConfigurationManager();

            Mock <IMediaFilePlayer> mediaPlayer = new Mock <IMediaFilePlayer>(MockBehavior.Strict);

            mediaPlayer.Setup(s => s.IsValid).Returns(true);
            mediaPlayer.Setup(s => s.CurrentState).Returns(PlayerState.Stopped);
            AddComponentToConfigurationManager(mediaPlayer.Object);

            PodcastInfo info = new PodcastInfo("Test Podcast", new Uri(Directory.GetCurrentDirectory() + "/testRssFeed.xml", UriKind.Absolute), false);

            info.Initialize(configMan);

            CurrentConversation = new PodcastConversation(configMan, new List <PodcastInfo> {
                info
            });

            Assert.AreEqual("", RunSingleConversation <PodcastConversation>(input));

            mediaPlayer.Verify(s => s.CurrentState, Times.Exactly(1));
        }