@@ -325,19 +325,22 @@ public void RepositoryHome(string windowTitle, string expectOwner, string expect
325325
326326 public class TheResolveBlobMethod
327327 {
328- [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "refs/remotes/origin/master" , "refs/remotes/origin/master:foo.cs" , "refs/remotes/origin/master" , "foo.cs" ) ]
329- [ TestCase ( "https://github.com/github/VisualStudio/blob/master/src/foo.cs" , "refs/remotes/origin/master" , "refs/remotes/origin/master:src/foo.cs" , "refs/remotes/origin/master" , "src/foo.cs" ) ]
330- [ TestCase ( "https://github.com/github/VisualStudio/blob/branch-name/src/foo.cs" , "refs/remotes/origin/branch-name" , "refs/remotes/origin/branch-name:src/foo.cs" , "refs/remotes/origin/branch-name" , "src/foo.cs" ) ]
331- [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/src/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "refs/remotes/origin/fixes/666-bug:src/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "src/foo.cs" ) ]
332- [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/A/B/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "refs/remotes/origin/fixes/666-bug:A/B/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "A/B/foo.cs" ) ]
333- [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "refs/remotes/origin/master" , null , "refs/remotes/origin/master" , null , Description = "Resolve commit only" ) ]
334- [ TestCase ( "https://github.com/github/VisualStudio/blob/36d6b0bb6e319337180d523281c42d9611744e66/src/code.cs" , "36d6b0bb6e319337180d523281c42d9611744e66" , "36d6b0bb6e319337180d523281c42d9611744e66:src/code.cs" , "36d6b0bb6e319337180d523281c42d9611744e66" , "src/code.cs" , true , Description = "Resolve commit only" ) ]
335- [ TestCase ( "https://github.com/github/VisualStudio/commit/8cf9a268c497adb4fc0a14572253165e179dd11e" , "8cf9a268c497adb4fc0a14572253165e179dd11e" , null , null , null ) ]
336- public void ResolveBlob ( string url , string commitish , string objectish , string expectCommitish , string expectPath , bool expectIsSha = false )
328+ const string CommitSha = "36d6b0bb6e319337180d523281c42d9611744e66" ;
329+
330+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "refs/remotes/origin/master" , "refs/remotes/origin/master:foo.cs" , "refs/remotes/origin/master" , "foo.cs" , CommitSha ) ]
331+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/src/foo.cs" , "refs/remotes/origin/master" , "refs/remotes/origin/master:src/foo.cs" , "refs/remotes/origin/master" , "src/foo.cs" , CommitSha ) ]
332+ [ TestCase ( "https://github.com/github/VisualStudio/blob/branch-name/src/foo.cs" , "refs/remotes/origin/branch-name" , "refs/remotes/origin/branch-name:src/foo.cs" , "refs/remotes/origin/branch-name" , "src/foo.cs" , CommitSha ) ]
333+ [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/src/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "refs/remotes/origin/fixes/666-bug:src/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "src/foo.cs" , CommitSha ) ]
334+ [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/A/B/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "refs/remotes/origin/fixes/666-bug:A/B/foo.cs" , "refs/remotes/origin/fixes/666-bug" , "A/B/foo.cs" , CommitSha ) ]
335+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "refs/remotes/origin/master" , null , "refs/remotes/origin/master" , null , CommitSha , Description = "Resolve commit only" ) ]
336+ [ TestCase ( "https://github.com/github/VisualStudio/blob/36d6b0bb6e319337180d523281c42d9611744e66/src/code.cs" , CommitSha , CommitSha + ":src/code.cs" , CommitSha , "src/code.cs" , CommitSha , Description = "Resolve commit only" ) ]
337+ [ TestCase ( "https://github.com/github/VisualStudio/commit/8cf9a268c497adb4fc0a14572253165e179dd11e" , "8cf9a268c497adb4fc0a14572253165e179dd11e" , null , null , null , null ) ]
338+ public void ResolveBlob ( string url , string commitish , string objectish , string expectCommitish , string expectPath , string expectCommitSha )
337339 {
338340 var repositoryDir = "repositoryDir" ;
339341 var repository = Substitute . For < IRepository > ( ) ;
340342 var commit = Substitute . For < Commit > ( ) ;
343+ commit . Sha . Returns ( expectCommitSha ) ;
341344 var blob = Substitute . For < Blob > ( ) ;
342345 repository . Lookup ( commitish ) . Returns ( commit ) ;
343346 repository . Lookup ( objectish ) . Returns ( blob ) ;
@@ -349,11 +352,11 @@ public void ResolveBlob(string url, string commitish, string objectish, string e
349352 var target = CreateGitHubContextService ( repositoryDir , repository ) ;
350353 var context = target . FindContextFromUrl ( url ) ;
351354
352- var ( resolvedCommitish , resolvedPath , isSha ) = target . ResolveBlob ( repositoryDir , context ) ;
355+ var ( resolvedCommitish , resolvedPath , commitSha ) = target . ResolveBlob ( repositoryDir , context ) ;
353356
354357 Assert . That ( resolvedCommitish , Is . EqualTo ( expectCommitish ) ) ;
355358 Assert . That ( resolvedPath , Is . EqualTo ( expectPath ) ) ;
356- Assert . That ( isSha , Is . EqualTo ( expectIsSha ) ) ;
359+ Assert . That ( commitSha , Is . EqualTo ( expectCommitSha ) ) ;
357360 }
358361 }
359362
0 commit comments