@@ -151,45 +151,22 @@ public void NoActiveRepositoryChange_SolutionChanges()
151151
152152 public class TheStatusChangedEvent
153153 {
154- [ TestCase ( false , "name1" , "sha1" , "name1" , "sha1" , false ) ]
155- [ TestCase ( false , "name1" , "sha1" , "name2" , "sha1" , true ) ]
156- [ TestCase ( false , "name1" , "sha1" , "name1" , "sha2" , true ) ]
157- [ TestCase ( false , "name1" , "sha1" , "name2" , "sha2" , true ) ]
158- [ TestCase ( true , "name1" , "sha1" , "name1" , "sha1" , false ) ]
159- [ TestCase ( true , "name1" , "sha1" , "name2" , "sha2" , false ) ]
160- public void SameActiveRepository_ExpectWasRaised ( bool changePath , string name1 , string sha1 , string name2 , string sha2 , bool expectWasRaised )
154+ [ TestCase ( true , false ) ]
155+ [ TestCase ( false , true ) ]
156+ public void AlwaysFireWhenNoLocalPathChange ( bool changePath , bool expectWasRaised )
161157 {
162158 var gitExt = CreateGitExt ( ) ;
163159 var repositoryPaths = new [ ] { Directory . GetCurrentDirectory ( ) , Path . GetTempPath ( ) } ;
164160 var path1 = Directory . GetCurrentDirectory ( ) ;
165161 var path2 = changePath ? Path . GetTempPath ( ) : path1 ;
166- var repoInfo1 = CreateRepositoryModel ( path1 , name1 , sha1 ) ;
167- var repoInfo2 = CreateRepositoryModel ( path2 , name2 , sha2 ) ;
162+ var repoInfo1 = CreateRepositoryModel ( path1 ) ;
163+ var repoInfo2 = CreateRepositoryModel ( path2 ) ;
168164
169165 var target = CreateTeamExplorerContext ( gitExt ) ;
170- var eventWasRaised = false ;
171- target . StatusChanged += ( s , e ) => eventWasRaised = true ;
172166
173- SetActiveRepository ( gitExt , repoInfo1 ) ;
174- SetActiveRepository ( gitExt , repoInfo2 ) ;
175-
176- Assert . That ( eventWasRaised , Is . EqualTo ( expectWasRaised ) ) ;
177- }
178-
179- [ TestCase ( "trackedSha" , "trackedSha" , false ) ]
180- [ TestCase ( "trackedSha1" , "trackedSha2" , true ) ]
181- public void TrackedShaChanges_CheckWasRaised ( string trackedSha1 , string trackedSha2 , bool expectWasRaised )
182- {
183- var gitExt = CreateGitExt ( ) ;
184- var repositoryPaths = new [ ] { Directory . GetCurrentDirectory ( ) , Path . GetTempPath ( ) } ;
185- var repoPath = Directory . GetCurrentDirectory ( ) ;
186- var repoInfo1 = CreateRepositoryModel ( repoPath , "name" , "sha" , trackedSha1 ) ;
187- var repoInfo2 = CreateRepositoryModel ( repoPath , "name" , "sha" , trackedSha2 ) ;
188- var target = CreateTeamExplorerContext ( gitExt ) ;
189167 SetActiveRepository ( gitExt , repoInfo1 ) ;
190168 var eventWasRaised = false ;
191169 target . StatusChanged += ( s , e ) => eventWasRaised = true ;
192-
193170 SetActiveRepository ( gitExt , repoInfo2 ) ;
194171
195172 Assert . That ( eventWasRaised , Is . EqualTo ( expectWasRaised ) ) ;
@@ -200,7 +177,7 @@ public void SolutionUnloadedAndReloaded_DontFireStatusChanged()
200177 {
201178 var gitExt = CreateGitExt ( ) ;
202179 var path = Directory . GetCurrentDirectory ( ) ;
203- var repoInfo1 = CreateRepositoryModel ( path , "name" , "sha" ) ;
180+ var repoInfo1 = CreateRepositoryModel ( path ) ;
204181 var repoInfo2 = CreateRepositoryModel ( null ) ;
205182 var target = CreateTeamExplorerContext ( gitExt ) ;
206183 SetActiveRepository ( gitExt , repoInfo1 ) ;
@@ -226,15 +203,10 @@ static TeamExplorerContext CreateTeamExplorerContext(
226203 return new TeamExplorerContext ( gitExt , new AsyncLazy < DTE > ( ( ) => Task . FromResult ( dte ) ) , pullRequestService , joinableTaskContext ) ;
227204 }
228205
229- static ILocalRepositoryModel CreateRepositoryModel ( string path , string branchName = null , string headSha = null , string trackedSha = null )
206+ static ILocalRepositoryModel CreateRepositoryModel ( string path )
230207 {
231208 var repo = Substitute . For < ILocalRepositoryModel > ( ) ;
232209 repo . LocalPath . Returns ( path ) ;
233- var currentBranch = Substitute . For < IBranch > ( ) ;
234- currentBranch . Name . Returns ( branchName ) ;
235- currentBranch . Sha . Returns ( headSha ) ;
236- currentBranch . TrackedSha . Returns ( trackedSha ) ;
237- repo . CurrentBranch . Returns ( currentBranch ) ;
238210 return repo ;
239211 }
240212
0 commit comments