1414using GitHub . Factories ;
1515using GitHub . Primitives ;
1616using GitHub . ViewModels . Dialog ;
17+ using System . Diagnostics ;
1718
1819public class RepositoryCloneViewModelTests
1920{
@@ -104,14 +105,14 @@ public async Task StartsTrueBecomesFalseWhenCompleted()
104105 repoSubject . OnNext ( Substitute . For < IRemoteRepositoryModel > ( ) ) ;
105106 repoSubject . OnNext ( Substitute . For < IRemoteRepositoryModel > ( ) ) ;
106107
107- await done . Timeout ( TimeSpan . FromMilliseconds ( 500 ) ) ;
108+ await done . Timeout ( TimeSpan . FromMilliseconds ( Timeout ) ) ;
108109 done = null ;
109110
110111 Assert . True ( vm . IsBusy ) ;
111112
112113 repoSubject . OnCompleted ( ) ;
113114
114- await col . OriginalCompleted . Timeout ( TimeSpan . FromMilliseconds ( Timeout ) ) ; ;
115+ await col . OriginalCompleted . Timeout ( TimeSpan . FromMilliseconds ( Timeout ) ) ;
115116
116117 // we need to wait slightly because the subscription OnComplete in the model
117118 // runs right after the above await finishes, which means the assert
@@ -211,7 +212,7 @@ public void IsFalseWhenFailed()
211212 }
212213
213214 [ Test ]
214- public void IsTrueWhenLoadingCompleteNotFailedAndNoRepositories ( )
215+ public async Task IsTrueWhenLoadingCompleteNotFailedAndNoRepositories ( )
215216 {
216217 var repoSubject = new Subject < IRemoteRepositoryModel > ( ) ;
217218 var modelService = Substitute . For < IModelService > ( ) ;
@@ -226,6 +227,9 @@ public void IsTrueWhenLoadingCompleteNotFailedAndNoRepositories()
226227
227228 repoSubject . OnCompleted ( ) ;
228229
230+ // we need to delay slightly because the subscribers listening for OnComplete
231+ // need to run before the assert is checked
232+ await Task . Delay ( 100 ) ;
229233 Assert . True ( vm . NoRepositoriesFound ) ;
230234 }
231235 }
@@ -273,7 +277,7 @@ public void IsFalseIfLoadingReposFails()
273277 }
274278
275279 [ Test ]
276- public void IsFalseWhenLoadingCompleteNotFailedAndNoRepositories ( )
280+ public async Task IsFalseWhenLoadingCompleteNotFailedAndNoRepositories ( )
277281 {
278282 var repoSubject = new Subject < IRemoteRepositoryModel > ( ) ;
279283 var modelService = Substitute . For < IModelService > ( ) ;
@@ -288,6 +292,9 @@ public void IsFalseWhenLoadingCompleteNotFailedAndNoRepositories()
288292
289293 repoSubject . OnCompleted ( ) ;
290294
295+ // we need to delay slightly because the subscribers listening for OnComplete
296+ // need to run before the assert is checked
297+ await Task . Delay ( 100 ) ;
291298 Assert . False ( vm . FilterTextIsEnabled ) ;
292299 }
293300 }
0 commit comments