File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ namespace ReactiveUI.Testing
12
12
{
13
13
public static class TestUtils
14
14
{
15
- static readonly object schedGate = 42 ;
15
+ static readonly AutoResetEvent schedGate = new AutoResetEvent ( true ) ;
16
16
static readonly object mbGate = 42 ;
17
17
18
18
/// <summary>
@@ -26,7 +26,7 @@ public static class TestUtils
26
26
/// schedulers.</returns>
27
27
public static IDisposable WithScheduler ( IScheduler sched )
28
28
{
29
- Monitor . Enter ( schedGate ) ;
29
+ schedGate . WaitOne ( ) ;
30
30
var prevDef = RxApp . MainThreadScheduler ;
31
31
var prevTask = RxApp . TaskpoolScheduler ;
32
32
@@ -36,7 +36,7 @@ public static IDisposable WithScheduler(IScheduler sched)
36
36
return Disposable . Create ( ( ) => {
37
37
RxApp . MainThreadScheduler = prevDef ;
38
38
RxApp . TaskpoolScheduler = prevTask ;
39
- Monitor . Exit ( schedGate ) ;
39
+ schedGate . Set ( ) ;
40
40
} ) ;
41
41
}
42
42
Original file line number Diff line number Diff line change 103
103
<Compile Include =" AwaiterTest.cs" />
104
104
<Compile Include =" BindingTypeConvertersTest.cs" />
105
105
<Compile Include =" CommandBindingTests.cs" />
106
+ <Compile Include =" TestUtilsTest.cs" />
106
107
<Compile Include =" WeakEventManagerTest.cs" />
107
108
<Compile Include =" Winforms\ActivationTests.cs" />
108
109
<Compile Include =" Winforms\CommandBindingTests.cs" >
Original file line number Diff line number Diff line change
1
+ using System . Threading . Tasks ;
2
+ using Microsoft . Reactive . Testing ;
3
+ using ReactiveUI . Testing ;
4
+ using Xunit ;
5
+
6
+ namespace ReactiveUI . Tests
7
+ {
8
+ public class TestUtilsTest
9
+ {
10
+ [ Fact ]
11
+ public async Task WithAsyncScheduler ( )
12
+ {
13
+ await new TestScheduler ( ) . WithAsync ( _ => Task . Run ( ( ) => { } ) ) ;
14
+ }
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments