2022-11-18 11:30:09 +00:00
|
|
|
using System.Threading;
|
2020-05-18 14:30:18 +01:00
|
|
|
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<IAPIConnector>();
|
|
|
|
var client = new UserProfileClient(api.Object);
|
|
|
|
|
|
|
|
await client.Current();
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
api.Verify(a => a.Get<PrivateUser>(SpotifyUrls.Me(), It.IsAny<CancellationToken>()), Times.Once);
|
2020-05-18 14:30:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public async Task Get()
|
|
|
|
{
|
|
|
|
var userId = "johnnycrazy";
|
|
|
|
var api = new Mock<IAPIConnector>();
|
|
|
|
var client = new UserProfileClient(api.Object);
|
|
|
|
|
|
|
|
await client.Get(userId);
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
api.Verify(a => a.Get<PublicUser>(SpotifyUrls.User(userId), It.IsAny<CancellationToken>()), Times.Once);
|
2020-05-18 14:30:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|