public async void ShouldReplaceAPlaylistsTracks() { await SetupCredentials(); //First create a new playlist Playlist p = await Endpoints.CreateAPlaylist(Creds.Access_token, CurrentUserId, "Test Replacement"); //Then Add songs in a certain order RegularError AddTrackError = await Endpoints.AddTracksToPlaylist(Creds.Access_token, CurrentUserId, p.Id, TrackUris); Assert.False(AddTrackError.WasError, "Failed to add tracks to playlist"); //Then remove every song RegularError ReorderError = await Endpoints.ReplacePlaylistTracks(Creds.Access_token, CurrentUserId, p.Id, new List <string>() { "spotify:track:1TG5DvegcKAJOuKmKCKOIU" }); //Should have only Over You in it Assert.False(ReorderError.WasError, "Failed to issue reorder command at first"); //Then check the reorder Paging <PlaylistTrack> page = await Endpoints.GetAPlaylistsTracks(Creds.Access_token, CurrentUserId, p.Id); Assert.True(page.Total == 1, $"Expected there to be 1 item, but playlist still has {TrackUris.Count}."); //Test for clearing the list ReorderError = await Endpoints.ReplacePlaylistTracks(Creds.Access_token, CurrentUserId, p.Id, new List <string>()); //Should now be empty Assert.False(ReorderError.WasError, "Failed to issue replace command at second"); //Then check the reorder page = await Endpoints.GetAPlaylistsTracks(Creds.Access_token, CurrentUserId, p.Id); Assert.True(page.Total == 0, $"Expected there to be no items, but playlist still has {TrackUris.Count}."); //Then unfollow the playlist await Endpoints.UnfollowAPlaylist(Creds.Access_token, CurrentUserId, p.Id); }
public async void ShouldAddSongsToPlaylist() { await SetupCredentials(); string pid = "58g0qfBM60xjsJadLkzumx"; List <string> uris = new List <string>() { "spotify:track:7rXhnFjG74YKMgq0R89Bpz" }; RegularError res = await Endpoints.AddTracksToPlaylist(Creds.Access_token, CurrentUserId, pid, uris); Assert.False(res.WasError, "Object Error"); }
public async void ShouldReorderAPlaylistsTracks() { await SetupCredentials(); //First create a new playlist Playlist p = await Endpoints.CreateAPlaylist(Creds.Access_token, CurrentUserId, "Test Reordering"); //Then Add songs in a certain order RegularError AddTrackError = await Endpoints.AddTracksToPlaylist(Creds.Access_token, CurrentUserId, p.Id, TrackUris); Assert.False(AddTrackError.WasError, "Failed to add tracks to playlist"); //Then reorder RegularError ReorderError = await Endpoints.ReorderPlaylistsTracks(Creds.Access_token, CurrentUserId, p.Id, 0, 3); //Should move Papi to end Assert.False(ReorderError.WasError, "Failed to issue reorder command"); //Then check the reorder Paging <PlaylistTrack> page = await Endpoints.GetAPlaylistsTracks(Creds.Access_token, CurrentUserId, p.Id); Assert.True(page.Items[0].Track.Uri.Equals(TrackUris[1]), "Expected the uris to be different."); Assert.True(page.Items[1].Track.Uri.Equals(TrackUris[2]), "Expected the uris to be different."); Assert.True(page.Items[2].Track.Uri.Equals(TrackUris[0]), "Expected the uris to be different."); //Then unfollow the playlist await Endpoints.UnfollowAPlaylist(Creds.Access_token, CurrentUserId, p.Id); }