-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor integration test for checking the file sha
- Loading branch information
Alireza Eiji
committed
Aug 6, 2024
1 parent
1d61433
commit e22cc4f
Showing
7 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...iteaClient.IntegrationTests/Common/Initializers/TestData/Abstractions/ITestFileCreator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
using Mohaymen.GiteaClient.Gitea.File.CreateFile.Dtos; | ||
using Refit; | ||
|
||
namespace Mohaymen.GiteaClient.IntegrationTests.Common.Initializers.TestData.Abstractions; | ||
|
||
public interface ITestFileCreator | ||
{ | ||
Task CreateFileAsync(CreateFileCommandDto createFileCommandDto, CancellationToken cancellationToken); | ||
Task<ApiResponse<CreateFileResponseDto>> CreateFileAsync(CreateFileCommandDto createFileCommandDto, | ||
CancellationToken cancellationToken); | ||
} |
10 changes: 10 additions & 0 deletions
10
...ent.IntegrationTests/Common/Initializers/TestData/Abstractions/ITestFileMetadataGetter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Mohaymen.GiteaClient.Gitea.File.GetRepositoryFile.Dtos; | ||
|
||
namespace Mohaymen.GiteaClient.IntegrationTests.Common.Initializers.TestData.Abstractions; | ||
|
||
internal interface ITestFileMetadataGetter | ||
{ | ||
Task<GetFileResponseDto> GetFileMetadataAsync(string repositoryName, | ||
string filePath, | ||
CancellationToken cancellationToken); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Mohaymen.GiteaClient.IntegrationTests/Common/Initializers/TestData/TestFileMetadataGetter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Mohaymen.GiteaClient.Gitea.File.Common.Facade.Abstractions; | ||
using Mohaymen.GiteaClient.Gitea.File.GetRepositoryFile.Dtos; | ||
using Mohaymen.GiteaClient.IntegrationTests.Common.Initializers.TestData.Abstractions; | ||
|
||
namespace Mohaymen.GiteaClient.IntegrationTests.Common.Initializers.TestData; | ||
|
||
internal class TestFileMetadataGetter : ITestFileMetadataGetter | ||
{ | ||
private readonly IFileFacade _fileFacade; | ||
|
||
public TestFileMetadataGetter(IFileFacade fileFacade) | ||
{ | ||
_fileFacade = fileFacade ?? throw new ArgumentNullException(nameof(fileFacade)); | ||
} | ||
|
||
public async Task<GetFileResponseDto> GetFileMetadataAsync(string repositoryName, | ||
string filePath, | ||
CancellationToken cancellationToken) | ||
{ | ||
var fileMetadata = await _fileFacade.GetFileAsync(new GetFileMetadataQueryDto | ||
{ | ||
RepositoryName = repositoryName, | ||
FilePath = filePath | ||
}, cancellationToken).ConfigureAwait(false); | ||
return fileMetadata.Content!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters