Skip to content

Commit 2c44635

Browse files
committed
Start refactoring for version 6
1 parent 22d800d commit 2c44635

106 files changed

Lines changed: 1359 additions & 5930 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.vscode/csharp.code-snippets‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"model": {
3+
"scope": "csharp",
4+
"prefix": "model",
5+
"body": [
6+
"namespace SpotifyAPI.Web",
7+
"{",
8+
" public class $1",
9+
" {",
10+
" public ${2:string} ${3:Name} { get; set; }",
11+
"",
12+
" $4",
13+
" }",
14+
"}"
15+
],
16+
"description": "Creates a new model"
17+
}
18+
}

‎.vscode/settings.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
"editor.detectIndentation": false,
33
"editor.insertSpaces": true,
44
"editor.tabSize": 2,
5-
"csharpfixformat.style.braces.onSameLine": false,
6-
"csharpfixformat.style.spaces.beforeParenthesis": false,
75
}

‎SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0</TargetFrameworks>
4-
3+
<TargetFrameworks>netstandard2.1</TargetFrameworks>
4+
55
<PackageId>SpotifyAPI.Web.Auth</PackageId>
66
<Title>SpotifyAPI.Web.Auth</Title>
77
<Authors>Jonas Dellinger</Authors>
@@ -27,7 +27,7 @@
2727
<DocumentationFile>bin\Release\netstandard2.0\SpotifyAPI.Web.Auth.xml</DocumentationFile>
2828
<NoWarn>1701;1702;1705;1591</NoWarn>
2929
</PropertyGroup>
30-
30+
3131
<ItemGroup>
3232
<PackageReference Include="EmbedIO" Version="2.9.2">
3333
<PrivateAssets>None</PrivateAssets>

‎SpotifyAPI.Web.Tests/SpotifyWebAPITest.cs‎

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using NUnit.Framework;
4+
5+
namespace SpotifyAPI.Web.Tests
6+
{
7+
[TestFixture]
8+
public class Test
9+
{
10+
[Test]
11+
public async Task Testing()
12+
{
13+
var token = "";
14+
15+
var spotify = new SpotifyClient(token);
16+
17+
var categories = await spotify.Browse.GetCategories();
18+
var playlists = await spotify.Browse.GetCategoryPlaylists(categories.Categories.Items[0].Id);
19+
}
20+
}
21+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System.Collections.Generic;
2+
using System;
3+
using NUnit.Framework;
4+
5+
namespace SpotifyAPI.Web.Tests
6+
{
7+
[TestFixture]
8+
public class URIExtensionTest
9+
{
10+
[Test]
11+
public void ApplyParameters_WithoutExistingParameters()
12+
{
13+
var expected = "http://google.com/?hello=world&nice=day";
14+
Uri uri = new Uri("http://google.com/");
15+
16+
var parameters = new Dictionary<string, string>
17+
{
18+
{ "hello", "world" },
19+
{ "nice", "day" }
20+
};
21+
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString());
22+
}
23+
24+
[Test]
25+
public void ApplyParameters_WithExistingParameters()
26+
{
27+
var expected = "http://google.com/?existing=paramter&hello=world&nice=day";
28+
Uri uri = new Uri("http://google.com/?existing=paramter");
29+
30+
var parameters = new Dictionary<string, string>
31+
{
32+
{ "hello", "world" },
33+
{ "nice", "day" }
34+
};
35+
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString());
36+
}
37+
38+
[Test]
39+
public void ApplyParameters_HandlesEscape()
40+
{
41+
var expected = "http://google.com/?existing=paramter&hello=%26world++";
42+
Uri uri = new Uri("http://google.com/?existing=paramter");
43+
44+
var parameters = new Dictionary<string, string>
45+
{
46+
{ "hello", "&world " },
47+
};
48+
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString());
49+
}
50+
}
51+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Collections.Generic;
2+
using System;
3+
using NUnit.Framework;
4+
5+
namespace SpotifyAPI.Web.Tests
6+
{
7+
[TestFixture]
8+
public class URIParameterFormatProviderTest
9+
{
10+
[Test]
11+
public void Format_NormalParameters()
12+
{
13+
var expected = "/users/wizzler";
14+
15+
var user = "wizzler";
16+
var formatter = new URIParameterFormatProvider();
17+
Func<FormattableString, string> func = (FormattableString str) => str.ToString(formatter);
18+
19+
Assert.AreEqual(expected, func($"/users/{user}"));
20+
}
21+
22+
[Test]
23+
public void Format_EscapedParameters()
24+
{
25+
var expected = "/users/++wizzler";
26+
27+
var user = " wizzler";
28+
var formatter = new URIParameterFormatProvider();
29+
Func<FormattableString, string> func = (FormattableString str) => str.ToString(formatter);
30+
31+
Assert.AreEqual(expected, func($"/users/{user}"));
32+
}
33+
}
34+
}

‎SpotifyAPI.Web.Tests/fixtures/private-user.json‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎SpotifyAPI.Web.Tests/fixtures/public-user.json‎

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using SpotifyAPI.Web.Http;
2+
3+
namespace SpotifyAPI.Web
4+
{
5+
public abstract class APIClient
6+
{
7+
public APIClient(IAPIConnector apiConnector)
8+
{
9+
Ensure.ArgumentNotNull(apiConnector, nameof(apiConnector));
10+
11+
API = apiConnector;
12+
}
13+
14+
public IAPIConnector API { get; set; }
15+
}
16+
}

0 commit comments

Comments
 (0)