Bump NUnit from 3.13.3 to 4.0.0 (#922)

* Bump NUnit from 3.13.3 to 4.0.0

Bumps [NUnit](https://github.com/nunit/nunit) from 3.13.3 to 4.0.0.
- [Release notes](https://github.com/nunit/nunit/releases)
- [Changelog](https://github.com/nunit/nunit/blob/master/CHANGES.md)
- [Commits](https://github.com/nunit/nunit/compare/v3.13.3...v4.0.0)

---
updated-dependencies:
- dependency-name: NUnit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* update tests to nunit 4.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jonas Dellinger <jonas@dellinger.dev>
This commit is contained in:
dependabot[bot] 2024-02-10 11:41:47 +01:00 committed by GitHub
parent 9dbd210a2f
commit 0391371a8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 60 additions and 68 deletions

View File

@ -13,13 +13,13 @@ namespace SpotifyAPI.Web
{ {
var defaultConfig = SpotifyClientConfig.CreateDefault(); var defaultConfig = SpotifyClientConfig.CreateDefault();
Assert.IsInstanceOf(typeof(SimplePaginator), defaultConfig.DefaultPaginator); Assert.That(defaultConfig.DefaultPaginator, Is.InstanceOf(typeof(SimplePaginator)));
Assert.IsInstanceOf(typeof(NetHttpClient), defaultConfig.HTTPClient); Assert.That(defaultConfig.HTTPClient, Is.InstanceOf(typeof(NetHttpClient)));
Assert.IsInstanceOf(typeof(NewtonsoftJSONSerializer), defaultConfig.JSONSerializer); Assert.That(defaultConfig.JSONSerializer, Is.InstanceOf(typeof(NewtonsoftJSONSerializer)));
Assert.AreEqual(SpotifyUrls.APIV1, defaultConfig.BaseAddress); Assert.That(SpotifyUrls.APIV1, Is.EqualTo(defaultConfig.BaseAddress));
Assert.AreEqual(null, defaultConfig.Authenticator); Assert.That(null, Is.EqualTo(defaultConfig.Authenticator));
Assert.AreEqual(null, defaultConfig.HTTPLogger); Assert.That(null, Is.EqualTo(defaultConfig.HTTPLogger));
Assert.AreEqual(null, defaultConfig.RetryHandler); Assert.That(null, Is.EqualTo(defaultConfig.RetryHandler));
} }
[Test] [Test]
@ -30,18 +30,18 @@ namespace SpotifyAPI.Web
var defaultConfig = SpotifyClientConfig.CreateDefault(token, tokenType); var defaultConfig = SpotifyClientConfig.CreateDefault(token, tokenType);
Assert.IsInstanceOf(typeof(SimplePaginator), defaultConfig.DefaultPaginator); Assert.That(defaultConfig.DefaultPaginator, Is.InstanceOf(typeof(SimplePaginator)));
Assert.IsInstanceOf(typeof(NetHttpClient), defaultConfig.HTTPClient); Assert.That(defaultConfig.HTTPClient, Is.InstanceOf(typeof(NetHttpClient)));
Assert.IsInstanceOf(typeof(NewtonsoftJSONSerializer), defaultConfig.JSONSerializer); Assert.That(defaultConfig.JSONSerializer, Is.InstanceOf(typeof(NewtonsoftJSONSerializer)));
Assert.AreEqual(SpotifyUrls.APIV1, defaultConfig.BaseAddress); Assert.That(SpotifyUrls.APIV1, Is.EqualTo(defaultConfig.BaseAddress));
Assert.AreEqual(null, defaultConfig.HTTPLogger); Assert.That(null, Is.EqualTo(defaultConfig.HTTPLogger));
Assert.AreEqual(null, defaultConfig.RetryHandler); Assert.That(null, Is.EqualTo(defaultConfig.RetryHandler));
Assert.IsInstanceOf(typeof(TokenAuthenticator), defaultConfig.Authenticator); Assert.That(defaultConfig.Authenticator, Is.InstanceOf(typeof(TokenAuthenticator)));
var tokenHeaderAuth = defaultConfig.Authenticator as TokenAuthenticator; var tokenHeaderAuth = defaultConfig.Authenticator as TokenAuthenticator;
Assert.AreEqual(token, tokenHeaderAuth.Token); Assert.That(token, Is.EqualTo(tokenHeaderAuth.Token));
Assert.AreEqual(tokenType, tokenHeaderAuth.TokenType); Assert.That(tokenType, Is.EqualTo(tokenHeaderAuth.TokenType));
} }
[Test] [Test]
@ -51,9 +51,9 @@ namespace SpotifyAPI.Web
var defaultConfig = SpotifyClientConfig.CreateDefault(); var defaultConfig = SpotifyClientConfig.CreateDefault();
var tokenConfig = defaultConfig.WithToken(token); var tokenConfig = defaultConfig.WithToken(token);
Assert.AreEqual(token, (tokenConfig.Authenticator as TokenAuthenticator).Token); Assert.That(token, Is.EqualTo((tokenConfig.Authenticator as TokenAuthenticator).Token));
Assert.AreNotEqual(defaultConfig, tokenConfig); Assert.That(defaultConfig, Is.Not.EqualTo(tokenConfig));
Assert.AreEqual(null, defaultConfig.Authenticator); Assert.That(null, Is.EqualTo(defaultConfig.Authenticator));
} }
} }
} }

View File

@ -31,7 +31,7 @@ namespace SpotifyAPI.Web.Tests
serializer.SerializeRequest(request.Object); serializer.SerializeRequest(request.Object);
Assert.AreEqual(input, request.Object.Body); Assert.That(input, Is.EqualTo(request.Object.Body));
} }
public static IEnumerable<object> SerializeTestSource public static IEnumerable<object> SerializeTestSource
@ -65,8 +65,8 @@ namespace SpotifyAPI.Web.Tests
response.SetupGet(r => r.ContentType).Returns("media/mp4"); response.SetupGet(r => r.ContentType).Returns("media/mp4");
IAPIResponse<object> apiResonse = serializer.DeserializeResponse<object>(response.Object); IAPIResponse<object> apiResonse = serializer.DeserializeResponse<object>(response.Object);
Assert.AreEqual(apiResonse.Body, null); Assert.That(apiResonse.Body, Is.Null);
Assert.AreEqual(apiResonse.Response, response.Object); Assert.That(apiResonse.Response, Is.EqualTo(response.Object));
} }
[TestCase] [TestCase]
@ -78,8 +78,8 @@ namespace SpotifyAPI.Web.Tests
response.SetupGet(r => r.ContentType).Returns("application/json"); response.SetupGet(r => r.ContentType).Returns("application/json");
IAPIResponse<TestResponseObject> apiResonse = serializer.DeserializeResponse<TestResponseObject>(response.Object); IAPIResponse<TestResponseObject> apiResonse = serializer.DeserializeResponse<TestResponseObject>(response.Object);
Assert.AreEqual(apiResonse.Body?.HelloWorld, false); Assert.That(apiResonse.Body?.HelloWorld, Is.False);
Assert.AreEqual(apiResonse.Response, response.Object); Assert.That(apiResonse.Response, Is.EqualTo(response.Object));
} }
public class TestResponseObject public class TestResponseObject

View File

@ -1,7 +0,0 @@
namespace SpotifyAPI.Web
{
public class ProxyConfigTest
{
}
}

View File

@ -1,3 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
@ -18,7 +19,7 @@ namespace SpotifyAPI.Web.Tests
request.SetupGet(r => r.Headers).Returns(new Dictionary<string, string>()); request.SetupGet(r => r.Headers).Returns(new Dictionary<string, string>());
authenticator.Apply(request.Object, apiConnector.Object); authenticator.Apply(request.Object, apiConnector.Object);
Assert.AreEqual(request.Object.Headers["Authorization"], "Bearer MyToken"); Assert.That(request.Object.Headers["Authorization"], Is.EqualTo("Bearer MyToken"));
} }
} }
} }

View File

@ -17,11 +17,11 @@ namespace SpotifyAPI.Web.Tests
var second = new SecondRequestModel { Second = false }; var second = new SecondRequestModel { Second = false };
var secondParams = second.BuildQueryParams(); var secondParams = second.BuildQueryParams();
Assert.AreEqual(1, firstParams.Keys.Count); Assert.That(1, Is.EqualTo(firstParams.Keys.Count));
Assert.AreEqual("true", firstParams["first"]); Assert.That("true", Is.EqualTo(firstParams["first"]));
Assert.AreEqual(1, secondParams.Keys.Count); Assert.That(1, Is.EqualTo(secondParams.Keys.Count));
Assert.AreEqual("false", secondParams["second"]); Assert.That("false", Is.EqualTo(secondParams["second"]));
} }
[Test] [Test]
@ -33,17 +33,17 @@ namespace SpotifyAPI.Web.Tests
var second = new SecondRequestModel { Second = false }; var second = new SecondRequestModel { Second = false };
var secondParams = second.BuildBodyParams(); var secondParams = second.BuildBodyParams();
Assert.AreEqual("{\"first\":true}", firstParams.ToString(Formatting.None)); Assert.That("{\"first\":true}", Is.EqualTo(firstParams.ToString(Formatting.None)));
Assert.AreEqual("{\"second\":false}", secondParams.ToString(Formatting.None)); Assert.That("{\"second\":false}", Is.EqualTo(secondParams.ToString(Formatting.None)));
} }
[Test] [Test]
public void EmptyListIsSkippedInQueryParams() public void EmptyListIsSkippedInQueryParams()
{ {
var first = new EmptyListExampleRequestModel(); var first = new EmptyListExampleRequestModel();
Assert.AreEqual(new Dictionary<string, string> { }, first.BuildQueryParams()); Assert.That(new Dictionary<string, string> { }, Is.EqualTo(first.BuildQueryParams()));
first.List.Add("hello_world"); first.List.Add("hello_world");
Assert.AreEqual(new Dictionary<string, string> { { "list", "hello_world" } }, first.BuildQueryParams()); Assert.That(new Dictionary<string, string> { { "list", "hello_world" } }, Is.EqualTo(first.BuildQueryParams()));
} }
[Test] [Test]
@ -55,8 +55,8 @@ namespace SpotifyAPI.Web.Tests
}; };
var result = enumModel.BuildQueryParams(); var result = enumModel.BuildQueryParams();
Assert.AreEqual(1, result.Keys.Count); Assert.That(1, Is.EqualTo(result.Keys.Count));
Assert.AreEqual("two", result["an_enum"]); Assert.That("two", Is.EqualTo(result["an_enum"]));
} }
[Test] [Test]
@ -68,8 +68,8 @@ namespace SpotifyAPI.Web.Tests
}; };
var result = enumModel.BuildQueryParams(); var result = enumModel.BuildQueryParams();
Assert.AreEqual(1, result.Keys.Count); Assert.That(1, Is.EqualTo(result.Keys.Count));
Assert.AreEqual("one,two", result["an_enum"]); Assert.That("one,two", Is.EqualTo(result["an_enum"]));
} }
} }

View File

@ -38,7 +38,7 @@ namespace SpotifyAPI.Web
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
}); });
Assert.AreEqual(1, retryCalled); Assert.That(1, Is.EqualTo(retryCalled));
} }
[Test] [Test]
@ -64,8 +64,8 @@ namespace SpotifyAPI.Web
}; };
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
Assert.AreEqual(2, retryCalled); Assert.That(2, Is.EqualTo(retryCalled));
Assert.AreEqual(setup.Response.Object, response); Assert.That(setup.Response.Object, Is.EqualTo(response));
setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Exactly(2)); setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Exactly(2));
} }
@ -95,8 +95,8 @@ namespace SpotifyAPI.Web
}; };
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
Assert.AreEqual(1, retryCalled); Assert.That(1, Is.EqualTo(retryCalled));
Assert.AreEqual(successResponse.Object, response); Assert.That(successResponse.Object, Is.EqualTo(response));
setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Once); setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Once);
} }
@ -125,8 +125,8 @@ namespace SpotifyAPI.Web
}; };
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
Assert.AreEqual(1, retryCalled); Assert.That(1, Is.EqualTo(retryCalled));
Assert.AreEqual(successResponse.Object, response); Assert.That(successResponse.Object, Is.EqualTo(response));
setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Once); setup.Sleep.Verify(s => s(TimeSpan.FromSeconds(50)), Times.Once);
} }
@ -151,8 +151,8 @@ namespace SpotifyAPI.Web
}; };
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
Assert.AreEqual(10, retryCalled); Assert.That(10, Is.EqualTo(retryCalled));
Assert.AreEqual(setup.Response.Object, response); Assert.That(setup.Response.Object, Is.EqualTo(response));
setup.Sleep.Verify(s => s(TimeSpan.FromMilliseconds(50)), Times.Exactly(10)); setup.Sleep.Verify(s => s(TimeSpan.FromMilliseconds(50)), Times.Exactly(10));
} }
@ -177,8 +177,8 @@ namespace SpotifyAPI.Web
}; };
var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry);
Assert.AreEqual(0, retryCalled); Assert.That(0, Is.EqualTo(retryCalled));
Assert.AreEqual(setup.Response.Object, response); Assert.That(setup.Response.Object, Is.EqualTo(response));
setup.Sleep.Verify(s => s(TimeSpan.FromMilliseconds(50)), Times.Exactly(0)); setup.Sleep.Verify(s => s(TimeSpan.FromMilliseconds(50)), Times.Exactly(0));
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks> <TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<CheckEolTargetFramework>false</CheckEolTargetFramework> <CheckEolTargetFramework>false</CheckEolTargetFramework>
@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" /> <PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> <PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Console" Version="3.17.0" /> <PackageReference Include="NUnit.Console" Version="3.17.0" />
</ItemGroup> </ItemGroup>

View File

@ -1,6 +1,5 @@
using System.Text; using System.Text;
using NUnit.Framework; using NUnit.Framework;
using SpotifyAPI.Web;
namespace SpotifyAPI.Web.Tests namespace SpotifyAPI.Web.Tests
{ {
@ -12,7 +11,7 @@ namespace SpotifyAPI.Web.Tests
{ {
var encoded = "SGVsbG9Xb3JsZA"; var encoded = "SGVsbG9Xb3JsZA";
Assert.AreEqual("HelloWorld", Encoding.UTF8.GetString(Base64Util.UrlDecode(encoded))); Assert.That("HelloWorld", Is.EqualTo(Encoding.UTF8.GetString(Base64Util.UrlDecode(encoded))));
} }
[Test] [Test]
@ -20,7 +19,7 @@ namespace SpotifyAPI.Web.Tests
{ {
var decoded = "HelloWorld"; var decoded = "HelloWorld";
Assert.AreEqual("SGVsbG9Xb3JsZA", Base64Util.UrlEncode(Encoding.UTF8.GetBytes(decoded))); Assert.That("SGVsbG9Xb3JsZA", Is.EqualTo(Base64Util.UrlEncode(Encoding.UTF8.GetBytes(decoded))));
} }
[Test] [Test]
@ -29,7 +28,7 @@ namespace SpotifyAPI.Web.Tests
var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a }; var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a };
// normal base64: BJ+c/z8K // normal base64: BJ+c/z8K
Assert.AreEqual("BJ-c_z8K", Base64Util.UrlEncode(bytes)); Assert.That("BJ-c_z8K", Is.EqualTo(Base64Util.UrlEncode(bytes)));
} }
[Test] [Test]
@ -38,7 +37,7 @@ namespace SpotifyAPI.Web.Tests
var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a }; var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a };
// normal base64: BJ+c/z8K // normal base64: BJ+c/z8K
Assert.AreEqual(bytes, Base64Util.UrlDecode("BJ-c_z8K")); Assert.That(bytes, Is.EqualTo(Base64Util.UrlDecode("BJ-c_z8K")));
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace SpotifyAPI.Web.Tests
{ "hello", "world" }, { "hello", "world" },
{ "nice", "day" } { "nice", "day" }
}; };
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString()));
} }
[Test] [Test]
@ -32,7 +32,7 @@ namespace SpotifyAPI.Web.Tests
{ "hello", "world" }, { "hello", "world" },
{ "nice", "day" } { "nice", "day" }
}; };
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString()));
} }
[Test] [Test]
@ -45,7 +45,7 @@ namespace SpotifyAPI.Web.Tests
{ {
{ "hello", "&world " }, { "hello", "&world " },
}; };
Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString()));
} }
} }
} }

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
namespace SpotifyAPI.Web.Tests namespace SpotifyAPI.Web.Tests
@ -16,7 +15,7 @@ namespace SpotifyAPI.Web.Tests
var formatter = new URIParameterFormatProvider(); var formatter = new URIParameterFormatProvider();
string func(FormattableString str) => str.ToString(formatter); string func(FormattableString str) => str.ToString(formatter);
Assert.AreEqual(expected, func($"/users/{user}")); Assert.That(expected, Is.EqualTo(func($"/users/{user}")));
} }
[Test] [Test]
@ -28,7 +27,7 @@ namespace SpotifyAPI.Web.Tests
var formatter = new URIParameterFormatProvider(); var formatter = new URIParameterFormatProvider();
string func(FormattableString str) => str.ToString(formatter); string func(FormattableString str) => str.ToString(formatter);
Assert.AreEqual(expected, func($"/users/{user}")); Assert.That(expected, Is.EqualTo(func($"/users/{user}")));
} }
} }
} }