@@ -30,11 +30,15 @@ public void EmptyHosts()
30
30
}
31
31
32
32
[ Theory ]
33
- [ InlineData ( "" , "" ) ]
34
- [ InlineData ( "" , "/" ) ]
35
- [ InlineData ( "/" , "" ) ]
36
- [ InlineData ( "/" , "/" ) ]
37
- public void BuildSourceLinkUrl ( string s1 , string s2 )
33
+ [ InlineData ( "" , "" , null ) ]
34
+ [ InlineData ( "" , "/" , null ) ]
35
+ [ InlineData ( "/" , "" , null ) ]
36
+ [ InlineData ( "/" , "/" , null ) ]
37
+ [ InlineData ( "" , "" , "12.0" ) ]
38
+ [ InlineData ( "" , "/" , "12.0" ) ]
39
+ [ InlineData ( "/" , "" , "12.0" ) ]
40
+ [ InlineData ( "/" , "/" , "12.0" ) ]
41
+ public void BuildSourceLinkUrl ( string s1 , string s2 , string version )
38
42
{
39
43
var engine = new MockEngine ( ) ;
40
44
@@ -44,7 +48,33 @@ public void BuildSourceLinkUrl(string s1, string s2)
44
48
SourceRoot = new MockItem ( "/src/" , KVP ( "RepositoryUrl" , "http://subdomain.mygitlab.com:100/a/b" + s1 ) , KVP ( "SourceControl" , "git" ) , KVP ( "RevisionId" , "0123456789abcdefABCDEF000000000000000000" ) ) ,
45
49
Hosts = new [ ]
46
50
{
47
- new MockItem ( "mygitlab.com" , KVP ( "ContentUrl" , "https://domain.com/x/y" + s2 ) ) ,
51
+ version == null
52
+ ? new MockItem ( "mygitlab.com" , KVP ( "ContentUrl" , "https://domain.com/x/y" + s2 ) )
53
+ : new MockItem ( "mygitlab.com" , KVP ( "ContentUrl" , "https://domain.com/x/y" + s2 ) , KVP ( "Version" , version ) ) ,
54
+ }
55
+ } ;
56
+
57
+ bool result = task . Execute ( ) ;
58
+ AssertEx . AssertEqualToleratingWhitespaceDifferences ( "" , engine . Log ) ;
59
+ AssertEx . AreEqual ( "https://domain.com/x/y/a/b/-/raw/0123456789abcdefABCDEF000000000000000000/*" , task . SourceLinkUrl ) ;
60
+ Assert . True ( result ) ;
61
+ }
62
+
63
+ [ Theory ]
64
+ [ InlineData ( "" , "/" , "11.0" ) ]
65
+ [ InlineData ( "/" , "" , "11.0" ) ]
66
+ [ InlineData ( "/" , "/" , "11.0" ) ]
67
+ public void BuildSourceLinkUrl_DeprecatedVersion ( string s1 , string s2 , string version )
68
+ {
69
+ var engine = new MockEngine ( ) ;
70
+
71
+ var task = new GetSourceLinkUrl ( )
72
+ {
73
+ BuildEngine = engine ,
74
+ SourceRoot = new MockItem ( "/src/" , KVP ( "RepositoryUrl" , "http://subdomain.mygitlab.com:100/a/b" + s1 ) , KVP ( "SourceControl" , "git" ) , KVP ( "RevisionId" , "0123456789abcdefABCDEF000000000000000000" ) ) ,
75
+ Hosts = new [ ]
76
+ {
77
+ new MockItem ( "mygitlab.com" , KVP ( "ContentUrl" , "https://domain.com/x/y" + s2 ) , KVP ( "Version" , version ) ) ,
48
78
}
49
79
} ;
50
80
0 commit comments