@@ -24,8 +24,6 @@ namespace Tvl.VisualStudio.MouseFastScroll.IntegrationTests.Threading
24
24
/// </summary>
25
25
public sealed class WpfTestRunner : XunitTestRunner
26
26
{
27
- private static string s_wpfFactRequirementReason ;
28
-
29
27
public WpfTestSharedData SharedData { get ; }
30
28
31
29
public WpfTestRunner (
@@ -59,15 +57,6 @@ protected override Task<decimal> InvokeTestMethodAsync(ExceptionAggregator aggre
59
57
{
60
58
Debug . Assert ( SynchronizationContext . Current is DispatcherSynchronizationContext ) ;
61
59
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
-
71
60
// Just call back into the normal xUnit dispatch process now that we are on an STA Thread with no synchronization context.
72
61
var invoker = new XunitTestInvoker ( Test , MessageBus , TestClass , ConstructorArguments , TestMethod , TestMethodArguments , BeforeAfterAttributes , aggregator , CancellationTokenSource ) ;
73
62
return invoker . RunAsync ( ) . JoinUsingDispatcher ( CancellationTokenSource . Token ) ;
@@ -82,19 +71,5 @@ protected override Task<decimal> InvokeTestMethodAsync(ExceptionAggregator aggre
82
71
83
72
return task . Unwrap ( ) ;
84
73
}
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
- }
99
74
}
100
75
}
0 commit comments