1
-
2
-
3
- using ReactiveDomain . Messaging ;
1
+ using ReactiveDomain . Messaging ;
4
2
using ReactiveDomain . Messaging . Bus ;
5
3
using System ;
6
- using System . Threading ;
7
4
using System . Threading . Tasks ;
8
5
using Xunit ;
9
6
@@ -133,8 +130,8 @@ public void waiting_for_message_throws_on_clear()
133
130
{
134
131
using ( var tq = new TestQueue ( _dispatcher , new [ ] { typeof ( Event ) , typeof ( Command ) } ) )
135
132
{
136
- Task . Run ( ( ) => Assert . Throws < InvalidOperationException > ( ( ) => tq . WaitFor < TestEvent > ( TimeSpan . FromMilliseconds ( 100 ) ) ) )
137
- . ContinueWith ( t => tq . Clear ( ) ) ;
133
+ Task . Run ( ( ) => Assert . Throws < InvalidOperationException > ( ( ) => tq . WaitFor < TestEvent > ( TimeSpan . FromMilliseconds ( 100 ) ) ) , TestContext . Current . CancellationToken )
134
+ . ContinueWith ( t => tq . Clear ( ) , TestContext . Current . CancellationToken ) ;
138
135
tq . AssertEmpty ( ) ;
139
136
}
140
137
}
@@ -143,8 +140,8 @@ public void waiting_for_id_throws_on_clear()
143
140
{
144
141
using ( var tq = new TestQueue ( _dispatcher , new [ ] { typeof ( Event ) , typeof ( Command ) } ) )
145
142
{
146
- Task . Run ( ( ) => Assert . Throws < InvalidOperationException > ( ( ) => tq . WaitForMsgId ( Guid . NewGuid ( ) , TimeSpan . FromMilliseconds ( 100 ) ) ) )
147
- . ContinueWith ( t => tq . Clear ( ) ) ;
143
+ Task . Run ( ( ) => Assert . Throws < InvalidOperationException > ( ( ) => tq . WaitForMsgId ( Guid . NewGuid ( ) , TimeSpan . FromMilliseconds ( 100 ) ) ) , TestContext . Current . CancellationToken )
144
+ . ContinueWith ( t => tq . Clear ( ) , TestContext . Current . CancellationToken ) ;
148
145
tq . AssertEmpty ( ) ;
149
146
}
150
147
}
@@ -157,8 +154,8 @@ public void can_wait_for_a_specific_message()
157
154
var evt = new TestEvent ( ) ;
158
155
var evt2 = new TestEvent ( ) ;
159
156
//before
160
- var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) ) ;
161
- var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt2 . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) ) ;
157
+ var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) , TestContext . Current . CancellationToken ) ;
158
+ var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt2 . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) , TestContext . Current . CancellationToken ) ;
162
159
AssertEx . EnsureRunning ( t1 , t2 ) ;
163
160
164
161
_dispatcher . Publish ( evt ) ;
@@ -179,8 +176,8 @@ public void can_wait_for_a_specific_message_twice()
179
176
using ( var tq = new TestQueue ( _dispatcher ) )
180
177
{
181
178
var evt = new TestEvent ( ) ;
182
- var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) ) ;
183
- var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) ) ;
179
+ var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) , TestContext . Current . CancellationToken ) ;
180
+ var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 1000 ) ) , TestContext . Current . CancellationToken ) ;
184
181
185
182
tq . Handle ( evt ) ;
186
183
tq . AssertNext < TestEvent > ( evt . CorrelationId )
@@ -214,8 +211,8 @@ public void can_wait_for_multiple_messages_not_yet_received()
214
211
var evt = new TestEvent ( ) ;
215
212
var evt2 = new TestEvent ( ) ;
216
213
217
- var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 200 ) ) ) ;
218
- var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt2 . MsgId , TimeSpan . FromMilliseconds ( 200 ) ) ) ;
214
+ var t1 = Task . Run ( ( ) => tq . WaitForMsgId ( evt . MsgId , TimeSpan . FromMilliseconds ( 200 ) ) , TestContext . Current . CancellationToken ) ;
215
+ var t2 = Task . Run ( ( ) => tq . WaitForMsgId ( evt2 . MsgId , TimeSpan . FromMilliseconds ( 200 ) ) , TestContext . Current . CancellationToken ) ;
219
216
220
217
_dispatcher . Publish ( evt ) ;
221
218
_dispatcher . Publish ( evt2 ) ;
0 commit comments