Skip to content

Commit f8c4369

Browse files
committed
Remove unnecessary test helper SynchronizationContextTaskScheduler
1 parent d3782bd commit f8c4369

File tree

3 files changed

+6
-64
lines changed

3 files changed

+6
-64
lines changed

Tvl.VisualStudio.MouseFastScroll.IntegrationTests/InProcess/InProcComponent2.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
namespace Tvl.VisualStudio.MouseFastScroll.IntegrationTests.InProcess
55
{
66
using System;
7-
using System.Threading;
87
using System.Threading.Tasks;
98
using System.Windows;
109
using System.Windows.Threading;
1110
using Microsoft.VisualStudio.Threading;
12-
using Tvl.VisualStudio.MouseFastScroll.IntegrationTests.Threading;
1311
using DTE = EnvDTE.DTE;
1412
using SDTE = Microsoft.VisualStudio.Shell.Interop.SDTE;
1513
using ServiceProvider = Microsoft.VisualStudio.Shell.ServiceProvider;
@@ -44,13 +42,7 @@ protected async Task<DTE> GetDTEAsync()
4442
/// </summary>
4543
protected static async Task WaitForApplicationIdleAsync()
4644
{
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);
5446
}
5547
}
5648
}

Tvl.VisualStudio.MouseFastScroll.IntegrationTests/Threading/SynchronizationContextTaskScheduler.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

Tvl.VisualStudio.MouseFastScroll.IntegrationTests/VsFactTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public async Task TestRunsOnUIThreadAsync()
4444
public async Task TestYieldsToWorkAsync()
4545
{
4646
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+
5252
Assert.True(Application.Current.Dispatcher.CheckAccess());
5353
}
5454

0 commit comments

Comments
 (0)