예제 #1
0
        public void GetActualSong()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null);
            SongToPlay song2 = CreateViewModel.SongToPlay(null, true);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);

            Assert.AreEqual(song2, playList.ActualSong);
        }
        public void GetActualSong()
        {
            SongToPlay song1 = new SongToPlay();
            SongToPlay song2 = new SongToPlay {IsPlaying = true};
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);

            Assert.AreEqual(song2, playList.ActualSong);
        }
        public void Clear()
        {
            PlayList playList = new PlayList();
            Song song = Create.Song();

            playList.AddSongs(new ObservableCollection<Song> { song });
            playList.Clear();

            Assert.AreEqual(0, playList.OriginalSongs.Count);
            Assert.AreEqual(0, playList.SongsToPlay.Count);
        }
 public PlayListViewModel()
 {
     PlayList = new PlayList();
     PlayerObserver.AddToPlayList += delegate(ObservableCollection<Song> songs)
         {
             PlayList.AddSongs(songs);
             PlayList.Mix();
         };
     PlayerObserver.CurrentSongFinished += OnCurrentSongFinished;
     PlayerState = State.Stop;
 }
예제 #5
0
        public void GetFirst()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null);
            SongToPlay song2 = CreateViewModel.SongToPlay(null);
            SongToPlay song3 = CreateViewModel.SongToPlay(null);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.OriginalSongs.Add(song3);

            Assert.AreEqual(song1, playList.GetFirst());
        }
        public void AddSong()
        {
            PlayList playList = new PlayList();
            Song song = Create.Song();

            playList.AddSongs(new ObservableCollection<Song>{song});

            Assert.AreEqual(1, playList.OriginalSongs.Count);
            Assert.AreEqual(1, playList.SongsToPlay.Count);
            CollectionAssert.Contains(playList.OriginalSongs.Select(sts => sts.Song).ToList(), song );
            CollectionAssert.Contains(playList.SongsToPlay.Select(stt => stt.Song).ToList(), song );
        }
        public void GetFirst()
        {
            SongToPlay song1 = new SongToPlay();
            SongToPlay song2 = new SongToPlay();
            SongToPlay song3 = new SongToPlay();
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.OriginalSongs.Add(song3);

            Assert.AreEqual(song1, playList.GetFirst());
        }
예제 #8
0
        public void ResetAllSongs()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null, false, true);
            SongToPlay song2 = CreateViewModel.SongToPlay(null);
            SongToPlay song3 = CreateViewModel.SongToPlay(null, true, true);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            playList.ResetAllSongs();

            Assert.IsFalse(song1.Played);
            Assert.IsFalse(song2.Played);
            Assert.IsFalse(song3.Played);
            Assert.IsFalse(song1.IsPlaying);
            Assert.IsFalse(song2.IsPlaying);
            Assert.IsFalse(song3.IsPlaying);
        }
        public void GetPreviousSong()
        {
            SongToPlay song1 = new SongToPlay();
            SongToPlay song2 = new SongToPlay { IsPlaying = true };
            SongToPlay song3 = new SongToPlay();
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            Assert.AreEqual(song1, playList.GetPreviousSong());
        }
예제 #10
0
        public void GetPreviousSong()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null);
            SongToPlay song2 = CreateViewModel.SongToPlay(null, true);
            SongToPlay song3 = CreateViewModel.SongToPlay(null);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            Assert.AreEqual(song1, playList.GetPreviousSong());
        }
예제 #11
0
        public void SayIfItTheFirstThatIsPlaying()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null, true, true);
            SongToPlay song2 = CreateViewModel.SongToPlay(null);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);

            Assert.IsTrue(playList.PlayingTheFirst);
        }
        public void ReturnNullIfTheyAreNoSongOnPlayingMode()
        {
            SongToPlay song1 = new SongToPlay();
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);

            Assert.IsNull(playList.ActualSong);
        }
        public void SayIfItTheFirstThatIsPlaying()
        {
            SongToPlay song1 = new SongToPlay(){IsPlaying = true, Played = true};
            SongToPlay song2 = new SongToPlay();
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);

            Assert.IsTrue(playList.PlayingTheFirst);
        }
        public void ReturnIsEmpty()
        {
            Song song1 = Create.Song();
            PlayList playList = new PlayList();

            Assert.IsTrue(playList.IsEmpty);

            playList.AddSongs(new ObservableCollection<Song> { song1});

            Assert.IsFalse(playList.IsEmpty);
        }
        public void ReturnIsFinished()
        {
            SongToPlay song1 = new SongToPlay { Played = true };
            SongToPlay song2 = new SongToPlay();
            SongToPlay song3 = new SongToPlay { Played = true};
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            Assert.IsFalse(playList.IsFinished);

            song3.IsPlaying = true;

            Assert.IsTrue(playList.IsFinished);
        }
예제 #16
0
        public void ReturnIsFinished()
        {
            SongToPlay song1 = CreateViewModel.SongToPlay(null, false, true);
            SongToPlay song2 = CreateViewModel.SongToPlay(null);
            SongToPlay song3 = CreateViewModel.SongToPlay(null, false, true);
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            Assert.IsFalse(playList.IsFinished);

            song3.IsPlaying = true;

            Assert.IsTrue(playList.IsFinished);
        }
        public void RestaureCollection()
        {
            Song song1 = Create.Song();
            Song song2 = Create.Song();
            Song song3 = Create.Song();
            PlayList playList = new PlayList();
            playList.AddSongs(new ObservableCollection<Song>{ song1, song2, song3});

            playList.Mix();
            playList.Restaure();

            Assert.AreEqual(playList.SongsToPlay[0], playList.OriginalSongs[0]);
            Assert.AreEqual(playList.SongsToPlay[1], playList.OriginalSongs[1]);
            Assert.AreEqual(playList.SongsToPlay[2], playList.OriginalSongs[2]);
        }
        public void ResetAllSongs()
        {
            SongToPlay song1 = new SongToPlay {Played = true};
            SongToPlay song2 = new SongToPlay ();
            SongToPlay song3 = new SongToPlay {Played = true, IsPlaying = true};
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            playList.ResetAllSongs();

            Assert.IsFalse(song1.Played);
            Assert.IsFalse(song2.Played);
            Assert.IsFalse(song3.Played);
            Assert.IsFalse(song1.IsPlaying);
            Assert.IsFalse(song2.IsPlaying);
            Assert.IsFalse(song3.IsPlaying);
        }
 public void InstantiateCorrectly()
 {
     PlayList playList = new PlayList();
     Assert.AreEqual(0, playList.OriginalSongs.Count);
     Assert.AreEqual(0, playList.SongsToPlay.Count);
 }
        public void GetTheLast()
        {
            SongToPlay song1 = new SongToPlay ();
            SongToPlay song2 = new SongToPlay();
            SongToPlay song3 = new SongToPlay();
            PlayList playList = new PlayList();
            playList.SongsToPlay.Add(song1);
            playList.SongsToPlay.Add(song2);
            playList.SongsToPlay.Add(song3);

            Assert.AreEqual(song3, playList.GetLast());
        }