Corrected wrong namespace and implemented example client unit test

This commit is contained in:
Jonas Dellinger 2020-05-18 15:30:18 +02:00
parent 24bb3d345f
commit 934907f39a
5 changed files with 35 additions and 4 deletions

View 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);
}
}
}

View File

@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using SpotifyAPI.Web.Models;
using URLs = SpotifyAPI.Web.SpotifyUrls;
namespace SpotifyAPI.Web

View File

@ -1,5 +1,4 @@
using System.Threading.Tasks;
using SpotifyAPI.Web.Models;
namespace SpotifyAPI.Web
{

View File

@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using SpotifyAPI.Web.Models;
namespace SpotifyAPI.Web
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models
namespace SpotifyAPI.Web
{
public class PrivateUser
{