@@ -129,6 +129,73 @@ await RepositoryManager
129129 repositoryManagerListener . DidNotReceive ( ) . OnLocksUpdated ( Args . EnumerableGitLock ) ;
130130 }
131131
132+ [ Test , Category ( "TimeSensitive" ) ]
133+ public async Task ShouldAddAndCommitAllFiles ( )
134+ {
135+ await Initialize ( TestRepoMasterCleanSynchronized ) ;
136+
137+ var repositoryManagerListener = Substitute . For < IRepositoryManagerListener > ( ) ;
138+ repositoryManagerListener . AttachListener ( RepositoryManager , repositoryManagerEvents ) ;
139+
140+ var expectedAfterChanges = new GitStatus {
141+ Behind = 1 ,
142+ LocalBranch = "master" ,
143+ RemoteBranch = "origin/master" ,
144+ Entries =
145+ new List < GitStatusEntry > {
146+ new GitStatusEntry ( "Assets\\ TestDocument.txt" ,
147+ TestRepoMasterCleanSynchronized . Combine ( "Assets" , "TestDocument.txt" ) ,
148+ "Assets\\ TestDocument.txt" , GitFileStatus . Modified ) ,
149+ new GitStatusEntry ( "foobar.txt" , TestRepoMasterCleanSynchronized . Combine ( "foobar.txt" ) ,
150+ "foobar.txt" , GitFileStatus . Untracked )
151+ }
152+ } ;
153+
154+ var result = new GitStatus ( ) ;
155+ RepositoryManager . OnStatusUpdated += status => { result = status ; } ;
156+
157+ var foobarTxt = TestRepoMasterCleanSynchronized . Combine ( "foobar.txt" ) ;
158+ foobarTxt . WriteAllText ( "foobar" ) ;
159+
160+ var testDocumentTxt = TestRepoMasterCleanSynchronized . Combine ( "Assets" , "TestDocument.txt" ) ;
161+ testDocumentTxt . WriteAllText ( "foobar" ) ;
162+ await TaskManager . Wait ( ) ;
163+ WaitForNotBusy ( repositoryManagerEvents , 1 ) ;
164+ RepositoryManager . WaitForEvents ( ) ;
165+ WaitForNotBusy ( repositoryManagerEvents , 1 ) ;
166+
167+ repositoryManagerListener . Received ( ) . OnStatusUpdate ( Args . GitStatus ) ;
168+ repositoryManagerListener . DidNotReceive ( ) . OnActiveBranchChanged ( Arg . Any < ConfigBranch ? > ( ) ) ;
169+ repositoryManagerListener . DidNotReceive ( ) . OnActiveRemoteChanged ( Arg . Any < ConfigRemote ? > ( ) ) ;
170+ repositoryManagerListener . DidNotReceive ( ) . OnHeadChanged ( ) ;
171+ repositoryManagerListener . DidNotReceive ( ) . OnLocalBranchListChanged ( ) ;
172+ repositoryManagerListener . DidNotReceive ( ) . OnRemoteBranchListChanged ( ) ;
173+ repositoryManagerListener . ReceivedWithAnyArgs ( ) . OnIsBusyChanged ( Args . Bool ) ;
174+ repositoryManagerListener . DidNotReceive ( ) . OnLocksUpdated ( Args . EnumerableGitLock ) ;
175+
176+ result . AssertEqual ( expectedAfterChanges ) ;
177+
178+ repositoryManagerListener . ClearReceivedCalls ( ) ;
179+ repositoryManagerEvents . Reset ( ) ;
180+
181+ await RepositoryManager
182+ . CommitAllFiles ( "IntegrationTest Commit" , string . Empty )
183+ . StartAsAsync ( ) ;
184+
185+ await TaskManager . Wait ( ) ;
186+ RepositoryManager . WaitForEvents ( ) ;
187+ WaitForNotBusy ( repositoryManagerEvents , 1 ) ;
188+
189+ repositoryManagerListener . DidNotReceive ( ) . OnStatusUpdate ( Args . GitStatus ) ;
190+ repositoryManagerListener . DidNotReceive ( ) . OnActiveBranchChanged ( Arg . Any < ConfigBranch ? > ( ) ) ;
191+ repositoryManagerListener . DidNotReceive ( ) . OnActiveRemoteChanged ( Arg . Any < ConfigRemote ? > ( ) ) ;
192+ repositoryManagerListener . DidNotReceive ( ) . OnHeadChanged ( ) ;
193+ repositoryManagerListener . DidNotReceive ( ) . OnLocalBranchListChanged ( ) ;
194+ repositoryManagerListener . DidNotReceive ( ) . OnRemoteBranchListChanged ( ) ;
195+ repositoryManagerListener . Received ( 2 ) . OnIsBusyChanged ( Args . Bool ) ;
196+ repositoryManagerListener . DidNotReceive ( ) . OnLocksUpdated ( Args . EnumerableGitLock ) ;
197+ }
198+
132199 [ Test , Category ( "TimeSensitive" ) ]
133200 public async Task ShouldDetectBranchChange ( )
134201 {
0 commit comments