@@ -33,50 +33,49 @@ public GraphUnzipWithSpec(ITestOutputHelper helper) : base(helper)
33
33
}
34
34
35
35
[ Fact ]
36
- public void UnzipWith_must_work_with_immediately_completed_publisher ( )
36
+ public async Task UnzipWith_must_work_with_immediately_completed_publisher ( )
37
37
{
38
- this . AssertAllStagesStopped ( ( ) =>
39
- {
38
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
40
39
var subscribers = Setup ( TestPublisher . Empty < int > ( ) ) ;
41
40
ValidateSubscriptionAndComplete ( subscribers ) ;
41
+ return Task . CompletedTask ;
42
42
} , Materializer ) ;
43
43
}
44
44
45
45
[ Fact ]
46
- public void UnzipWith_must_work_with_delayed_completed_publisher ( )
46
+ public async Task UnzipWith_must_work_with_delayed_completed_publisher ( )
47
47
{
48
- this . AssertAllStagesStopped ( ( ) =>
49
- {
48
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
50
49
var subscribers = Setup ( TestPublisher . LazyEmpty < int > ( ) ) ;
51
50
ValidateSubscriptionAndComplete ( subscribers ) ;
51
+ return Task . CompletedTask ;
52
52
} , Materializer ) ;
53
53
}
54
54
55
55
[ Fact ]
56
- public void UnzipWith_must_work_with_two_immediately_failed_publisher ( )
56
+ public async Task UnzipWith_must_work_with_two_immediately_failed_publisher ( )
57
57
{
58
- this . AssertAllStagesStopped ( ( ) =>
59
- {
58
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
60
59
var subscribers = Setup ( TestPublisher . Error < int > ( TestException ) ) ;
61
60
ValidateSubscriptionAndError ( subscribers ) ;
61
+ return Task . CompletedTask ;
62
62
} , Materializer ) ;
63
63
}
64
64
65
65
[ Fact ]
66
- public void UnzipWith_must_work_with_two_delayed_failed_publisher ( )
66
+ public async Task UnzipWith_must_work_with_two_delayed_failed_publisher ( )
67
67
{
68
- this . AssertAllStagesStopped ( ( ) =>
69
- {
68
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
70
69
var subscribers = Setup ( TestPublisher . LazyError < int > ( TestException ) ) ;
71
70
ValidateSubscriptionAndError ( subscribers ) ;
71
+ return Task . CompletedTask ;
72
72
} , Materializer ) ;
73
73
}
74
74
75
75
[ Fact ]
76
- public void UnzipWith_must_work_in_the_happy_case ( )
76
+ public async Task UnzipWith_must_work_in_the_happy_case ( )
77
77
{
78
- this . AssertAllStagesStopped ( ( ) =>
79
- {
78
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
80
79
var leftProbe = this . CreateManualSubscriberProbe < int > ( ) ;
81
80
var rightProbe = this . CreateManualSubscriberProbe < string > ( ) ;
82
81
@@ -96,49 +95,48 @@ public void UnzipWith_must_work_in_the_happy_case()
96
95
return ClosedShape . Instance ;
97
96
} ) ) . Run ( Materializer ) ;
98
97
99
- var leftSubscription = leftProbe . ExpectSubscription ( ) ;
100
- var rightSubscription = rightProbe . ExpectSubscription ( ) ;
98
+ var leftSubscription = await leftProbe . ExpectSubscriptionAsync ( ) ;
99
+ var rightSubscription = await rightProbe . ExpectSubscriptionAsync ( ) ;
101
100
102
101
leftSubscription . Request ( 2 ) ;
103
102
rightSubscription . Request ( 1 ) ;
104
103
105
- leftProbe . ExpectNext ( 2 , 4 ) ;
106
- leftProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
104
+ leftProbe . ExpectNext ( 2 , 4 ) ;
105
+ await leftProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
106
+
107
+ await rightProbe . ExpectNextAsync ( "1+1" ) ;
108
+ await rightProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
107
109
108
- rightProbe . ExpectNext ( "1+1" ) ;
109
- rightProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
110
-
111
110
leftSubscription . Request ( 1 ) ;
112
111
rightSubscription . Request ( 2 ) ;
113
112
114
113
leftProbe . ExpectNext ( 6 ) ;
115
- leftProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
114
+ await leftProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
116
115
117
- rightProbe . ExpectNext ( "2+2" , "3+3" ) ;
118
- rightProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
116
+ rightProbe . ExpectNext ( "2+2" , "3+3" ) ;
117
+ await rightProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
119
118
120
119
leftSubscription . Request ( 1 ) ;
121
120
rightSubscription . Request ( 1 ) ;
122
121
123
- leftProbe . ExpectNext ( 8 ) ;
124
- rightProbe . ExpectNext ( "4+4" ) ;
122
+ await leftProbe . ExpectNextAsync ( 8 ) ;
123
+ await rightProbe . ExpectNextAsync ( "4+4" ) ;
125
124
126
- leftProbe . ExpectComplete ( ) ;
127
- rightProbe . ExpectComplete ( ) ;
125
+ await leftProbe . ExpectCompleteAsync ( ) ;
126
+ await rightProbe . ExpectCompleteAsync ( ) ;
128
127
} , Materializer ) ;
129
128
}
130
129
131
130
[ Fact ]
132
- public void UnzipWith_must_work_in_the_sad_case ( )
131
+ public async Task UnzipWith_must_work_in_the_sad_case ( )
133
132
{
134
- this . AssertAllStagesStopped ( ( ) =>
135
- {
133
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
136
134
var leftProbe = this . CreateManualSubscriberProbe < int > ( ) ;
137
135
var rightProbe = this . CreateManualSubscriberProbe < string > ( ) ;
138
136
139
137
RunnableGraph . FromGraph ( GraphDsl . Create ( b =>
140
138
{
141
- var unzip = b . Add ( new UnzipWith < int , int , string > ( i => ( 1 / i , 1 + "/" + i ) ) ) ;
139
+ var unzip = b . Add ( new UnzipWith < int , int , string > ( i => ( 1 / i , 1 + "/" + i ) ) ) ;
142
140
var source = Source . From ( Enumerable . Range ( - 2 , 5 ) ) ;
143
141
144
142
b . From ( source ) . To ( unzip . In ) ;
@@ -148,8 +146,8 @@ public void UnzipWith_must_work_in_the_sad_case()
148
146
return ClosedShape . Instance ;
149
147
} ) ) . Run ( Materializer ) ;
150
148
151
- var leftSubscription = leftProbe . ExpectSubscription ( ) ;
152
- var rightSubscription = rightProbe . ExpectSubscription ( ) ;
149
+ var leftSubscription = await leftProbe . ExpectSubscriptionAsync ( ) ;
150
+ var rightSubscription = await rightProbe . ExpectSubscriptionAsync ( ) ;
153
151
154
152
Action requestFromBoth = ( ) =>
155
153
{
@@ -158,28 +156,27 @@ public void UnzipWith_must_work_in_the_sad_case()
158
156
} ;
159
157
160
158
requestFromBoth ( ) ;
161
- leftProbe . ExpectNext ( 1 / - 2 ) ;
162
- rightProbe . ExpectNext ( "1/-2" ) ;
159
+ await leftProbe . ExpectNextAsync ( 1 / - 2 ) ;
160
+ await rightProbe . ExpectNextAsync ( "1/-2" ) ;
163
161
164
162
requestFromBoth ( ) ;
165
- leftProbe . ExpectNext ( 1 / - 1 ) ;
166
- rightProbe . ExpectNext ( "1/-1" ) ;
163
+ await leftProbe . ExpectNextAsync ( 1 / - 1 ) ;
164
+ await rightProbe . ExpectNextAsync ( "1/-1" ) ;
167
165
168
- EventFilter . Exception < DivideByZeroException > ( ) . ExpectOne ( requestFromBoth ) ;
166
+ await EventFilter . Exception < DivideByZeroException > ( ) . ExpectOneAsync ( requestFromBoth ) ;
169
167
170
168
leftProbe . ExpectError ( ) . Should ( ) . BeOfType < DivideByZeroException > ( ) ;
171
169
rightProbe . ExpectError ( ) . Should ( ) . BeOfType < DivideByZeroException > ( ) ;
172
170
173
- leftProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
174
- rightProbe . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 100 ) ) ;
171
+ await leftProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
172
+ await rightProbe . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 100 ) ) ;
175
173
} , Materializer ) ;
176
174
}
177
175
178
176
[ Fact ]
179
- public void UnzipWith_must_propagate_last_downstream_cancellation_cause_once_all_downstream_have_cancelled ( )
177
+ public async Task UnzipWith_must_propagate_last_downstream_cancellation_cause_once_all_downstream_have_cancelled ( )
180
178
{
181
- this . AssertAllStagesStopped ( ( ) =>
182
- {
179
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
183
180
var probe = CreateTestProbe ( ) ;
184
181
RunnableGraph . FromGraph ( GraphDsl . Create ( b =>
185
182
{
@@ -196,7 +193,7 @@ public void UnzipWith_must_propagate_last_downstream_cancellation_cause_once_all
196
193
var unzip = b . Add ( new UnzipWith < int , int , string > ( i => ( 1 / i , $ "1 / { i } ") ) ) ;
197
194
198
195
b . From ( source ) . To ( unzip . In ) ;
199
-
196
+
200
197
Flow < T , T , NotUsed > KillSwitchFlow < T > ( )
201
198
=> Flow . Create < T , NotUsed > ( )
202
199
. ViaMaterialized ( KillSwitches . Single < T > ( ) , Keep . Right )
@@ -223,14 +220,14 @@ Flow<T, T, NotUsed> KillSwitchFlow<T>()
223
220
t . Exception . Should ( ) . NotBeNull ( ) ;
224
221
t . Exception . InnerException . Should ( ) . Be ( boom ) ;
225
222
} ) ;
223
+ return Task . CompletedTask ;
226
224
} , Materializer ) ;
227
225
}
228
226
229
227
[ Fact ]
230
- public void UnzipWith_must_unzipWith_expanded_Person_unapply_3_outputs ( )
228
+ public async Task UnzipWith_must_unzipWith_expanded_Person_unapply_3_outputs ( )
231
229
{
232
- this . AssertAllStagesStopped ( ( ) =>
233
- {
230
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
234
231
var probe0 = this . CreateManualSubscriberProbe < string > ( ) ;
235
232
var probe1 = this . CreateManualSubscriberProbe < string > ( ) ;
236
233
var probe2 = this . CreateManualSubscriberProbe < int > ( ) ;
@@ -248,31 +245,30 @@ public void UnzipWith_must_unzipWith_expanded_Person_unapply_3_outputs()
248
245
return ClosedShape . Instance ;
249
246
} ) ) . Run ( Materializer ) ;
250
247
251
- var subscription0 = probe0 . ExpectSubscription ( ) ;
252
- var subscription1 = probe1 . ExpectSubscription ( ) ;
253
- var subscription2 = probe2 . ExpectSubscription ( ) ;
248
+ var subscription0 = await probe0 . ExpectSubscriptionAsync ( ) ;
249
+ var subscription1 = await probe1 . ExpectSubscriptionAsync ( ) ;
250
+ var subscription2 = await probe2 . ExpectSubscriptionAsync ( ) ;
254
251
255
252
subscription0 . Request ( 1 ) ;
256
253
subscription1 . Request ( 1 ) ;
257
254
subscription2 . Request ( 1 ) ;
258
255
259
- probe0 . ExpectNext ( "Caplin" ) ;
260
- probe1 . ExpectNext ( "Capybara" ) ;
261
- probe2 . ExpectNext ( 55 ) ;
256
+ await probe0 . ExpectNextAsync ( "Caplin" ) ;
257
+ await probe1 . ExpectNextAsync ( "Capybara" ) ;
258
+ await probe2 . ExpectNextAsync ( 55 ) ;
262
259
263
- probe0 . ExpectComplete ( ) ;
264
- probe1 . ExpectComplete ( ) ;
265
- probe2 . ExpectComplete ( ) ;
260
+ await probe0 . ExpectCompleteAsync ( ) ;
261
+ await probe1 . ExpectCompleteAsync ( ) ;
262
+ await probe2 . ExpectCompleteAsync ( ) ;
266
263
} , Materializer ) ;
267
264
}
268
265
269
266
[ Fact ]
270
- public void UnzipWith_must_work_with_up_to_6_outputs ( )
267
+ public async Task UnzipWith_must_work_with_up_to_6_outputs ( )
271
268
{
272
269
// the jvm version uses 20 outputs but we have only 7 so changed this spec a little bit
273
270
274
- this . AssertAllStagesStopped ( ( ) =>
275
- {
271
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
276
272
var probe0 = this . CreateManualSubscriberProbe < int > ( ) ;
277
273
var probe1 = this . CreateManualSubscriberProbe < string > ( ) ;
278
274
var probe2 = this . CreateManualSubscriberProbe < int > ( ) ;
@@ -290,8 +286,8 @@ public void UnzipWith_must_work_with_up_to_6_outputs()
290
286
( ints [ 0 ] , ints [ 0 ] . ToString ( ) , ints [ 1 ] , ints [ 1 ] . ToString ( ) , ints [ 2 ] ,
291
287
ints [ 2 ] . ToString ( ) ) ) ) ;
292
288
293
- var source = Source . Single ( Enumerable . Range ( 1 , 3 ) . ToList ( ) ) ;
294
-
289
+ var source = Source . Single ( Enumerable . Range ( 1 , 3 ) . ToList ( ) ) ;
290
+
295
291
b . From ( source ) . To ( unzip . In ) ;
296
292
b . From ( unzip . Out0 ) . To ( Sink . FromSubscriber ( probe0 ) ) ;
297
293
b . From ( unzip . Out1 ) . To ( Sink . FromSubscriber ( probe1 ) ) ;
@@ -303,26 +299,26 @@ public void UnzipWith_must_work_with_up_to_6_outputs()
303
299
return ClosedShape . Instance ;
304
300
} ) ) . Run ( Materializer ) ;
305
301
306
- probe0 . ExpectSubscription ( ) . Request ( 1 ) ;
307
- probe1 . ExpectSubscription ( ) . Request ( 1 ) ;
308
- probe2 . ExpectSubscription ( ) . Request ( 1 ) ;
309
- probe3 . ExpectSubscription ( ) . Request ( 1 ) ;
310
- probe4 . ExpectSubscription ( ) . Request ( 1 ) ;
311
- probe5 . ExpectSubscription ( ) . Request ( 1 ) ;
312
-
313
- probe0 . ExpectNext ( 1 ) ;
314
- probe1 . ExpectNext ( "1" ) ;
315
- probe2 . ExpectNext ( 2 ) ;
316
- probe3 . ExpectNext ( "2" ) ;
317
- probe4 . ExpectNext ( 3 ) ;
318
- probe5 . ExpectNext ( "3" ) ;
319
-
320
- probe0 . ExpectComplete ( ) ;
321
- probe1 . ExpectComplete ( ) ;
322
- probe2 . ExpectComplete ( ) ;
323
- probe3 . ExpectComplete ( ) ;
324
- probe4 . ExpectComplete ( ) ;
325
- probe5 . ExpectComplete ( ) ;
302
+ ( await probe0 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
303
+ ( await probe1 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
304
+ ( await probe2 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
305
+ ( await probe3 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
306
+ ( await probe4 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
307
+ ( await probe5 . ExpectSubscriptionAsync ( ) ) . Request ( 1 ) ;
308
+
309
+ await probe0 . ExpectNextAsync ( 1 ) ;
310
+ await probe1 . ExpectNextAsync ( "1" ) ;
311
+ await probe2 . ExpectNextAsync ( 2 ) ;
312
+ await probe3 . ExpectNextAsync ( "2" ) ;
313
+ await probe4 . ExpectNextAsync ( 3 ) ;
314
+ await probe5 . ExpectNextAsync ( "3" ) ;
315
+
316
+ await probe0 . ExpectCompleteAsync ( ) ;
317
+ await probe1 . ExpectCompleteAsync ( ) ;
318
+ await probe2 . ExpectCompleteAsync ( ) ;
319
+ await probe3 . ExpectCompleteAsync ( ) ;
320
+ await probe4 . ExpectCompleteAsync ( ) ;
321
+ await probe5 . ExpectCompleteAsync ( ) ;
326
322
} , Materializer ) ;
327
323
}
328
324
0 commit comments