File tree Expand file tree Collapse file tree 3 files changed +6
-64
lines changed
Tvl.VisualStudio.MouseFastScroll.IntegrationTests Expand file tree Collapse file tree 3 files changed +6
-64
lines changed Original file line number Diff line number Diff line change 4
4
namespace Tvl . VisualStudio . MouseFastScroll . IntegrationTests . InProcess
5
5
{
6
6
using System ;
7
- using System . Threading ;
8
7
using System . Threading . Tasks ;
9
8
using System . Windows ;
10
9
using System . Windows . Threading ;
11
10
using Microsoft . VisualStudio . Threading ;
12
- using Tvl . VisualStudio . MouseFastScroll . IntegrationTests . Threading ;
13
11
using DTE = EnvDTE . DTE ;
14
12
using SDTE = Microsoft . VisualStudio . Shell . Interop . SDTE ;
15
13
using ServiceProvider = Microsoft . VisualStudio . Shell . ServiceProvider ;
@@ -44,13 +42,7 @@ protected async Task<DTE> GetDTEAsync()
44
42
/// </summary>
45
43
protected static async Task WaitForApplicationIdleAsync ( )
46
44
{
47
- var synchronizationContext = new DispatcherSynchronizationContext ( Application . Current . Dispatcher , DispatcherPriority . ApplicationIdle ) ;
48
- var taskScheduler = new SynchronizationContextTaskScheduler ( synchronizationContext ) ;
49
- await Task . Factory . StartNew (
50
- ( ) => { } ,
51
- CancellationToken . None ,
52
- TaskCreationOptions . None ,
53
- taskScheduler ) ;
45
+ await Application . Current . Dispatcher . InvokeAsync ( ( ) => { } , DispatcherPriority . ApplicationIdle ) ;
54
46
}
55
47
}
56
48
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ public async Task TestRunsOnUIThreadAsync()
44
44
public async Task TestYieldsToWorkAsync ( )
45
45
{
46
46
Assert . True ( Application . Current . Dispatcher . CheckAccess ( ) ) ;
47
- await Task . Factory . StartNew (
48
- ( ) => { } ,
49
- CancellationToken . None ,
50
- TaskCreationOptions . None ,
51
- new SynchronizationContextTaskScheduler ( new DispatcherSynchronizationContext ( Application . Current . Dispatcher ) ) ) ;
47
+
48
+ var task = Application . Current . Dispatcher . InvokeAsync ( ( ) => { } ) . Task ;
49
+ Assert . False ( task . IsCompleted ) ;
50
+ await task ;
51
+
52
52
Assert . True ( Application . Current . Dispatcher . CheckAccess ( ) ) ;
53
53
}
54
54
You can’t perform that action at this time.
0 commit comments