From 0391371a8c57fd7cb2d330dfa1ffb88dd7b800ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 11:41:47 +0100 Subject: [PATCH] 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] * update tests to nunit 4.0 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Dellinger --- .../Clients/SpotifyClientConfigTest.cs | 38 +++++++++---------- .../Http/NewtonsoftJSONSerializerTest.cs | 10 ++--- SpotifyAPI.Web.Tests/Http/ProxyConfigTest.cs | 7 ---- .../Http/TokenAuthenticatorTest.cs | 3 +- .../Models/RequestParamsTest.cs | 24 ++++++------ .../RetryHandlers/SimpleRetryHandlerTest.cs | 22 +++++------ .../SpotifyAPI.Web.Tests.csproj | 4 +- .../UtilTests/Base64UtilTest.cs | 9 ++--- .../UtilTests/URIExtensionTest.cs | 6 +-- .../URIParameterFormatProviderTest.cs | 5 +-- 10 files changed, 60 insertions(+), 68 deletions(-) delete mode 100644 SpotifyAPI.Web.Tests/Http/ProxyConfigTest.cs diff --git a/SpotifyAPI.Web.Tests/Clients/SpotifyClientConfigTest.cs b/SpotifyAPI.Web.Tests/Clients/SpotifyClientConfigTest.cs index 8560ae31..e7817250 100644 --- a/SpotifyAPI.Web.Tests/Clients/SpotifyClientConfigTest.cs +++ b/SpotifyAPI.Web.Tests/Clients/SpotifyClientConfigTest.cs @@ -13,13 +13,13 @@ namespace SpotifyAPI.Web { var defaultConfig = SpotifyClientConfig.CreateDefault(); - Assert.IsInstanceOf(typeof(SimplePaginator), defaultConfig.DefaultPaginator); - Assert.IsInstanceOf(typeof(NetHttpClient), defaultConfig.HTTPClient); - Assert.IsInstanceOf(typeof(NewtonsoftJSONSerializer), defaultConfig.JSONSerializer); - Assert.AreEqual(SpotifyUrls.APIV1, defaultConfig.BaseAddress); - Assert.AreEqual(null, defaultConfig.Authenticator); - Assert.AreEqual(null, defaultConfig.HTTPLogger); - Assert.AreEqual(null, defaultConfig.RetryHandler); + Assert.That(defaultConfig.DefaultPaginator, Is.InstanceOf(typeof(SimplePaginator))); + Assert.That(defaultConfig.HTTPClient, Is.InstanceOf(typeof(NetHttpClient))); + Assert.That(defaultConfig.JSONSerializer, Is.InstanceOf(typeof(NewtonsoftJSONSerializer))); + Assert.That(SpotifyUrls.APIV1, Is.EqualTo(defaultConfig.BaseAddress)); + Assert.That(null, Is.EqualTo(defaultConfig.Authenticator)); + Assert.That(null, Is.EqualTo(defaultConfig.HTTPLogger)); + Assert.That(null, Is.EqualTo(defaultConfig.RetryHandler)); } [Test] @@ -30,18 +30,18 @@ namespace SpotifyAPI.Web var defaultConfig = SpotifyClientConfig.CreateDefault(token, tokenType); - Assert.IsInstanceOf(typeof(SimplePaginator), defaultConfig.DefaultPaginator); - Assert.IsInstanceOf(typeof(NetHttpClient), defaultConfig.HTTPClient); - Assert.IsInstanceOf(typeof(NewtonsoftJSONSerializer), defaultConfig.JSONSerializer); - Assert.AreEqual(SpotifyUrls.APIV1, defaultConfig.BaseAddress); - Assert.AreEqual(null, defaultConfig.HTTPLogger); - Assert.AreEqual(null, defaultConfig.RetryHandler); + Assert.That(defaultConfig.DefaultPaginator, Is.InstanceOf(typeof(SimplePaginator))); + Assert.That(defaultConfig.HTTPClient, Is.InstanceOf(typeof(NetHttpClient))); + Assert.That(defaultConfig.JSONSerializer, Is.InstanceOf(typeof(NewtonsoftJSONSerializer))); + Assert.That(SpotifyUrls.APIV1, Is.EqualTo(defaultConfig.BaseAddress)); + Assert.That(null, Is.EqualTo(defaultConfig.HTTPLogger)); + 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; - Assert.AreEqual(token, tokenHeaderAuth.Token); - Assert.AreEqual(tokenType, tokenHeaderAuth.TokenType); + Assert.That(token, Is.EqualTo(tokenHeaderAuth.Token)); + Assert.That(tokenType, Is.EqualTo(tokenHeaderAuth.TokenType)); } [Test] @@ -51,9 +51,9 @@ namespace SpotifyAPI.Web var defaultConfig = SpotifyClientConfig.CreateDefault(); var tokenConfig = defaultConfig.WithToken(token); - Assert.AreEqual(token, (tokenConfig.Authenticator as TokenAuthenticator).Token); - Assert.AreNotEqual(defaultConfig, tokenConfig); - Assert.AreEqual(null, defaultConfig.Authenticator); + Assert.That(token, Is.EqualTo((tokenConfig.Authenticator as TokenAuthenticator).Token)); + Assert.That(defaultConfig, Is.Not.EqualTo(tokenConfig)); + Assert.That(null, Is.EqualTo(defaultConfig.Authenticator)); } } } diff --git a/SpotifyAPI.Web.Tests/Http/NewtonsoftJSONSerializerTest.cs b/SpotifyAPI.Web.Tests/Http/NewtonsoftJSONSerializerTest.cs index 71a85423..2a8d598d 100644 --- a/SpotifyAPI.Web.Tests/Http/NewtonsoftJSONSerializerTest.cs +++ b/SpotifyAPI.Web.Tests/Http/NewtonsoftJSONSerializerTest.cs @@ -31,7 +31,7 @@ namespace SpotifyAPI.Web.Tests serializer.SerializeRequest(request.Object); - Assert.AreEqual(input, request.Object.Body); + Assert.That(input, Is.EqualTo(request.Object.Body)); } public static IEnumerable SerializeTestSource @@ -65,8 +65,8 @@ namespace SpotifyAPI.Web.Tests response.SetupGet(r => r.ContentType).Returns("media/mp4"); IAPIResponse apiResonse = serializer.DeserializeResponse(response.Object); - Assert.AreEqual(apiResonse.Body, null); - Assert.AreEqual(apiResonse.Response, response.Object); + Assert.That(apiResonse.Body, Is.Null); + Assert.That(apiResonse.Response, Is.EqualTo(response.Object)); } [TestCase] @@ -78,8 +78,8 @@ namespace SpotifyAPI.Web.Tests response.SetupGet(r => r.ContentType).Returns("application/json"); IAPIResponse apiResonse = serializer.DeserializeResponse(response.Object); - Assert.AreEqual(apiResonse.Body?.HelloWorld, false); - Assert.AreEqual(apiResonse.Response, response.Object); + Assert.That(apiResonse.Body?.HelloWorld, Is.False); + Assert.That(apiResonse.Response, Is.EqualTo(response.Object)); } public class TestResponseObject diff --git a/SpotifyAPI.Web.Tests/Http/ProxyConfigTest.cs b/SpotifyAPI.Web.Tests/Http/ProxyConfigTest.cs deleted file mode 100644 index 86d459c6..00000000 --- a/SpotifyAPI.Web.Tests/Http/ProxyConfigTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SpotifyAPI.Web -{ - public class ProxyConfigTest - { - - } -} diff --git a/SpotifyAPI.Web.Tests/Http/TokenAuthenticatorTest.cs b/SpotifyAPI.Web.Tests/Http/TokenAuthenticatorTest.cs index 44b21cb4..9bbf8418 100644 --- a/SpotifyAPI.Web.Tests/Http/TokenAuthenticatorTest.cs +++ b/SpotifyAPI.Web.Tests/Http/TokenAuthenticatorTest.cs @@ -1,3 +1,4 @@ + using System.Collections.Generic; using Moq; using NUnit.Framework; @@ -18,7 +19,7 @@ namespace SpotifyAPI.Web.Tests request.SetupGet(r => r.Headers).Returns(new Dictionary()); authenticator.Apply(request.Object, apiConnector.Object); - Assert.AreEqual(request.Object.Headers["Authorization"], "Bearer MyToken"); + Assert.That(request.Object.Headers["Authorization"], Is.EqualTo("Bearer MyToken")); } } } diff --git a/SpotifyAPI.Web.Tests/Models/RequestParamsTest.cs b/SpotifyAPI.Web.Tests/Models/RequestParamsTest.cs index 9e6285fd..aea9fb35 100644 --- a/SpotifyAPI.Web.Tests/Models/RequestParamsTest.cs +++ b/SpotifyAPI.Web.Tests/Models/RequestParamsTest.cs @@ -17,11 +17,11 @@ namespace SpotifyAPI.Web.Tests var second = new SecondRequestModel { Second = false }; var secondParams = second.BuildQueryParams(); - Assert.AreEqual(1, firstParams.Keys.Count); - Assert.AreEqual("true", firstParams["first"]); + Assert.That(1, Is.EqualTo(firstParams.Keys.Count)); + Assert.That("true", Is.EqualTo(firstParams["first"])); - Assert.AreEqual(1, secondParams.Keys.Count); - Assert.AreEqual("false", secondParams["second"]); + Assert.That(1, Is.EqualTo(secondParams.Keys.Count)); + Assert.That("false", Is.EqualTo(secondParams["second"])); } [Test] @@ -33,17 +33,17 @@ namespace SpotifyAPI.Web.Tests var second = new SecondRequestModel { Second = false }; var secondParams = second.BuildBodyParams(); - Assert.AreEqual("{\"first\":true}", firstParams.ToString(Formatting.None)); - Assert.AreEqual("{\"second\":false}", secondParams.ToString(Formatting.None)); + Assert.That("{\"first\":true}", Is.EqualTo(firstParams.ToString(Formatting.None))); + Assert.That("{\"second\":false}", Is.EqualTo(secondParams.ToString(Formatting.None))); } [Test] public void EmptyListIsSkippedInQueryParams() { var first = new EmptyListExampleRequestModel(); - Assert.AreEqual(new Dictionary { }, first.BuildQueryParams()); + Assert.That(new Dictionary { }, Is.EqualTo(first.BuildQueryParams())); first.List.Add("hello_world"); - Assert.AreEqual(new Dictionary { { "list", "hello_world" } }, first.BuildQueryParams()); + Assert.That(new Dictionary { { "list", "hello_world" } }, Is.EqualTo(first.BuildQueryParams())); } [Test] @@ -55,8 +55,8 @@ namespace SpotifyAPI.Web.Tests }; var result = enumModel.BuildQueryParams(); - Assert.AreEqual(1, result.Keys.Count); - Assert.AreEqual("two", result["an_enum"]); + Assert.That(1, Is.EqualTo(result.Keys.Count)); + Assert.That("two", Is.EqualTo(result["an_enum"])); } [Test] @@ -68,8 +68,8 @@ namespace SpotifyAPI.Web.Tests }; var result = enumModel.BuildQueryParams(); - Assert.AreEqual(1, result.Keys.Count); - Assert.AreEqual("one,two", result["an_enum"]); + Assert.That(1, Is.EqualTo(result.Keys.Count)); + Assert.That("one,two", Is.EqualTo(result["an_enum"])); } } diff --git a/SpotifyAPI.Web.Tests/RetryHandlers/SimpleRetryHandlerTest.cs b/SpotifyAPI.Web.Tests/RetryHandlers/SimpleRetryHandlerTest.cs index 392add08..14fdb1c7 100644 --- a/SpotifyAPI.Web.Tests/RetryHandlers/SimpleRetryHandlerTest.cs +++ b/SpotifyAPI.Web.Tests/RetryHandlers/SimpleRetryHandlerTest.cs @@ -38,7 +38,7 @@ namespace SpotifyAPI.Web var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); }); - Assert.AreEqual(1, retryCalled); + Assert.That(1, Is.EqualTo(retryCalled)); } [Test] @@ -64,8 +64,8 @@ namespace SpotifyAPI.Web }; var response = await handler.HandleRetry(setup.Request.Object, setup.Response.Object, setup.Retry); - Assert.AreEqual(2, retryCalled); - Assert.AreEqual(setup.Response.Object, response); + Assert.That(2, Is.EqualTo(retryCalled)); + Assert.That(setup.Response.Object, Is.EqualTo(response)); 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); - Assert.AreEqual(1, retryCalled); - Assert.AreEqual(successResponse.Object, response); + Assert.That(1, Is.EqualTo(retryCalled)); + Assert.That(successResponse.Object, Is.EqualTo(response)); 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); - Assert.AreEqual(1, retryCalled); - Assert.AreEqual(successResponse.Object, response); + Assert.That(1, Is.EqualTo(retryCalled)); + Assert.That(successResponse.Object, Is.EqualTo(response)); 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); - Assert.AreEqual(10, retryCalled); - Assert.AreEqual(setup.Response.Object, response); + Assert.That(10, Is.EqualTo(retryCalled)); + Assert.That(setup.Response.Object, Is.EqualTo(response)); 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); - Assert.AreEqual(0, retryCalled); - Assert.AreEqual(setup.Response.Object, response); + Assert.That(0, Is.EqualTo(retryCalled)); + Assert.That(setup.Response.Object, Is.EqualTo(response)); setup.Sleep.Verify(s => s(TimeSpan.FromMilliseconds(50)), Times.Exactly(0)); } diff --git a/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj b/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj index ed97acd2..d5122c84 100644 --- a/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj +++ b/SpotifyAPI.Web.Tests/SpotifyAPI.Web.Tests.csproj @@ -1,7 +1,7 @@ - net7.0;net6.0;net5.0 + net7.0;net6.0 9.0 false false @@ -10,7 +10,7 @@ - + diff --git a/SpotifyAPI.Web.Tests/UtilTests/Base64UtilTest.cs b/SpotifyAPI.Web.Tests/UtilTests/Base64UtilTest.cs index 096efb6e..653ee3ab 100644 --- a/SpotifyAPI.Web.Tests/UtilTests/Base64UtilTest.cs +++ b/SpotifyAPI.Web.Tests/UtilTests/Base64UtilTest.cs @@ -1,6 +1,5 @@ using System.Text; using NUnit.Framework; -using SpotifyAPI.Web; namespace SpotifyAPI.Web.Tests { @@ -12,7 +11,7 @@ namespace SpotifyAPI.Web.Tests { var encoded = "SGVsbG9Xb3JsZA"; - Assert.AreEqual("HelloWorld", Encoding.UTF8.GetString(Base64Util.UrlDecode(encoded))); + Assert.That("HelloWorld", Is.EqualTo(Encoding.UTF8.GetString(Base64Util.UrlDecode(encoded)))); } [Test] @@ -20,7 +19,7 @@ namespace SpotifyAPI.Web.Tests { var decoded = "HelloWorld"; - Assert.AreEqual("SGVsbG9Xb3JsZA", Base64Util.UrlEncode(Encoding.UTF8.GetBytes(decoded))); + Assert.That("SGVsbG9Xb3JsZA", Is.EqualTo(Base64Util.UrlEncode(Encoding.UTF8.GetBytes(decoded)))); } [Test] @@ -29,7 +28,7 @@ namespace SpotifyAPI.Web.Tests var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a }; // normal base64: BJ+c/z8K - Assert.AreEqual("BJ-c_z8K", Base64Util.UrlEncode(bytes)); + Assert.That("BJ-c_z8K", Is.EqualTo(Base64Util.UrlEncode(bytes))); } [Test] @@ -38,7 +37,7 @@ namespace SpotifyAPI.Web.Tests var bytes = new byte[] { 0x04, 0x9f, 0x9c, 0xff, 0x3f, 0x0a }; // normal base64: BJ+c/z8K - Assert.AreEqual(bytes, Base64Util.UrlDecode("BJ-c_z8K")); + Assert.That(bytes, Is.EqualTo(Base64Util.UrlDecode("BJ-c_z8K"))); } } } diff --git a/SpotifyAPI.Web.Tests/UtilTests/URIExtensionTest.cs b/SpotifyAPI.Web.Tests/UtilTests/URIExtensionTest.cs index 45f24159..2f4e4fee 100644 --- a/SpotifyAPI.Web.Tests/UtilTests/URIExtensionTest.cs +++ b/SpotifyAPI.Web.Tests/UtilTests/URIExtensionTest.cs @@ -18,7 +18,7 @@ namespace SpotifyAPI.Web.Tests { "hello", "world" }, { "nice", "day" } }; - Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); + Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString())); } [Test] @@ -32,7 +32,7 @@ namespace SpotifyAPI.Web.Tests { "hello", "world" }, { "nice", "day" } }; - Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); + Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString())); } [Test] @@ -45,7 +45,7 @@ namespace SpotifyAPI.Web.Tests { { "hello", "&world " }, }; - Assert.AreEqual(expected, uri.ApplyParameters(parameters).ToString()); + Assert.That(expected, Is.EqualTo(uri.ApplyParameters(parameters).ToString())); } } } diff --git a/SpotifyAPI.Web.Tests/UtilTests/URIParameterFormatProviderTest.cs b/SpotifyAPI.Web.Tests/UtilTests/URIParameterFormatProviderTest.cs index ce8ce89d..6552f946 100644 --- a/SpotifyAPI.Web.Tests/UtilTests/URIParameterFormatProviderTest.cs +++ b/SpotifyAPI.Web.Tests/UtilTests/URIParameterFormatProviderTest.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using NUnit.Framework; namespace SpotifyAPI.Web.Tests @@ -16,7 +15,7 @@ namespace SpotifyAPI.Web.Tests var formatter = new URIParameterFormatProvider(); string func(FormattableString str) => str.ToString(formatter); - Assert.AreEqual(expected, func($"/users/{user}")); + Assert.That(expected, Is.EqualTo(func($"/users/{user}"))); } [Test] @@ -28,7 +27,7 @@ namespace SpotifyAPI.Web.Tests var formatter = new URIParameterFormatProvider(); string func(FormattableString str) => str.ToString(formatter); - Assert.AreEqual(expected, func($"/users/{user}")); + Assert.That(expected, Is.EqualTo(func($"/users/{user}"))); } } }