protected override void Given() { base.Given(); _recommendationResult = new SpotifyRecommendationsResult { Tracks = new List <SpotifyTrack> { new SpotifyTrack { Name = "testName", Id = "000000", Popularity = 1, PreviewUrl = "this is the previewUrl", Type = "type", Uri = "uriuriuri", Artists = new List <SpotifyArtist> { new SpotifyArtist { Name = "Beyonce", Id = "11111" } } } } }; }
public SearchResultVM MapToViewModel(SpotifyRecommendationsResult recommendationResult) { return new SearchResultVM { Tracks = recommendationResult.Tracks.Select(x => new Track { Name = x.Name, Artist = x.Artists?[0].Name, ArtistId = x.Artists?[0].Id, PreviewUrl = x.PreviewUrl, ImageUrl = x.Album?.Images?[0].Url }).Where(x => x.PreviewUrl != null).Take(10).ToList(), }; }