@@ -35,6 +35,23 @@ public async Task NoLocalRepository()
3535 vsServices . Received ( 1 ) . ShowMessageBoxInfo ( OpenFromClipboardCommand . NoActiveRepositoryMessage ) ;
3636 }
3737
38+ [ Test ]
39+ public async Task DifferentLocalRepository ( )
40+ {
41+ var targetRepositoryName = "targetRepositoryName" ;
42+ var activeRepositoryName = "activeRepositoryName" ;
43+ var activeRepositoryDir = "activeRepositoryDir" ;
44+ var context = new GitHubContext { RepositoryName = targetRepositoryName } ;
45+ ( string , string ) ? gitObject = null ;
46+ var vsServices = Substitute . For < IVSServices > ( ) ;
47+ var target = CreateOpenFromClipboardCommand ( vsServices : vsServices ,
48+ contextFromClipboard : context , repositoryDir : activeRepositoryDir , repositoryName : activeRepositoryName , gitObject : gitObject ) ;
49+
50+ await target . Execute ( null ) ;
51+
52+ vsServices . Received ( 1 ) . ShowMessageBoxInfo ( string . Format ( OpenFromClipboardCommand . DifferentRepositoryMessage , context . RepositoryName ) ) ;
53+ }
54+
3855 [ Test ]
3956 public async Task CouldNotResolve ( )
4057 {
@@ -118,6 +135,7 @@ static OpenFromClipboardCommand CreateOpenFromClipboardCommand(
118135 IVSServices vsServices = null ,
119136 GitHubContext contextFromClipboard = null ,
120137 string repositoryDir = null ,
138+ string repositoryName = null ,
121139 string currentBranch = null ,
122140 ( string , string ) ? gitObject = null ,
123141 bool ? hasChanges = null )
@@ -129,6 +147,7 @@ static OpenFromClipboardCommand CreateOpenFromClipboardCommand(
129147
130148 gitHubContextService . FindContextFromClipboard ( ) . Returns ( contextFromClipboard ) ;
131149 teamExplorerContext . ActiveRepository . LocalPath . Returns ( repositoryDir ) ;
150+ teamExplorerContext . ActiveRepository . Name . Returns ( repositoryName ) ;
132151 teamExplorerContext . ActiveRepository . CurrentBranch . Name . Returns ( currentBranch ) ;
133152 if ( gitObject != null )
134153 {
0 commit comments