File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
test/GitLabApiClient.Test Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -23,22 +23,27 @@ internal TagClient(
23
23
}
24
24
25
25
public async Task < Tag > GetAsync ( string projectId , string tagName ) =>
26
- await _httpFacade . Get < Tag > ( $ "projects/ { projectId } /repository/tags /{ tagName } ") ;
26
+ await _httpFacade . Get < Tag > ( TagsBaseUrl ( projectId ) + " /{tagName}") ;
27
27
28
28
public async Task < IList < Tag > > GetAsync ( string projectId , Action < TagQueryOptions > options )
29
29
{
30
30
var queryOptions = new TagQueryOptions ( projectId ) ;
31
31
options ? . Invoke ( queryOptions ) ;
32
32
33
- string url = _tagQueryBuilder . Build ( $ "projects/ { projectId } /tags" , queryOptions ) ;
33
+ string url = _tagQueryBuilder . Build ( TagsBaseUrl ( projectId ) , queryOptions ) ;
34
34
return await _httpFacade . GetPagedList < Tag > ( url ) ;
35
35
}
36
36
37
37
public async Task < Tag > CreateAsync ( CreateTagRequest request ) =>
38
- await _httpFacade . Post < Tag > ( $ "projects/ { request . ProjectId } /repository/tags" , request ) ;
38
+ await _httpFacade . Post < Tag > ( TagsBaseUrl ( request . ProjectId ) , request ) ;
39
39
40
40
public async Task DeleteAsync ( DeleteTagRequest request ) =>
41
- await _httpFacade . Delete ( $ "projects/ { request . ProjectId } /repository/tags /{ request . TagName } ") ;
41
+ await _httpFacade . Delete ( TagsBaseUrl ( request . ProjectId ) + " /{request.TagName}") ;
42
42
43
+ public static string TagsBaseUrl ( string projectId )
44
+ {
45
+ string baseUrl = $ "projects/{ projectId } /repository/tags";
46
+ return baseUrl ;
47
+ }
43
48
}
44
49
}
Original file line number Diff line number Diff line change
1
+ using FluentAssertions ;
2
+ using Xunit ;
3
+
4
+ namespace GitLabApiClient . Test
5
+ {
6
+ [ Trait ( "Category" , "LinuxIntegration" ) ]
7
+ [ Collection ( "GitLabContainerFixture" ) ]
8
+ public class TagsClientTest
9
+ {
10
+ private const string ProjectId = "testProjectId" ;
11
+
12
+ [ Fact ]
13
+ public void TagsBaseUrlTest ( )
14
+ {
15
+ string baseUrl = TagClient . TagsBaseUrl ( ProjectId ) ;
16
+ baseUrl . Should ( ) . Be ( "projects/" + ProjectId + "/repository/tags" ) ;
17
+ }
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments