From 8761f5e69331675e2d3830b32ca6bc7d58ba069f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:51:29 +0000 Subject: [PATCH 1/2] Update refit monorepo to v8 --- .../PinguApps.Appwrite.Shared.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj b/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj index bb170dee..5700ebe1 100644 --- a/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj +++ b/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj @@ -9,8 +9,8 @@ - - + + From 5c8bb01691c115387d74e3de4af4584fe641eab9 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Wed, 6 Nov 2024 02:37:13 +0000 Subject: [PATCH 2/2] Fixed failing tests for refit upgrade to v8 --- .../Utils/ResponseUtilsTests.cs | 34 +++++++++---------- .../Utils/ResponseUtilsTests.cs | 34 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs index 6a1f58d9..a08ee214 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs @@ -12,7 +12,7 @@ public class ResponseUtilsTests public void GetApiResponse_Success_ReturnsContent() { var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); var result = mockApiResponse.Object.GetApiResponse(); @@ -30,8 +30,8 @@ public async Task GetApiResponse_Failure_ReturnsError() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); var result = mockApiResponse.Object.GetApiResponse(); @@ -46,8 +46,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, new HttpResponseMessage(HttpStatusCode.InternalServerError), new RefitSettings()); var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -56,8 +56,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException() public void GetApiResponse_FailureButNullError_ThrowsException() { var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns((ApiException)null!); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -66,8 +66,8 @@ public void GetApiResponse_FailureButNullError_ThrowsException() public void GenericGetApiResponse_Success_ReturnsContent() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); - mockApiResponse.SetupGet(r => r.Content).Returns("Success"); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); + mockApiResponse.Setup(x => x.Content).Returns("Success"); var result = mockApiResponse.Object.GetApiResponse(); @@ -79,8 +79,8 @@ public void GenericGetApiResponse_Success_ReturnsContent() public void GenericGetApiResponse_SuccessButNullContent_ReturnsInternalError() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); - mockApiResponse.SetupGet(r => r.Content).Returns((string?)null); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); + mockApiResponse.Setup(r => r.Content).Returns((string?)null); var result = mockApiResponse.Object.GetApiResponse(); @@ -98,8 +98,8 @@ public async Task GenericGetApiResponse_Failure_ReturnsError() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); var result = mockApiResponse.Object.GetApiResponse(); @@ -114,8 +114,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, new HttpResponseMessage(HttpStatusCode.InternalServerError), new RefitSettings()); var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -124,8 +124,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti public void GenericGetApiResponse_FailureButNullError_ThrowsException() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns((ApiException)null!); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } diff --git a/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs b/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs index 591cc8a3..fd4ff119 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs @@ -12,7 +12,7 @@ public class ResponseUtilsTests public void GetApiResponse_Success_ReturnsContent() { var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); var result = mockApiResponse.Object.GetApiResponse(); @@ -30,8 +30,8 @@ public async Task GetApiResponse_Failure_ReturnsError() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); var result = mockApiResponse.Object.GetApiResponse(); @@ -46,8 +46,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, new HttpResponseMessage(HttpStatusCode.InternalServerError), new RefitSettings()); var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -56,8 +56,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException() public void GetApiResponse_FailureButNullError_ThrowsException() { var mockApiResponse = new Mock(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns((ApiException)null!); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -66,8 +66,8 @@ public void GetApiResponse_FailureButNullError_ThrowsException() public void GenericGetApiResponse_Success_ReturnsContent() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); - mockApiResponse.SetupGet(r => r.Content).Returns("Success"); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); + mockApiResponse.Setup(r => r.Content).Returns("Success"); var result = mockApiResponse.Object.GetApiResponse(); @@ -79,8 +79,8 @@ public void GenericGetApiResponse_Success_ReturnsContent() public void GenericGetApiResponse_SuccessButNullContent_ReturnsInternalError() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true); - mockApiResponse.SetupGet(r => r.Content).Returns((string?)null); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(true); + mockApiResponse.Setup(r => r.Content).Returns((string?)null); var result = mockApiResponse.Object.GetApiResponse(); @@ -98,8 +98,8 @@ public async Task GenericGetApiResponse_Failure_ReturnsError() var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); var result = mockApiResponse.Object.GetApiResponse(); @@ -114,8 +114,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, new HttpResponseMessage(HttpStatusCode.InternalServerError), new RefitSettings()); var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns(exception); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns(exception); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); } @@ -124,8 +124,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti public void GenericGetApiResponse_FailureButNullError_ThrowsException() { var mockApiResponse = new Mock>(); - mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false); - mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!); + mockApiResponse.As().Setup(x => x.IsSuccessStatusCode).Returns(false); + mockApiResponse.As().Setup(x => x.Error).Returns((ApiException)null!); Assert.Throws(() => mockApiResponse.Object.GetApiResponse()); }