@@ -7,7 +7,6 @@ public class UriStringTests
77{
88 public class TheConstructor : TestBaseClass
99 {
10-
1110 [ TestCase ( "http://192.168.1.3/foo/bar.git" , "192.168.1.3" , "foo" , "bar" ) ]
1211 [ TestCase ( "http://haacked@example.com/foo/bar" , "example.com" , "foo" , "bar" ) ]
1312 [ TestCase ( "http://haacked:password@example.com/foo/bar" , "example.com" , "foo" , "bar" ) ]
@@ -41,7 +40,6 @@ public void ParsesWellFormedUrlComponents(string url, string expectedHost, strin
4140 Assert . False ( cloneUrl . IsFileUri ) ;
4241 }
4342
44-
4543 [ TestCase ( @"..\bar\foo" ) ]
4644 [ TestCase ( @"..\..\foo" ) ]
4745 [ TestCase ( @"../..\foo" ) ]
@@ -67,7 +65,6 @@ public void ParsesLocalFileUris(string path)
6765 Assert . True ( cloneUrl . IsFileUri ) ;
6866 }
6967
70-
7168 [ TestCase ( "complete garbage" , "" , "" , null ) ]
7269 [ TestCase ( @"..\other_folder" , "" , "" , "other_folder" ) ]
7370 [ TestCase ( "http://example.com" , "example.com" , null , null ) ]
@@ -89,7 +86,6 @@ public void ParsesWeirdUrlsAsWellAsPossible(string url, string expectedHost, str
8986 Assert . That ( cloneUrl . RepositoryName , Is . EqualTo ( repositoryName ) ) ;
9087 }
9188
92-
9389 [ TestCase ( @"http:\\example.com/bar\baz" ) ]
9490 [ TestCase ( @"http://example.com/bar/baz" ) ]
9591 public void NormalizesSeparator ( string uriString )
@@ -107,7 +103,6 @@ public void AcceptsNullConversion()
107103
108104 public class TheNameWithOwnerProperty : TestBaseClass
109105 {
110-
111106 [ TestCase ( "http://192.168.1.3/foo/bar.git" , "foo/bar" ) ]
112107 [ TestCase ( "http://192.168.1.3/foo/bar" , "foo/bar" ) ]
113108 [ TestCase ( "http://192.168.1.3/foo/bar/baz/qux" , "baz/qux" ) ]
@@ -125,7 +120,6 @@ public void DependsOnOwnerAndRepoNameNotBeingNull(string url, string expectedNam
125120
126121 public class TheCombineMethod : TestBaseClass
127122 {
128-
129123 [ TestCase ( "http://example.com" , "foo/bar" , @"http://example.com/foo/bar" ) ]
130124 [ TestCase ( "http://example.com/" , "foo/bar" , @"http://example.com/foo/bar" ) ]
131125 [ TestCase ( "http://example.com/" , "/foo/bar/" , @"http://example.com/foo/bar/" ) ]
@@ -146,7 +140,6 @@ public void ComparesHostInsensitively(string uriString, string path, string expe
146140
147141 public class TheIsValidUriProperty : TestBaseClass
148142 {
149-
150143 [ TestCase ( "http://example.com/" , true ) ]
151144 [ TestCase ( "file:///C:/dev/exp/foo" , true ) ]
152145 [ TestCase ( "garbage" , false ) ]
@@ -159,7 +152,6 @@ public void ReturnWhetherTheUriIsParseableByUri(string uriString, bool expected)
159152
160153 public class TheToRepositoryUrlMethod : TestBaseClass
161154 {
162-
163155 [ TestCase ( "file:///C:/dev/exp/foo" , "file:///C:/dev/exp/foo" ) ]
164156 [ TestCase ( "http://example.com/" , "http://example.com/" ) ]
165157 [ TestCase ( "http://haacked@example.com/foo/bar" , "http://example.com/foo/bar" ) ]
@@ -176,7 +168,6 @@ public void ConvertsToWebUrl(string uriString, string expected)
176168 Assert . That ( new UriString ( uriString ) . ToRepositoryUrl ( ) , Is . EqualTo ( new Uri ( expected ) ) ) ;
177169 }
178170
179-
180171 [ TestCase ( "file:///C:/dev/exp/foo" , "file:///C:/dev/exp/foo" ) ]
181172 [ TestCase ( "http://example.com/" , "http://example.com/" ) ]
182173 [ TestCase ( "http://haacked@example.com/foo/bar" , "http://example.com/baz/bar" ) ]
@@ -208,7 +199,7 @@ public void ConvertsWithNewOwner(string uriString, string expected, string owner
208199 [ TestCase ( "git@example.com:org/repo.git" , "https://example.com/org/repo" ) ]
209200 [ TestCase ( "ssh://git@github.com:443/shana/cef" , "https://github.com/shana/cef" ) ]
210201 [ TestCase ( "ssh://git@example.com:23/haacked/encourage" , "https://example.com:23/haacked/encourage" ) ]
211-
202+
212203 [ TestCase ( "asdf" , null ) ]
213204 [ TestCase ( "" , null ) ]
214205 [ TestCase ( "file:///C:/dev/exp/foo" , "file:///C:/dev/exp/foo" ) ]
@@ -233,7 +224,6 @@ public void ShouldNeverThrow(string url, string expected)
233224
234225 public class TheAdditionOperator : TestBaseClass
235226 {
236-
237227 [ TestCase ( "http://example.com" , "foo/bar" , @"http://example.com/foo/bar" ) ]
238228 [ TestCase ( "http://example.com/" , "foo/bar" , @"http://example.com/foo/bar" ) ]
239229 [ TestCase ( "http://example.com/" , "/foo/bar/" , @"http://example.com/foo/bar/" ) ]
@@ -293,7 +283,6 @@ public void ConvertsNullToNull()
293283
294284 public class TheIsHypertextTransferProtocolProperty : TestBaseClass
295285 {
296-
297286 [ TestCase ( "http://example.com" , true ) ]
298287 [ TestCase ( "HTTP://example.com" , true ) ]
299288 [ TestCase ( "https://example.com" , true ) ]
@@ -310,7 +299,6 @@ public void IsTrueOnlyForHttpAndHttps(string url, bool expected)
310299
311300 public class TheEqualsMethod : TestBaseClass
312301 {
313-
314302 [ TestCase ( "https://github.com/foo/bar" , "https://github.com/foo/bar" , true ) ]
315303 [ TestCase ( "https://github.com/foo/bar" , "https://github.com/foo/BAR" , false ) ]
316304 [ TestCase ( "https://github.com/foo/bar" , "https://github.com/foo/bar/" , false ) ]
@@ -334,4 +322,29 @@ public void MakesUriStringSuitableForDictionaryKey()
334322 Assert . True ( dictionary . ContainsKey ( new UriString ( "https://github.com/foo/bar" ) ) ) ;
335323 }
336324 }
325+
326+ public class TheRepositoryUrlsAreEqualMethod
327+ {
328+ [ TestCase ( "https://github.com/owner/repo" , "https://github.com/owner/repo" , true ) ]
329+ [ TestCase ( "https://github.com/owner/repo" , "HTTPS://github.com/OWNER/REPO" , true ) ]
330+ [ TestCase ( "https://github.com/owner/repo.git" , "https://github.com/owner/repo" , true ) ]
331+ [ TestCase ( "https://github.com/owner/repo" , "https://github.com/owner/repo.git" , true ) ]
332+ [ TestCase ( "https://github.com/owner/repo" , "https://github.com/different_owner/repo" , false ) ]
333+ [ TestCase ( "https://github.com/owner/repo" , "https://github.com/owner/different_repo" , false ) ]
334+ [ TestCase ( "ssh://git@github.com:443/shana/cef" , "https://github.com/shana/cef" , false ) ]
335+ [ TestCase ( "file://github.com/github/visualstudio" , "https://github.com/github/visualstudio" , false ) ]
336+ [ TestCase ( "http://github.com/github/visualstudio" , "https://github.com/github/visualstudio" , false ,
337+ Description = "http is different to https" ) ]
338+ [ TestCase ( "ssh://git@github.com:443/shana/cef" , "ssh://git@github.com:443/shana/cef" , false ,
339+ Description = "The same but not a repository URL" ) ]
340+ public void RepositoryUrlsAreEqual ( string url1 , string url2 , bool expectEqual )
341+ {
342+ var uriString1 = new UriString ( url1 ) ;
343+ var uriString2 = new UriString ( url2 ) ;
344+
345+ var equal = UriString . RepositoryUrlsAreEqual ( uriString1 , uriString2 ) ;
346+
347+ Assert . That ( equal , Is . EqualTo ( expectEqual ) ) ;
348+ }
349+ }
337350}
0 commit comments