public void Initialize() { var http = new HttpClient(); IConfiguration testConfig = TestsHelper.GetLocalConfig(); api = new PlaylistsApi(http); usersApi = new UsersProfileApi(http); }
public void Initialize() { var http = new HttpClient(); IConfiguration testConfig = TestsHelper.GetLocalConfig(); bearerAccessToken = testConfig.GetValue(typeof(string), "SpotifyUserBearerAccessToken").ToString(); var accounts = new AccountsService(http, testConfig); api = new FollowApi(http, accounts); usersApi = new UsersProfileApi(http, accounts); }
public async Task GetUsersProfile_UserId_IdEqualsUserId() { // arrange var http = new HttpClient(); var accounts = new AccountsService(http, TestsHelper.GetLocalConfig()); const string userId = "daniellarsennz"; var api = new UsersProfileApi(http, accounts); // act var response = await api.GetUsersProfile(userId); Assert.AreEqual(userId.ToLower(), response.Id.ToLower()); }
public async Task GetUsersProfile_UserId_EmailIsNull() { // arrange var http = new HttpClient(); var accounts = new AccountsService(http, TestsHelper.GetLocalConfig()); const string userId = "daniellarsennz"; var api = new UsersProfileApi(http, accounts); // act var response = await api.GetUsersProfile(userId); Assert.IsNull(response.Email); }
public async Task GetUsersProfile_NoUserId_DeserializedResponse() { // arrange var config = TestsHelper.GetLocalConfig(); var accessToken = config["SpotifyUserBearerAccessToken"]; var http = new HttpClient(); var accounts = new UserAccountsService(http, config); var api = new UsersProfileApi(http, accounts); // act // must use a User Access Token for this call var response = await api.GetCurrentUsersProfile(accessToken : accessToken); Assert.IsNotNull(response); }