Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency Refit.HttpClientFactory to v8 #525

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.10.0" />
<PackageReference Include="OneOf" Version="3.0.271" />
<PackageReference Include="Refit" Version="7.2.1" />
<PackageReference Include="Refit.HttpClientFactory" Version="7.2.1" />
<PackageReference Include="Refit" Version="8.0.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

Expand Down
34 changes: 17 additions & 17 deletions tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ResponseUtilsTests
public void GetApiResponse_Success_ReturnsContent()
{
var mockApiResponse = new Mock<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -56,8 +56,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException()
public void GetApiResponse_FailureButNullError_ThrowsException()
{
var mockApiResponse = new Mock<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns((ApiException)null!);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -66,8 +66,8 @@ public void GetApiResponse_FailureButNullError_ThrowsException()
public void GenericGetApiResponse_Success_ReturnsContent()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.SetupGet(r => r.Content).Returns("Success");
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);
mockApiResponse.Setup(x => x.Content).Returns("Success");

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -79,8 +79,8 @@ public void GenericGetApiResponse_Success_ReturnsContent()
public void GenericGetApiResponse_SuccessButNullContent_ReturnsInternalError()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.SetupGet(r => r.Content).Returns((string?)null);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);
mockApiResponse.Setup(r => r.Content).Returns((string?)null);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -124,8 +124,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti
public void GenericGetApiResponse_FailureButNullError_ThrowsException()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns((ApiException)null!);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand Down
34 changes: 17 additions & 17 deletions tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ResponseUtilsTests
public void GetApiResponse_Success_ReturnsContent()
{
var mockApiResponse = new Mock<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -56,8 +56,8 @@ public async Task GetApiResponse_FailureButNullErrorContent_ThrowsException()
public void GetApiResponse_FailureButNullError_ThrowsException()
{
var mockApiResponse = new Mock<IApiResponse>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns((ApiException)null!);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -66,8 +66,8 @@ public void GetApiResponse_FailureButNullError_ThrowsException()
public void GenericGetApiResponse_Success_ReturnsContent()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.SetupGet(r => r.Content).Returns("Success");
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);
mockApiResponse.Setup(r => r.Content).Returns("Success");

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -79,8 +79,8 @@ public void GenericGetApiResponse_Success_ReturnsContent()
public void GenericGetApiResponse_SuccessButNullContent_ReturnsInternalError()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(true);
mockApiResponse.SetupGet(r => r.Content).Returns((string?)null);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(true);
mockApiResponse.Setup(r => r.Content).Returns((string?)null);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

var result = mockApiResponse.Object.GetApiResponse();

Expand All @@ -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<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns(exception);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns(exception);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand All @@ -124,8 +124,8 @@ public async Task GenericGetApiResponse_FailureButNullErrorContent_ThrowsExcepti
public void GenericGetApiResponse_FailureButNullError_ThrowsException()
{
var mockApiResponse = new Mock<IApiResponse<string>>();
mockApiResponse.SetupGet(r => r.IsSuccessStatusCode).Returns(false);
mockApiResponse.SetupGet(x => x.Error).Returns((ApiException)null!);
mockApiResponse.As<IApiResponse>().Setup(x => x.IsSuccessStatusCode).Returns(false);
mockApiResponse.As<IApiResponse>().Setup(x => x.Error).Returns((ApiException)null!);

Assert.Throws<Exception>(() => mockApiResponse.Object.GetApiResponse());
}
Expand Down