Пример #1
0
        public void RemoveFromPlaylist_AccessModeIsParty_ThrowsInvalidOperationException()
        {
            var songMock = new Mock <Song>("TestPath", AudioType.Mp3, TimeSpan.Zero);

            using (var library = new Library.Library())
            {
                library.ChangeToParty();

                library.AddSongsToPlaylist(new[] { songMock.Object });

                library.RemoveFromPlaylist(new[] { 0 });
            }
        }
Пример #2
0
        public void RemoveFromPlaylist_SongIsPlaying_CurrentPlayerIsStopped()
        {
            var audioPlayerMock = new Mock <AudioPlayer>();

            var songMock = new Mock <Song>("TestPath", AudioType.Mp3, TimeSpan.Zero);

            songMock.Setup(p => p.CreateAudioPlayer()).Returns(audioPlayerMock.Object);

            using (var library = new Library.Library())
            {
                library.AddSongsToPlaylist(new[] { songMock.Object });

                library.PlaySong(0);

                library.RemoveFromPlaylist(new[] { 0 });

                audioPlayerMock.Verify(p => p.Stop(), Times.Once());
            }
        }
Пример #3
0
        public void RemoveFromPlaylist_SongIsPlaying_CurrentPlayerIsStopped()
        {
            var audioPlayerMock = new Mock<AudioPlayer>();

            var songMock = new Mock<Song>("TestPath", AudioType.Mp3, TimeSpan.Zero);
            songMock.Setup(p => p.CreateAudioPlayer()).Returns(audioPlayerMock.Object);

            using (var library = new Library.Library())
            {
                library.AddSongsToPlaylist(new[] { songMock.Object });

                library.PlaySong(0);

                library.RemoveFromPlaylist(new[] { 0 });

                audioPlayerMock.Verify(p => p.Stop(), Times.Once());
            }
        }
Пример #4
0
        public void RemoveFromPlaylist_AccessModeIsParty_ThrowsInvalidOperationException()
        {
            var songMock = new Mock<Song>("TestPath", AudioType.Mp3, TimeSpan.Zero);

            using (var library = new Library.Library())
            {
                library.ChangeToParty();

                library.AddSongsToPlaylist(new[] { songMock.Object });

                library.RemoveFromPlaylist(new[] { 0 });
            }
        }