From 844da6c888b5fa5fd158f42ec28dcda5d3881dc3 Mon Sep 17 00:00:00 2001 From: HamedSY Date: Sun, 28 Jul 2024 18:37:01 +0330 Subject: [PATCH] fix: resolve PR comments --- .../File/CreateFile/Commands/CreateFileCommandHandlerTests.cs | 2 +- .../Gitea/File/GetFile/Commands/GetFileCommand.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs b/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs index cc3a26a..a21e055 100644 --- a/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs +++ b/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs @@ -52,7 +52,7 @@ public async Task Handle_ShouldThrowsValidationException_WhenInputIsInvalid() } [Fact] - public async Task Handle_ShouldCallCreateFileAsync_AndInputsAreValid() + public async Task Handle_ShouldCallCreateFileAsync_WhenInputsAreValid() { // Arrange _validator.RuleFor(x => x).Must(_ => true); diff --git a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs index 1d2bffe..00fb989 100644 --- a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs +++ b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs @@ -45,7 +45,8 @@ public async Task> Handle(GetFileCommand command var owner = _options.Value.RepositoriesOwner; var apiResponse = await _fileRestClient.GetFileAsync(owner, command.RepositoryName, command.FilePath, getFileRequest, cancellationToken) .ConfigureAwait(false); - if (apiResponse?.Content != null) + await apiResponse.EnsureSuccessStatusCodeAsync(); + if (apiResponse.Content is not null) { apiResponse.Content.Content = _contentDecoder.Base64Decode(apiResponse.Content.Content); }