@@ -325,24 +325,27 @@ public void RepositoryHome(string windowTitle, string expectOwner, string expect
325325
326326 public class TheResolveGitObjectMethod
327327 {
328- [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "master:foo.cs" , "master" , "foo.cs" ) ]
329- [ TestCase ( "https://github.com/github/VisualStudio/blob/master/src/foo.cs" , "master:src/foo.cs" , "master" , "src/foo.cs" ) ]
330- [ TestCase ( "https://github.com/github/VisualStudio/blob/branch-name/src/foo.cs" , "branch-name:src/foo.cs" , "branch-name" , "src/foo.cs" ) ]
331- [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/src/foo.cs" , "fixes/666-bug:src/foo.cs" , "fixes/666-bug" , "src/foo.cs" ) ]
332- [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/A/B/foo.cs" , "fixes/666-bug:A/B/foo.cs" , "fixes/666-bug" , "A/B/foo.cs" ) ]
333- public void ResolveGitObject ( string url , string treeish , string expectCommitish , string expectPath )
328+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "master" , "master:foo.cs" , "master" , "foo.cs" ) ]
329+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/src/foo.cs" , "master" , "master:src/foo.cs" , "master" , "src/foo.cs" ) ]
330+ [ TestCase ( "https://github.com/github/VisualStudio/blob/branch-name/src/foo.cs" , "branch-name" , "branch-name:src/foo.cs" , "branch-name" , "src/foo.cs" ) ]
331+ [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/src/foo.cs" , "fixes/666-bug" , "fixes/666-bug:src/foo.cs" , "fixes/666-bug" , "src/foo.cs" ) ]
332+ [ TestCase ( "https://github.com/github/VisualStudio/blob/fixes/666-bug/A/B/foo.cs" , "fixes/666-bug" , "fixes/666-bug:A/B/foo.cs" , "fixes/666-bug" , "A/B/foo.cs" ) ]
333+ [ TestCase ( "https://github.com/github/VisualStudio/blob/master/foo.cs" , "master" , "" , "master" , null , Description = "Resolve commit only" ) ]
334+ public void ResolveGitObject ( string url , string commitish , string objectish , string expectCommitish , string expectPath )
334335 {
335336 var repositoryDir = "repositoryDir" ;
336337 var repository = Substitute . For < IRepository > ( ) ;
337- var expectGitObject = Substitute . For < GitObject > ( ) ;
338- repository . Lookup ( treeish ) . Returns ( expectGitObject ) ;
338+ var commit = Substitute . For < Commit > ( ) ;
339+ var blob = Substitute . For < Blob > ( ) ;
340+ repository . Lookup ( commitish ) . Returns ( commit ) ;
341+ repository . Lookup ( objectish ) . Returns ( blob ) ;
339342 var target = CreateGitHubContextService ( repositoryDir , repository ) ;
340343 var context = target . FindContextFromUrl ( url ) ;
341344
342- var ( commitish , path ) = target . ResolveGitObject ( repositoryDir , context ) ;
345+ var ( resolvedCommitish , resolvedPath ) = target . ResolveGitObject ( repositoryDir , context ) ;
343346
344- Assert . That ( commitish , Is . EqualTo ( expectCommitish ) ) ;
345- Assert . That ( path , Is . EqualTo ( expectPath ) ) ;
347+ Assert . That ( resolvedCommitish , Is . EqualTo ( expectCommitish ) ) ;
348+ Assert . That ( resolvedPath , Is . EqualTo ( expectPath ) ) ;
346349 }
347350 }
348351
0 commit comments