public void DataRepository_SearchSpotifyList_ShouldReturnArtistList() { var sr = new SearchArtistResponse { Artists = new ArtistList() { Items = new List <Artist>() { new Artist() { Id = "1", Name = "Artist 1", Popularity = 50 }, new Artist() { Id = "2", Name = "Artis 2", Popularity = 20 }, } } }; Token Token = new Token { ExpiresIn = 50000, Expires = DateTime.Now.AddHours(8), AccessToken = "ACCESS" }; A.CallTo(() => _tokenService.GetToken()).Returns(Token); A.CallTo(() => _restRequestCreator.CreateRequestSearchArtists(Token)).Returns(new RestRequest("v1/search", Method.GET)); A.CallTo(() => _restMethods.Get <SearchArtistResponse>(A <IRestRequest> ._)).Returns(sr); var al = _sut.SearchSpotifyList(); Assert.IsNotNull(al); Assert.AreEqual("1", al.Artists.Items.FirstOrDefault().Id); }
public SearchArtistResponse SearchSpotifyList() { var spotifySearchArtistResponse = _restMethods.Get <SearchArtistResponse>(_restRequestCreator.CreateRequestSearchArtists(_tokenService.GetToken())); return(spotifySearchArtistResponse); }