Skip to content

Commit b46622c

Browse files
committed
Remove references to ForegroundThreadAffinitizedObject
1 parent bfead72 commit b46622c

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ namespace Tvl.VisualStudio.MouseFastScroll.IntegrationTests.Threading
2424
/// </summary>
2525
public sealed class WpfTestRunner : XunitTestRunner
2626
{
27-
private static string s_wpfFactRequirementReason;
28-
2927
public WpfTestSharedData SharedData { get; }
3028

3129
public WpfTestRunner(
@@ -59,15 +57,6 @@ protected override Task<decimal> InvokeTestMethodAsync(ExceptionAggregator aggre
5957
{
6058
Debug.Assert(SynchronizationContext.Current is DispatcherSynchronizationContext);
6159

62-
// Sync up FTAO to the context that we are creating here.
63-
ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = new ForegroundThreadData(
64-
Thread.CurrentThread,
65-
new SynchronizationContextTaskScheduler(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher, DispatcherPriority.Background)),
66-
ForegroundThreadDataKind.StaUnitTest);
67-
68-
// Reset our flag ensuring that part of this test actually needs WpfFact
69-
s_wpfFactRequirementReason = null;
70-
7160
// Just call back into the normal xUnit dispatch process now that we are on an STA Thread with no synchronization context.
7261
var invoker = new XunitTestInvoker(Test, MessageBus, TestClass, ConstructorArguments, TestMethod, TestMethodArguments, BeforeAfterAttributes, aggregator, CancellationTokenSource);
7362
return invoker.RunAsync().JoinUsingDispatcher(CancellationTokenSource.Token);
@@ -82,19 +71,5 @@ protected override Task<decimal> InvokeTestMethodAsync(ExceptionAggregator aggre
8271

8372
return task.Unwrap();
8473
}
85-
86-
/// <summary>
87-
/// Asserts that the test is running on a <see cref="WpfFactAttribute"/> or <see cref="WpfTheoryAttribute"/>
88-
/// test method, and records the reason for requiring the use of an STA thread.
89-
/// </summary>
90-
public static void RequireWpfFact(string reason)
91-
{
92-
if (ForegroundThreadDataInfo.CurrentForegroundThreadDataKind != ForegroundThreadDataKind.StaUnitTest)
93-
{
94-
throw new Exception($"This test requires {nameof(WpfFactAttribute)} because '{reason}' but is missing {nameof(WpfFactAttribute)}. Either the attribute should be changed, or the reason it needs an STA thread audited.");
95-
}
96-
97-
s_wpfFactRequirementReason = reason;
98-
}
9974
}
10075
}

0 commit comments

Comments
 (0)