mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Fixed a bug where request parameters were not added, related to #461
This commit is contained in:
parent
b2d706219f
commit
87127a51a8
27
SpotifyAPI.Web.Tests/Clients/FollowClientTest.cs
Normal file
27
SpotifyAPI.Web.Tests/Clients/FollowClientTest.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using SpotifyAPI.Web.Http;
|
||||||
|
|
||||||
|
namespace SpotifyAPI.Web.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FollowClientTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task OfCurrentUser_PassesQueryParams()
|
||||||
|
{
|
||||||
|
var api = new Mock<IAPIConnector>();
|
||||||
|
var client = new FollowClient(api.Object);
|
||||||
|
|
||||||
|
var request = new FollowOfCurrentUserRequest(FollowOfCurrentUserRequest.Type.Artist);
|
||||||
|
await client.OfCurrentUser(request);
|
||||||
|
|
||||||
|
api.Verify(a => a.Get<FollowedArtistsResponse>(
|
||||||
|
SpotifyUrls.CurrentUserFollower(),
|
||||||
|
It.Is<Dictionary<string, string>>(val => val.ContainsKey("type"))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -60,14 +60,14 @@ namespace SpotifyAPI.Web
|
|||||||
{
|
{
|
||||||
var request = new FollowOfCurrentUserRequest();
|
var request = new FollowOfCurrentUserRequest();
|
||||||
|
|
||||||
return API.Get<FollowedArtistsResponse>(URLs.CurrentUserFollower(), request.BuildQueryParams());
|
return OfCurrentUser(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<FollowedArtistsResponse> OfCurrentUser(FollowOfCurrentUserRequest request)
|
public Task<FollowedArtistsResponse> OfCurrentUser(FollowOfCurrentUserRequest request)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, nameof(request));
|
Ensure.ArgumentNotNull(request, nameof(request));
|
||||||
|
|
||||||
return API.Get<FollowedArtistsResponse>(URLs.CurrentUserFollower());
|
return API.Get<FollowedArtistsResponse>(URLs.CurrentUserFollower(), request.BuildQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> Unfollow(UnfollowRequest request)
|
public async Task<bool> Unfollow(UnfollowRequest request)
|
||||||
|
@ -28,10 +28,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId)
|
public Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(playlistId, nameof(playlistId));
|
|
||||||
var request = new PlaylistGetItemsRequest();
|
var request = new PlaylistGetItemsRequest();
|
||||||
|
|
||||||
return API.Get<Paging<PlaylistTrack<IPlayableItem>>>(URLs.PlaylistTracks(playlistId), request.BuildQueryParams());
|
return GetItems(playlistId, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId, PlaylistGetItemsRequest request)
|
public Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId, PlaylistGetItemsRequest request)
|
||||||
@ -83,10 +82,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public Task<FullPlaylist> Get(string playlistId)
|
public Task<FullPlaylist> Get(string playlistId)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(playlistId, nameof(playlistId));
|
|
||||||
var request = new PlaylistGetRequest(); // We need some defaults
|
var request = new PlaylistGetRequest(); // We need some defaults
|
||||||
|
|
||||||
return API.Get<FullPlaylist>(URLs.Playlist(playlistId), request.BuildQueryParams());
|
return Get(playlistId, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<FullPlaylist> Get(string playlistId, PlaylistGetRequest request)
|
public Task<FullPlaylist> Get(string playlistId, PlaylistGetRequest request)
|
||||||
|
Loading…
Reference in New Issue
Block a user