using System.Threading; using System.Threading.Tasks; using Moq; using NUnit.Framework; using SpotifyAPI.Web.Http; namespace SpotifyAPI.Web { [TestFixture] public class UserProfileClientTest { [Test] public async Task Current() { var api = new Mock(); var client = new UserProfileClient(api.Object); await client.Current(); api.Verify(a => a.Get(SpotifyUrls.Me(), It.IsAny()), Times.Once); } [Test] public async Task Get() { var userId = "johnnycrazy"; var api = new Mock(); var client = new UserProfileClient(api.Object); await client.Get(userId); api.Verify(a => a.Get(SpotifyUrls.User(userId), It.IsAny()), Times.Once); } [Test] public async Task GetTopTracks() { var request = new UsersTopItemsRequest(TimeRange.LongTerm); var api = new Mock(); var client = new UserProfileClient(api.Object); var res = await client.GetTopTracks(request); api.Verify(a => a.Get(SpotifyUrls.TopTracks(), request.BuildQueryParams(), It.IsAny()), Times.Once); } [Test] public async Task GetTopArtists() { var request = new UsersTopItemsRequest(TimeRange.LongTerm); var api = new Mock(); var client = new UserProfileClient(api.Object); await client.GetTopArtists(request); api.Verify(a => a.Get(SpotifyUrls.TopArtists(), request.BuildQueryParams(), It.IsAny()), Times.Once); } } }