diff --git a/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj b/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj index bb170de..5700ebe 100644 --- a/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj +++ b/src/PinguApps.Appwrite.Shared/PinguApps.Appwrite.Shared.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs index 6a1f58d..a08ee21 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 591cc8a..fd4ff11 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()); }