Exemplo n.º 1
0
        public void NumberOfSongsInPlayListShouldReturnThree(string title)
        {
            musicPlayer = new MusicPlayer(mediaDb, soundMaker);
            int songsInQueue = musicPlayer.NumSongsInQueue;

            mediaDb.OpenConnection();
            musicPlayer.LoadSongs("Disturbed");
            mediaDb.CloseConnection();
            int presentSongsInQueue = musicPlayer.NumSongsInQueue;

            Assert.That(presentSongsInQueue == 3, "Inga sånger lades till");
        }
Exemplo n.º 2
0
        public void NowPlayingShouldNotChangeIfSongIsAlreadyPlaying(string songTitle1, string songTitle2)
        {
            player = new MusicPlayer(mediaDb, soundDb);
            mediaDb.OpenConnection();
            player.LoadSongs(songTitle1);
            player.LoadSongs(songTitle2);
            mediaDb.CloseConnection();

            // Spelar Stairway to heaven
            player.Play();

            var playing = player.NowPlaying();

            StringAssert.Contains(songTitle1, player.NowPlaying(), "Den borde ju spelas");


            player.Play();

            playing = player.NowPlaying();

            StringAssert.Contains(songTitle1, player.NowPlaying(), "Den borde ju spelas");

            player.Stop();
        }
Exemplo n.º 3
0
        public void IfNoSongIsPlayingStartNext(string search)
        {
            musicPlayer = new MusicPlayer(mediaDb, soundMaker);
            mediaDb.OpenConnection();
            musicPlayer.LoadSongs("Disturbed");
            mediaDb.CloseConnection();

            int    presentSongsInQueue = musicPlayer.NumSongsInQueue;
            string newActual           = "";

            StringAssert.Contains("Tystnad Råder", musicPlayer.NowPlaying(), "Det spelades visst en låt!");
            musicPlayer.Play();
            newActual = musicPlayer.NowPlaying();
            //}
            Assert.Greater(presentSongsInQueue, 0, "No more songs in Playlist");
        }
Exemplo n.º 4
0
        public void NowPlayingShouldBeCurrentSong()
        {
            player = new MusicPlayer(mediaDb, soundDb);
            mediaDb.OpenConnection();

            player.LoadSongs("to");

            mediaDb.CloseConnection();
            player.Play();

            //Jag hade tänkt att hämta defaultSong från musicplayer, men det gick ej då det strider mot Interfacet.
            //Antog att det inte var okej att lägga till en property där, därav upprepningen.

            string actual = player.NowPlaying();

            player.Stop();
            Assert.AreNotEqual(defaultSong, actual, "Tystnad ska ej råda");
        }
Exemplo n.º 5
0
        public void StopThePlayingOfSongButKeepSongList(string search)
        {
            musicPlayer = new MusicPlayer(mediaDb, soundMaker);
            mediaDb.OpenConnection();
            musicPlayer.LoadSongs("Mustasch");
            mediaDb.CloseConnection();

            int presentSongsInQueue = musicPlayer.NumSongsInQueue;

            musicPlayer.Play();
            string actual = musicPlayer.NowPlaying();

            musicPlayer.Stop();
            Assert.AreNotEqual(defaultSong, actual, "Tystnad ska inte råda");

            string newActual = musicPlayer.NowPlaying();

            //}
            Assert.Greater(presentSongsInQueue, 0, "No more songs in Playlist");
        }
Exemplo n.º 6
0
        public void NumberOfSongsInQue()
        {
            player = new MusicPlayer(mediaDb, soundDb);
            int songs = player.NumSongsInQueue;

            Assert.AreEqual(0, songs, "Number of songs does not match");
            mediaDb.OpenConnection();

            player.LoadSongs("to");
            mediaDb.CloseConnection();

            songs = player.NumSongsInQueue;

            Assert.AreEqual(2, songs, "Number of songs does not match");

            player.NextSong();
            player.NextSong();
            songs = player.NumSongsInQueue;

            Assert.That(0, Is.EqualTo(songs), "Number of songs does not match");
        }
Exemplo n.º 7
0
 public void IfDbNotOpenShouldThrowException()
 {
     musicPlayer = new MusicPlayer(mediaDb, soundMaker);
     Assert.Throws <DatabaseClosedException>(() => musicPlayer.LoadSongs("Disturbed"));
 }
Exemplo n.º 8
0
 public void DbNotOpenShouldThrowException()
 {
     player = new MusicPlayer(mediaDb, soundDb);
     Assert.Throws <DatabaseClosedException>(() => player.LoadSongs("to"));
 }