mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 06:56:27 +00:00
Corrected wrong namespace and implemented example client unit test
This commit is contained in:
parent
24bb3d345f
commit
934907f39a
34
SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs
Normal file
34
SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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();
|
||||||
|
|
||||||
|
api.Verify(a => a.Get<PrivateUser>(SpotifyUrls.Me()), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Get()
|
||||||
|
{
|
||||||
|
var userId = "johnnycrazy";
|
||||||
|
var api = new Mock<IAPIConnector>();
|
||||||
|
var client = new UserProfileClient(api.Object);
|
||||||
|
|
||||||
|
await client.Get(userId);
|
||||||
|
|
||||||
|
api.Verify(a => a.Get<PublicUser>(SpotifyUrls.User("userId")), Times.Once);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpotifyAPI.Web.Http;
|
using SpotifyAPI.Web.Http;
|
||||||
using SpotifyAPI.Web.Models;
|
|
||||||
using URLs = SpotifyAPI.Web.SpotifyUrls;
|
using URLs = SpotifyAPI.Web.SpotifyUrls;
|
||||||
|
|
||||||
namespace SpotifyAPI.Web
|
namespace SpotifyAPI.Web
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpotifyAPI.Web.Models;
|
|
||||||
|
|
||||||
namespace SpotifyAPI.Web
|
namespace SpotifyAPI.Web
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SpotifyAPI.Web.Http;
|
using SpotifyAPI.Web.Http;
|
||||||
using SpotifyAPI.Web.Models;
|
|
||||||
|
|
||||||
namespace SpotifyAPI.Web
|
namespace SpotifyAPI.Web
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace SpotifyAPI.Web.Models
|
namespace SpotifyAPI.Web
|
||||||
{
|
{
|
||||||
public class PrivateUser
|
public class PrivateUser
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user