public async Task Current() { var api = new Mock <IAPIConnector>(); var client = new UserProfileClient(api.Object); await client.Current(); api.Verify(a => a.Get <PrivateUser>(SpotifyUrls.Me()), Times.Once); }
public async Task Get() { var userId = "johnnycrazy"; var api = new Mock <IAPIConnector>(); var client = new UserProfileClient(api.Object); await client.Get(userId); api.Verify(a => a.Get <PublicUser>(SpotifyUrls.User(userId)), Times.Once); }
public SpotifyClient(SpotifyClientConfig config) { Ensure.ArgumentNotNull(config, nameof(config)); if (config.Authenticator == null) { throw new NullReferenceException("Authenticator in config is null. Please supply it via `WithAuthenticator` or `WithToken`"); } _apiConnector = new APIConnector( config.BaseAddress, config.Authenticator, config.JSONSerializer, config.HTTPClient, config.RetryHandler, config.HTTPLogger ); _apiConnector.ResponseReceived += (sender, response) => { LastResponse = response; }; DefaultPaginator = config.DefaultPaginator; UserProfile = new UserProfileClient(_apiConnector); Browse = new BrowseClient(_apiConnector); Shows = new ShowsClient(_apiConnector); Playlists = new PlaylistsClient(_apiConnector); Search = new SearchClient(_apiConnector); Follow = new FollowClient(_apiConnector); Tracks = new TracksClient(_apiConnector); Player = new PlayerClient(_apiConnector); Albums = new AlbumsClient(_apiConnector); Artists = new ArtistsClient(_apiConnector); Personalization = new PersonalizationClient(_apiConnector); Episodes = new EpisodesClient(_apiConnector); Library = new LibraryClient(_apiConnector); }