From ccbdd7c2cbf82ea9e660cc62c6ffa21313767efa Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:36:06 +0100 Subject: [PATCH] Changes from gocardless/gocardless-dotnet-template (#123) * Changes generated by 7576ee27e663fe49910aea2d74830697f42b468d This commit was automatically created from gocardless/gocardless-dotnet-template@7576ee27e663fe49910aea2d74830697f42b468d by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-dotnet-template/actions/runs/8836016263 * Changes generated by 82feafb3c2b47b587a70f12be4a4dbe577b15a9c This commit was automatically created from gocardless/gocardless-dotnet-template@82feafb3c2b47b587a70f12be4a4dbe577b15a9c by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-dotnet-template/actions/runs/8836129911 * Changes generated by 3b4ce8c8a72faba63487a0c676b54afb669fdcd7 This commit was automatically created from gocardless/gocardless-dotnet-template@3b4ce8c8a72faba63487a0c676b54afb669fdcd7 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-dotnet-template/actions/runs/8836140144 --------- Co-authored-by: gocardless-ci-robot[bot] <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> --- GoCardless.Tests/BlockServiceTests.cs | 29 +++++----- GoCardless.Tests/ErrorTests.cs | 73 ++++++++++++------------ GoCardless.Tests/FunctionalityTests.cs | 37 ++++++------ GoCardless.Tests/GoCardless.Tests.csproj | 6 +- GoCardless.Tests/MandateTests.cs | 33 +++++------ GoCardless.Tests/MockHttp.cs | 5 +- GoCardless.Tests/RedirectFlowTests.cs | 3 +- GoCardless.Tests/WebhookParserTests.cs | 3 +- GoCardless/GoCardless.csproj | 4 +- GoCardless/GoCardlessClient.cs | 4 +- README.md | 2 +- tmp-push-files-checkout | 2 +- 12 files changed, 104 insertions(+), 97 deletions(-) diff --git a/GoCardless.Tests/BlockServiceTests.cs b/GoCardless.Tests/BlockServiceTests.cs index fcdcace..77ea590 100644 --- a/GoCardless.Tests/BlockServiceTests.cs +++ b/GoCardless.Tests/BlockServiceTests.cs @@ -6,6 +6,7 @@ using GoCardless.Resources; using GoCardless.Services; using NUnit.Framework; +using NUnit.Framework.Legacy; using FluentAssertions; namespace GoCardless.Tests @@ -34,12 +35,12 @@ public async Task ShouldGetBlock() TestHelpers.AssertResponseCanSerializeBackToFixture(resp, responseFixture); GoCardless.Resources.Block block = resp.Block; - Assert.AreEqual(block.Id, "BLC456"); - Assert.AreEqual(block.BlockType, "email"); - Assert.AreEqual(block.ReasonType, "no_intent_to_pay"); - Assert.AreEqual(block.ResourceReference, "example@example.com"); - Assert.AreEqual(block.Active, true); - Assert.AreEqual(block.CreatedAt.Value.ToString("o"), "2021-03-25T17:26:28.3050000+00:00"); + ClassicAssert.AreEqual(block.Id, "BLC456"); + ClassicAssert.AreEqual(block.BlockType, "email"); + ClassicAssert.AreEqual(block.ReasonType, "no_intent_to_pay"); + ClassicAssert.AreEqual(block.ResourceReference, "example@example.com"); + ClassicAssert.AreEqual(block.Active, true); + ClassicAssert.AreEqual(block.CreatedAt.Value.ToString("o"), "2021-03-25T17:26:28.3050000+00:00"); } [Test] @@ -61,14 +62,14 @@ public async Task ShouldBlockByRef() resp.Meta.Cursors.After.Should().BeNull(); IReadOnlyList blocks = resp.Blocks; - Assert.AreEqual(blocks[0].Id, "BLC123"); - Assert.AreEqual(blocks[0].BlockType, "email"); - Assert.AreEqual(blocks[0].ReasonType, "no_intent_to_pay"); - Assert.AreEqual(blocks[0].ResourceReference, "example@example.com"); - Assert.AreEqual(blocks[1].Id, "BLC456"); - Assert.AreEqual(blocks[1].BlockType, "bank_account"); - Assert.AreEqual(blocks[1].ReasonType, "no_intent_to_pay"); - Assert.AreEqual(blocks[1].ResourceReference, "BA123"); + ClassicAssert.AreEqual(blocks[0].Id, "BLC123"); + ClassicAssert.AreEqual(blocks[0].BlockType, "email"); + ClassicAssert.AreEqual(blocks[0].ReasonType, "no_intent_to_pay"); + ClassicAssert.AreEqual(blocks[0].ResourceReference, "example@example.com"); + ClassicAssert.AreEqual(blocks[1].Id, "BLC456"); + ClassicAssert.AreEqual(blocks[1].BlockType, "bank_account"); + ClassicAssert.AreEqual(blocks[1].ReasonType, "no_intent_to_pay"); + ClassicAssert.AreEqual(blocks[1].ResourceReference, "BA123"); } } } diff --git a/GoCardless.Tests/ErrorTests.cs b/GoCardless.Tests/ErrorTests.cs index 778edb7..7d2a8ff 100644 --- a/GoCardless.Tests/ErrorTests.cs +++ b/GoCardless.Tests/ErrorTests.cs @@ -4,6 +4,7 @@ using System.Net.Http; using System.Threading.Tasks; using NUnit.Framework; +using NUnit.Framework.Legacy; using GoCardless.Errors; using GoCardless.Exceptions; @@ -34,14 +35,14 @@ public async Task InsufficentPermissions() catch (InsufficientPermissionsException ex) { TestHelpers.AssertResponseCanSerializeBackToFixture(ex.ApiErrorResponse, responseFixture); - Assert.AreEqual(ApiErrorType.INSUFFICIENT_PERMISSIONS, ex.Type); - Assert.AreEqual("Insufficient permissions", ex.Message); - Assert.AreEqual("Insufficient permissions", ex.Errors.Single().Message); - Assert.AreEqual("insufficient_permissions", ex.Errors.Single().Reason); - Assert.AreEqual("https://developer.gocardless.com/api-reference#insufficient_permissions", + ClassicAssert.AreEqual(ApiErrorType.INSUFFICIENT_PERMISSIONS, ex.Type); + ClassicAssert.AreEqual("Insufficient permissions", ex.Message); + ClassicAssert.AreEqual("Insufficient permissions", ex.Errors.Single().Message); + ClassicAssert.AreEqual("insufficient_permissions", ex.Errors.Single().Reason); + ClassicAssert.AreEqual("https://developer.gocardless.com/api-reference#insufficient_permissions", ex.DocumentationUrl); - Assert.AreEqual("b0e48853-abcd-41fa-9554-5f71820e915d", ex.RequestId); - Assert.AreEqual(403, ex.Code); + ClassicAssert.AreEqual("b0e48853-abcd-41fa-9554-5f71820e915d", ex.RequestId); + ClassicAssert.AreEqual(403, ex.Code); return; } Assert.Fail("Exception was not thrown"); @@ -60,15 +61,15 @@ public async Task ValidationErrors() catch (ValidationFailedException ex) { TestHelpers.AssertResponseCanSerializeBackToFixture(ex.ApiErrorResponse, responseFixture); - Assert.AreEqual(ApiErrorType.VALIDATION_FAILED, ex.Type); - Assert.AreEqual("Validation failed", ex.Message); - Assert.AreEqual("scheme", ex.Errors[0].Field); - Assert.AreEqual("must be one of bacs, sepa_core, autogiro", ex.Errors[0].Message); - Assert.AreEqual("/mandates/scheme", ex.Errors[0].RequestPointer); - Assert.AreEqual("https://developer.gocardless.com/api-reference#validation_failed", + ClassicAssert.AreEqual(ApiErrorType.VALIDATION_FAILED, ex.Type); + ClassicAssert.AreEqual("Validation failed", ex.Message); + ClassicAssert.AreEqual("scheme", ex.Errors[0].Field); + ClassicAssert.AreEqual("must be one of bacs, sepa_core, autogiro", ex.Errors[0].Message); + ClassicAssert.AreEqual("/mandates/scheme", ex.Errors[0].RequestPointer); + ClassicAssert.AreEqual("https://developer.gocardless.com/api-reference#validation_failed", ex.DocumentationUrl); - Assert.AreEqual("2f33a336-abcd-4aeb-85c0-101286065dfd", ex.RequestId); - Assert.AreEqual(422, ex.Code); + ClassicAssert.AreEqual("2f33a336-abcd-4aeb-85c0-101286065dfd", ex.RequestId); + ClassicAssert.AreEqual(422, ex.Code); return; } Assert.Fail("Exception was not thrown"); @@ -91,10 +92,10 @@ public async Task TrueServerError() } catch (ApiException ex) { - Assert.AreEqual(500, ex.Code); - Assert.AreEqual(ApiErrorType.GOCARDLESS, ex.Type); - Assert.AreEqual("Something went wrong with this request. Please check the ResponseMessage property.", ex.Message); - Assert.AreEqual("500 Internal Server Error", ex.ResponseMessage.Content.ReadAsStringAsync().Result); + ClassicAssert.AreEqual(500, ex.Code); + ClassicAssert.AreEqual(ApiErrorType.GOCARDLESS, ex.Type); + ClassicAssert.AreEqual("Something went wrong with this request. Please check the ResponseMessage property.", ex.Message); + ClassicAssert.AreEqual("500 Internal Server Error", ex.ResponseMessage.Content.ReadAsStringAsync().Result); return; } Assert.Fail("Exception was not thrown"); @@ -111,10 +112,10 @@ public async Task HtmlErrorPage() } catch (ApiException ex) { - Assert.AreEqual(502, ex.Code); - Assert.AreEqual(ApiErrorType.GOCARDLESS, ex.Type); - Assert.AreEqual("Something went wrong with this request. Please check the ResponseMessage property.", ex.Message); - Assert.AreEqual("\n\n \n This is an HTML error page, like one returned by Cloudflare\n \n\n", ex.ResponseMessage.Content.ReadAsStringAsync().Result.Replace("\r\n", "\n")); + ClassicAssert.AreEqual(502, ex.Code); + ClassicAssert.AreEqual(ApiErrorType.GOCARDLESS, ex.Type); + ClassicAssert.AreEqual("Something went wrong with this request. Please check the ResponseMessage property.", ex.Message); + ClassicAssert.AreEqual("\n\n \n This is an HTML error page, like one returned by Cloudflare\n \n\n", ex.ResponseMessage.Content.ReadAsStringAsync().Result.Replace("\r\n", "\n")); return; } Assert.Fail("Exception was not thrown"); @@ -129,7 +130,7 @@ public async Task IdempotencyConflictsAreHandledAutomatically() //When an attempt to created the mandate is made var mandate = await this.client.Mandates.CreateAsync(TestHelpers.CreateMandateCreateRequest()); //Then the mandate should be successfully retrieved. - Assert.AreEqual("BA000123", mandate.Mandate.Links.CustomerBankAccount); + ClassicAssert.AreEqual("BA000123", mandate.Mandate.Links.CustomerBankAccount); } [Test] @@ -149,13 +150,13 @@ public async Task WhenAuthenticationError_ShouldShowSpecificError() } catch (AuthenticationFailedException ex) { - Assert.AreEqual(401, ex.Code); - Assert.AreEqual(ApiErrorType.AUTHENTICATION_FAILED, ex.Type); - Assert.AreEqual("Authentication Failed", ex.Message); - Assert.AreEqual("Authentication Failed", ex.Errors.Single().Message); - Assert.AreEqual("authentication_failed", ex.Errors.Single().Reason); + ClassicAssert.AreEqual(401, ex.Code); + ClassicAssert.AreEqual(ApiErrorType.AUTHENTICATION_FAILED, ex.Type); + ClassicAssert.AreEqual("Authentication Failed", ex.Message); + ClassicAssert.AreEqual("Authentication Failed", ex.Errors.Single().Message); + ClassicAssert.AreEqual("authentication_failed", ex.Errors.Single().Reason); TestHelpers.AssertResponseCanSerializeBackToFixture(ex.ApiErrorResponse, responseFixture); - Assert.AreEqual("https://developer.gocardless.com/api-reference/#api-usage-errors", + ClassicAssert.AreEqual("https://developer.gocardless.com/api-reference/#api-usage-errors", ex.DocumentationUrl); return; } @@ -179,13 +180,13 @@ public async Task WhenRateLimitReachedException_ShouldShowSpecificError() } catch (RateLimitReachedException ex) { - Assert.AreEqual(429, ex.Code); - Assert.AreEqual(ApiErrorType.RATE_LIMIT_REACHED, ex.Type); - Assert.AreEqual("Rate Limit Reached you have made too many requests", ex.Message); - Assert.AreEqual("Rate Limit Reached you have made too many requests", ex.Errors.Single().Message); - Assert.AreEqual("rate_limit_reached", ex.Errors.Single().Reason); + ClassicAssert.AreEqual(429, ex.Code); + ClassicAssert.AreEqual(ApiErrorType.RATE_LIMIT_REACHED, ex.Type); + ClassicAssert.AreEqual("Rate Limit Reached you have made too many requests", ex.Message); + ClassicAssert.AreEqual("Rate Limit Reached you have made too many requests", ex.Errors.Single().Message); + ClassicAssert.AreEqual("rate_limit_reached", ex.Errors.Single().Reason); TestHelpers.AssertResponseCanSerializeBackToFixture(ex.ApiErrorResponse, responseFixture); - Assert.AreEqual("https://developer.gocardless.com/api-reference/#making-requests-rate-limiting", + ClassicAssert.AreEqual("https://developer.gocardless.com/api-reference/#making-requests-rate-limiting", ex.DocumentationUrl); return; } diff --git a/GoCardless.Tests/FunctionalityTests.cs b/GoCardless.Tests/FunctionalityTests.cs index d81635c..a7e5aed 100644 --- a/GoCardless.Tests/FunctionalityTests.cs +++ b/GoCardless.Tests/FunctionalityTests.cs @@ -7,6 +7,7 @@ using GoCardless.Internals; using GoCardless.Services; using NUnit.Framework; +using NUnit.Framework.Legacy; using System.Threading.Tasks; using System.Linq; @@ -36,7 +37,7 @@ public async Task CanAccessResponseMessageContentAsync() //Then the responseMessage content can be read listResponse.ResponseMessage.Should().NotBeNull(); var content = await listResponse.ResponseMessage.Content.ReadAsStringAsync(); - Assert.AreEqual(File.ReadAllText("fixtures/client/list_mandates_for_a_customer.json"), content); + ClassicAssert.AreEqual(File.ReadAllText("fixtures/client/list_mandates_for_a_customer.json"), content); } [Test] @@ -48,9 +49,9 @@ public async Task Headers() var mandate = mandateResponse.Mandate; http.AssertRequestMade("POST", "/mandates", null, req => { - Assert.AreEqual("Bearer access-token", req.Item1.Headers.GetValues("Authorization").Single()); - Assert.AreEqual("2015-07-06", req.Item1.Headers.GetValues("GoCardless-Version").Single()); - Assert.AreEqual("gocardless-dotnet", req.Item1.Headers.GetValues("GoCardless-Client-Library").Single()); + ClassicAssert.AreEqual("Bearer access-token", req.Item1.Headers.GetValues("Authorization").Single()); + ClassicAssert.AreEqual("2015-07-06", req.Item1.Headers.GetValues("GoCardless-Version").Single()); + ClassicAssert.AreEqual("gocardless-dotnet", req.Item1.Headers.GetValues("GoCardless-Client-Library").Single()); }); } @@ -68,7 +69,7 @@ public async Task IdempotencyKeyIsGeneratedWhenNoneIsSet() }); //Then an idempotency key should have been set automatically by the client library - Assert.NotNull(idempotencyKey); + ClassicAssert.NotNull(idempotencyKey); } @@ -95,7 +96,7 @@ public async Task ClientCanModifyRequestBeforeSending() }); //Then the modification should have been applied to the request - Assert.NotNull(customHeader); + ClassicAssert.NotNull(customHeader); } [Test] @@ -118,11 +119,11 @@ public async Task ClientCanSetCustomHeaders() http.AssertRequestMade("POST", "/mandates", null, req => { //The brand new header we've set should be there - Assert.AreEqual(req.Item1.Headers.GetValues("Accept-Language").Single(), "fr"); + ClassicAssert.AreEqual(req.Item1.Headers.GetValues("Accept-Language").Single(), "fr"); //We should still get the default headers set by the client - Assert.NotNull(req.Item1.Headers.GetValues("Authorization").Single()); + ClassicAssert.NotNull(req.Item1.Headers.GetValues("Authorization").Single()); //Headers we set should override the client's default headers - Assert.AreEqual(req.Item1.Headers.GetValues("User-Agent").Single(), "Skynet"); + ClassicAssert.AreEqual(req.Item1.Headers.GetValues("User-Agent").Single(), "Skynet"); }); } @@ -151,17 +152,17 @@ public async Task RequestRetriesUpToThreeTimesOnTimeout(int numberOfFailures, bo //Then the idempotency keys should stay the same on successive retries var newIdempotencyKey = req.Headers.GetValues("Idempotency-Key").Single(); firstIdempotencyKey = firstIdempotencyKey ?? newIdempotencyKey; - Assert.NotNull(newIdempotencyKey); - Assert.AreEqual(firstIdempotencyKey, newIdempotencyKey, "Idempotency keys must match on retried requests"); + ClassicAssert.NotNull(newIdempotencyKey); + ClassicAssert.AreEqual(firstIdempotencyKey, newIdempotencyKey, "Idempotency keys must match on retried requests"); } }); //And if there were enough retries to handle the failures the call should succeed - Assert.True(response.ResponseMessage.IsSuccessStatusCode); + ClassicAssert.True(response.ResponseMessage.IsSuccessStatusCode); } catch (TaskCanceledException) { //And if not the call should have timed out - Assert.False(requestShouldSucceed); + ClassicAssert.False(requestShouldSucceed); } } @@ -191,17 +192,17 @@ public async Task RequestRetriesUpToThreeTimesOnConnectionFailure(int numberOfFa // Then the idempotency keys should stay the same on successive retries var newIdempotencyKey = req.Headers.GetValues("Idempotency-Key").Single(); firstIdempotencyKey = firstIdempotencyKey ?? newIdempotencyKey; - Assert.NotNull(newIdempotencyKey); - Assert.AreEqual(firstIdempotencyKey, newIdempotencyKey, "Idempotency keys must match on retried requests"); + ClassicAssert.NotNull(newIdempotencyKey); + ClassicAssert.AreEqual(firstIdempotencyKey, newIdempotencyKey, "Idempotency keys must match on retried requests"); } }); //And if there were enough retries to handle the failures the call should succeed - Assert.True(response.ResponseMessage.IsSuccessStatusCode); + ClassicAssert.True(response.ResponseMessage.IsSuccessStatusCode); } catch (HttpRequestException) { //And if not the call should have timed out - Assert.False(requestShouldSucceed); + ClassicAssert.False(requestShouldSucceed); } } @@ -234,7 +235,7 @@ public async Task RequestRetriesWithCustomValues(int numberOfFailures, bool shou } - Assert.AreEqual(shouldBeSuccessful, wasSuccessful); + ClassicAssert.AreEqual(shouldBeSuccessful, wasSuccessful); } diff --git a/GoCardless.Tests/GoCardless.Tests.csproj b/GoCardless.Tests/GoCardless.Tests.csproj index 1cca5f2..e7c22f8 100644 --- a/GoCardless.Tests/GoCardless.Tests.csproj +++ b/GoCardless.Tests/GoCardless.Tests.csproj @@ -5,10 +5,10 @@ - + - - + + diff --git a/GoCardless.Tests/MandateTests.cs b/GoCardless.Tests/MandateTests.cs index f9a09ca..513623d 100644 --- a/GoCardless.Tests/MandateTests.cs +++ b/GoCardless.Tests/MandateTests.cs @@ -5,6 +5,7 @@ using GoCardless.Resources; using GoCardless.Services; using NUnit.Framework; +using NUnit.Framework.Legacy; using FluentAssertions; namespace GoCardless.Tests @@ -38,11 +39,11 @@ public async Task ShouldListMandatesForACustomer() var listResponse = await client.Mandates.ListAsync(mandateListRequest); TestHelpers.AssertResponseCanSerializeBackToFixture(listResponse, responseFixture); var mandates = listResponse.Mandates; - Assert.AreEqual(2, mandates.Count); - Assert.AreEqual("MD00001PEYCSQF", mandates[0].Id); - Assert.AreEqual("CR000035EME9H5", mandates[0].Links.Creditor); - Assert.AreEqual("MD00001P57AN84", mandates[1].Id); - Assert.AreEqual("CR000035EME9H5", mandates[1].Links.Creditor); + ClassicAssert.AreEqual(2, mandates.Count); + ClassicAssert.AreEqual("MD00001PEYCSQF", mandates[0].Id); + ClassicAssert.AreEqual("CR000035EME9H5", mandates[0].Links.Creditor); + ClassicAssert.AreEqual("MD00001P57AN84", mandates[1].Id); + ClassicAssert.AreEqual("CR000035EME9H5", mandates[1].Links.Creditor); mockHttp.AssertRequestMade("GET", "/mandates?created_at%5Bgt%5D=2017-05-02T11%3A12%3A13.0000000-05%3A00&customer=CU00003068FG73"); } @@ -94,8 +95,8 @@ public void ShouldListMandatesByCustomerAndStatus() var mandates = mandateListResponse.Mandates; - Assert.AreEqual(mandates.Count, 1); - Assert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); + ClassicAssert.AreEqual(mandates.Count, 1); + ClassicAssert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); mockHttp.AssertRequestMade("GET", "/mandates?customer=CU00003068FG73&status=active%2Cfailed"); } @@ -115,8 +116,8 @@ public void ShouldNotDoubleEncodeUrlParameters() var mandates = mandateListResponse.Mandates; - Assert.AreEqual(mandates.Count, 1); - Assert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); + ClassicAssert.AreEqual(mandates.Count, 1); + ClassicAssert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); mockHttp.AssertRequestMade("GET", "/mandates?after=id%3AMD123&customer=CU00003068FG73&status=active%2Cfailed"); } @@ -151,9 +152,9 @@ public void ShouldIterateThroughMandates() mockHttp.EnqueueResponse(200, "fixtures/client/list_mandates_page_2.json"); var mandates = client.Mandates.All(new MandateListRequest { Limit = 2 }).ToArray(); mandates.Count().Should().Be(3); - Assert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); - Assert.AreEqual(mandates[1].Id, "MD00001P57AN84"); - Assert.AreEqual(mandates[2].Id, "MD00001P1KTRNY"); + ClassicAssert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); + ClassicAssert.AreEqual(mandates[1].Id, "MD00001P57AN84"); + ClassicAssert.AreEqual(mandates[2].Id, "MD00001P1KTRNY"); mockHttp.AssertRequestMade("GET", "/mandates?limit=2"); mockHttp.AssertRequestMade("GET", "/mandates?after=MD00001P57AN84&limit=2"); } @@ -165,9 +166,9 @@ public void ShouldIterateThroughMandatesAsync() mockHttp.EnqueueResponse(200, "fixtures/client/list_mandates_page_2.json"); var mandates = client.Mandates.AllAsync(new MandateListRequest { Limit = 2 }).SelectMany(t => t.Result).ToArray(); mandates.Count().Should().Be(3); - Assert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); - Assert.AreEqual(mandates[1].Id, "MD00001P57AN84"); - Assert.AreEqual(mandates[2].Id, "MD00001P1KTRNY"); + ClassicAssert.AreEqual(mandates[0].Id, "MD00001PEYCSQF"); + ClassicAssert.AreEqual(mandates[1].Id, "MD00001P57AN84"); + ClassicAssert.AreEqual(mandates[2].Id, "MD00001P1KTRNY"); mockHttp.AssertRequestMade("GET", "/mandates?limit=2"); mockHttp.AssertRequestMade("GET", "/mandates?after=MD00001P57AN84&limit=2"); } @@ -196,7 +197,7 @@ public async Task ShouldCreateAMandate() resp => resp.Headers.Location = new Uri("/mandates/MD000126", UriKind.Relative)); MandateResponse mandateResponse = await client.Mandates.CreateAsync(TestHelpers.CreateMandateCreateRequest()); - Assert.AreEqual(new DateTimeOffset(2017, 06, 19, 17, 01, 06, TimeSpan.FromHours(3)), + ClassicAssert.AreEqual(new DateTimeOffset(2017, 06, 19, 17, 01, 06, TimeSpan.FromHours(3)), mandateResponse.Mandate.CreatedAt, "DateTimeOffset not correct"); TestHelpers.AssertResponseCanSerializeBackToFixture(mandateResponse, responseFixture); diff --git a/GoCardless.Tests/MockHttp.cs b/GoCardless.Tests/MockHttp.cs index 1641238..071291a 100644 --- a/GoCardless.Tests/MockHttp.cs +++ b/GoCardless.Tests/MockHttp.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NUnit.Framework; +using NUnit.Framework.Legacy; using System.Linq; namespace GoCardless.Tests @@ -30,8 +31,8 @@ public void EnqueueResponse(int statusCode, string pathToBodyDocument, Action> handle = null) { var req = _requests.Dequeue(); - Assert.AreEqual(httpMethod, req.Item1.Method.ToString()); - Assert.AreEqual(url, req.Item1.RequestUri.PathAndQuery); + ClassicAssert.AreEqual(httpMethod, req.Item1.Method.ToString()); + ClassicAssert.AreEqual(url, req.Item1.RequestUri.PathAndQuery); if (pathToBodyDocument != null) { var errors = TestHelpers.GetDifferences(JToken.Parse(req.Item2), JToken.Parse(File.ReadAllText(pathToBodyDocument))); diff --git a/GoCardless.Tests/RedirectFlowTests.cs b/GoCardless.Tests/RedirectFlowTests.cs index 929f3ff..acf9336 100644 --- a/GoCardless.Tests/RedirectFlowTests.cs +++ b/GoCardless.Tests/RedirectFlowTests.cs @@ -5,6 +5,7 @@ using GoCardless.Resources; using GoCardless.Services; using NUnit.Framework; +using NUnit.Framework.Legacy; using FluentAssertions; namespace GoCardless.Tests @@ -47,7 +48,7 @@ public async Task ShouldBuildValidRequest() TestHelpers.AssertResponseCanSerializeBackToFixture(redirectFlowResponse, responseFixture); var redirectFlow = redirectFlowResponse.RedirectFlow; - Assert.AreEqual("http://pay.gocardless.dev/flow/RE123", redirectFlow.RedirectUrl); + ClassicAssert.AreEqual("http://pay.gocardless.dev/flow/RE123", redirectFlow.RedirectUrl); mockHttp.AssertRequestMade("POST", "/redirect_flows"); } } diff --git a/GoCardless.Tests/WebhookParserTests.cs b/GoCardless.Tests/WebhookParserTests.cs index 5e07df1..80c986d 100644 --- a/GoCardless.Tests/WebhookParserTests.cs +++ b/GoCardless.Tests/WebhookParserTests.cs @@ -2,6 +2,7 @@ using System.Linq; using GoCardless.Exceptions; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GoCardless.Tests { @@ -16,7 +17,7 @@ public void ShouldCorrectlyBuildEvents() { var result = WebhookParser.Parse(body, key, signature); - Assert.AreEqual(2, result.Count()); + ClassicAssert.AreEqual(2, result.Count()); } [Test] diff --git a/GoCardless/GoCardless.csproj b/GoCardless/GoCardless.csproj index 122b71d..b291003 100644 --- a/GoCardless/GoCardless.csproj +++ b/GoCardless/GoCardless.csproj @@ -2,7 +2,7 @@ GoCardless - 6.0.0 + 6.0.1 GoCardless Ltd Client for the GoCardless API - a powerful, simple solution for the collection of recurring bank-to-bank payments false @@ -11,7 +11,7 @@ GoCardless Ltd gocardless payments rest api direct debit https://github.com/gocardless/gocardless-dotnet/blob/master/LICENSE.txt - https://github.com/gocardless/gocardless-dotnet/releases/tag/v6.0.0 + https://github.com/gocardless/gocardless-dotnet/releases/tag/v6.0.1 netstandard1.6;netstandard2.0;netstandard2.1;net46;net8.0 True true diff --git a/GoCardless/GoCardlessClient.cs b/GoCardless/GoCardlessClient.cs index e6cfbda..472da23 100644 --- a/GoCardless/GoCardlessClient.cs +++ b/GoCardless/GoCardlessClient.cs @@ -277,11 +277,11 @@ private HttpRequestMessage BuildHttpRequestMessage(string method, string path runtimeFrameworkInformation = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(); #endif - var userAgentInformation = $" gocardless-dotnet/6.0.0 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}"; + var userAgentInformation = $" gocardless-dotnet/6.0.1 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}"; requestMessage.Headers.Add("User-Agent", userAgentInformation); requestMessage.Headers.Add("GoCardless-Version", "2015-07-06"); - requestMessage.Headers.Add("GoCardless-Client-Version", "6.0.0"); + requestMessage.Headers.Add("GoCardless-Client-Version", "6.0.1"); requestMessage.Headers.Add("GoCardless-Client-Library", "gocardless-dotnet"); requestMessage.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _accessToken); diff --git a/README.md b/README.md index 60d8787..4d7d2a4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For full details of the GoCardless API, see the [API docs](https://developer.goc To install `GoCardless`, run the following command in the [Package Manager Console](https://docs.microsoft.com/en-us/nuget/tools/package-manager-console) -`Install-Package GoCardless -Version 6.0.0` +`Install-Package GoCardless -Version 6.0.1` ## Usage diff --git a/tmp-push-files-checkout b/tmp-push-files-checkout index 7ee1880..65a0ae5 160000 --- a/tmp-push-files-checkout +++ b/tmp-push-files-checkout @@ -1 +1 @@ -Subproject commit 7ee18809e9501bd1d3fe3f9e79e50e2d50219a16 +Subproject commit 65a0ae50f2c55e9624069daef5289b7f36141dc2