public HttpResponseMessage GetByGenre(string genre)
        {
            var songsByGenre = playlist.GetByGenre(genre);

            logger.Info("Retrieving list of songs of genre " + genre);

            return(this.Request.CreateResponse(HttpStatusCode.OK, songsByGenre));
        }
 /// <summary>
 /// Get all songs belonging to a certain genre.
 /// </summary>
 /// <param name="genre">The genre to query by.</param>
 /// <returns>A list of songs with matching genres.</returns>
 public List <Song> GetSongsByGenre(string genre)
 {
     try
     {
         return(playlist.GetByGenre(genre));
     }
     catch (Exception e)
     {
         logger.Error(e.ToString());
         System.Diagnostics.Trace.Write(e.ToString());
         return(new List <Song>());
     }
 }
        public void GetSongsByGenre()
        {
            var secondPopSongId =
                musicPlaylist.Add(new RegisterSongRequest("::new-artist::", "::title::", new List <string>()
            {
                "POP", "ROCK"
            }));
            var possibleSecondPopSong = musicPlaylist.GetById(secondPopSongId);

            var savedSongId  = musicPlaylist.Add(_registerSongRequest);
            var possibleSong = musicPlaylist.GetById(savedSongId);

            var songList = musicPlaylist.GetByGenre("pop");

            var expectedList = new List <Song>()
            {
                possibleSecondPopSong.Value, possibleSong.Value
            };

            Assert.IsTrue(songList.Contains(expectedList[0]));
            Assert.IsTrue(songList.Contains(expectedList[1]));
        }