@@ -43,17 +43,16 @@ public ZipFixture(GraphDsl.Builder<NotUsed> builder) : base(builder)
43
43
}
44
44
45
45
[ Fact ]
46
- public void Zip_must_work_in_the_happy_case ( )
46
+ public async Task Zip_must_work_in_the_happy_case ( )
47
47
{
48
- this . AssertAllStagesStopped ( ( ) =>
49
- {
48
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
50
49
var probe = this . CreateManualSubscriberProbe < ( int , string ) > ( ) ;
51
50
52
51
RunnableGraph . FromGraph ( GraphDsl . Create ( b =>
53
52
{
54
53
var zip = b . Add ( new Zip < int , string > ( ) ) ;
55
54
var source1 = Source . From ( Enumerable . Range ( 1 , 4 ) ) ;
56
- var source2 = Source . From ( new [ ] { "A" , "B" , "C" , "D" , "E" , "F" } ) ;
55
+ var source2 = Source . From ( new [ ] { "A" , "B" , "C" , "D" , "E" , "F" } ) ;
57
56
58
57
b . From ( source1 ) . To ( zip . In0 ) ;
59
58
b . From ( source2 ) . To ( zip . In1 ) ;
@@ -62,24 +61,23 @@ public void Zip_must_work_in_the_happy_case()
62
61
return ClosedShape . Instance ;
63
62
} ) ) . Run ( Materializer ) ;
64
63
65
- var subscription = probe . ExpectSubscription ( ) ;
64
+ var subscription = await probe . ExpectSubscriptionAsync ( ) ;
66
65
67
66
subscription . Request ( 2 ) ;
68
- probe . ExpectNext ( ( 1 , "A" ) ) ;
69
- probe . ExpectNext ( ( 2 , "B" ) ) ;
67
+ await probe . ExpectNextAsync ( ( 1 , "A" ) ) ;
68
+ await probe . ExpectNextAsync ( ( 2 , "B" ) ) ;
70
69
subscription . Request ( 1 ) ;
71
- probe . ExpectNext ( ( 3 , "C" ) ) ;
70
+ await probe . ExpectNextAsync ( ( 3 , "C" ) ) ;
72
71
subscription . Request ( 1 ) ;
73
- probe . ExpectNext ( ( 4 , "D" ) ) ;
74
- probe . ExpectComplete ( ) ;
72
+ await probe . ExpectNextAsync ( ( 4 , "D" ) ) ;
73
+ await probe . ExpectCompleteAsync ( ) ;
75
74
} , Materializer ) ;
76
75
}
77
76
78
77
[ Fact ]
79
- public void Zip_must_complete_if_one_side_is_available_but_other_already_completed ( )
78
+ public async Task Zip_must_complete_if_one_side_is_available_but_other_already_completed ( )
80
79
{
81
- this . AssertAllStagesStopped ( ( ) =>
82
- {
80
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
83
81
var upstream1 = this . CreatePublisherProbe < int > ( ) ;
84
82
var upstream2 = this . CreatePublisherProbe < string > ( ) ;
85
83
@@ -96,21 +94,20 @@ public void Zip_must_complete_if_one_side_is_available_but_other_already_complet
96
94
return ClosedShape . Instance ;
97
95
} ) ) . Run ( Materializer ) ;
98
96
99
- upstream1 . SendNext ( 1 ) ;
100
- upstream1 . SendNext ( 2 ) ;
101
- upstream2 . SendNext ( "A" ) ;
102
- upstream2 . SendComplete ( ) ;
97
+ await upstream1 . SendNextAsync ( 1 ) ;
98
+ await upstream1 . SendNextAsync ( 2 ) ;
99
+ await upstream2 . SendNextAsync ( "A" ) ;
100
+ await upstream2 . SendCompleteAsync ( ) ;
103
101
104
102
completed . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
105
- upstream1 . ExpectCancellation ( ) ;
103
+ await upstream1 . ExpectCancellationAsync ( ) ;
106
104
} , Materializer ) ;
107
105
}
108
106
109
107
[ Fact ]
110
- public void Zip_must_complete_even_if_no_pending_demand ( )
108
+ public async Task Zip_must_complete_even_if_no_pending_demand ( )
111
109
{
112
- this . AssertAllStagesStopped ( ( ) =>
113
- {
110
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
114
111
var upstream1 = this . CreatePublisherProbe < int > ( ) ;
115
112
var upstream2 = this . CreatePublisherProbe < string > ( ) ;
116
113
var downstream = this . CreateSubscriberProbe < ( int , string ) > ( ) ;
@@ -130,21 +127,20 @@ public void Zip_must_complete_even_if_no_pending_demand()
130
127
131
128
downstream . Request ( 1 ) ;
132
129
133
- upstream1 . SendNext ( 1 ) ;
134
- upstream2 . SendNext ( "A" ) ;
135
- downstream . ExpectNext ( ( 1 , "A" ) ) ;
130
+ await upstream1 . SendNextAsync ( 1 ) ;
131
+ await upstream2 . SendNextAsync ( "A" ) ;
132
+ await downstream . ExpectNextAsync ( ( 1 , "A" ) ) ;
136
133
137
- upstream2 . SendComplete ( ) ;
138
- downstream . ExpectComplete ( ) ;
139
- upstream1 . ExpectCancellation ( ) ;
134
+ await upstream2 . SendCompleteAsync ( ) ;
135
+ await downstream . ExpectCompleteAsync ( ) ;
136
+ await upstream1 . ExpectCancellationAsync ( ) ;
140
137
} , Materializer ) ;
141
138
}
142
139
143
140
[ Fact ]
144
- public void Zip_must_complete_if_both_sides_complete_before_requested_with_elements_pending_2 ( )
141
+ public async Task Zip_must_complete_if_both_sides_complete_before_requested_with_elements_pending_2 ( )
145
142
{
146
- this . AssertAllStagesStopped ( ( ) =>
147
- {
143
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
148
144
var upstream1 = this . CreatePublisherProbe < int > ( ) ;
149
145
var upstream2 = this . CreatePublisherProbe < string > ( ) ;
150
146
var downstream = this . CreateSubscriberProbe < ( int , string ) > ( ) ;
@@ -162,22 +158,21 @@ public void Zip_must_complete_if_both_sides_complete_before_requested_with_eleme
162
158
return ClosedShape . Instance ;
163
159
} ) ) . Run ( Materializer ) ;
164
160
165
- upstream1 . SendNext ( 1 ) ;
166
- upstream2 . SendNext ( "A" ) ;
161
+ await upstream1 . SendNextAsync ( 1 ) ;
162
+ await upstream2 . SendNextAsync ( "A" ) ;
167
163
168
- upstream1 . SendComplete ( ) ;
169
- upstream2 . SendComplete ( ) ;
164
+ await upstream1 . SendCompleteAsync ( ) ;
165
+ await upstream2 . SendCompleteAsync ( ) ;
170
166
171
- downstream . RequestNext ( ( 1 , "A" ) ) ;
172
- downstream . ExpectComplete ( ) ;
167
+ await downstream . RequestNextAsync ( ( 1 , "A" ) ) ;
168
+ await downstream . ExpectCompleteAsync ( ) ;
173
169
} , Materializer ) ;
174
170
}
175
171
176
172
[ Fact ]
177
- public void Zip_must_complete_if_one_side_complete_before_requested_with_elements_pending ( )
173
+ public async Task Zip_must_complete_if_one_side_complete_before_requested_with_elements_pending ( )
178
174
{
179
- this . AssertAllStagesStopped ( ( ) =>
180
- {
175
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
181
176
var upstream1 = this . CreatePublisherProbe < int > ( ) ;
182
177
var upstream2 = this . CreatePublisherProbe < string > ( ) ;
183
178
var downstream = this . CreateSubscriberProbe < ( int , string ) > ( ) ;
@@ -195,23 +190,22 @@ public void Zip_must_complete_if_one_side_complete_before_requested_with_element
195
190
return ClosedShape . Instance ;
196
191
} ) ) . Run ( Materializer ) ;
197
192
198
- upstream1 . SendNext ( 1 ) ;
199
- upstream1 . SendNext ( 2 ) ;
200
- upstream2 . SendNext ( "A" ) ;
193
+ await upstream1 . SendNextAsync ( 1 ) ;
194
+ await upstream1 . SendNextAsync ( 2 ) ;
195
+ await upstream2 . SendNextAsync ( "A" ) ;
201
196
202
- upstream1 . SendComplete ( ) ;
203
- upstream2 . SendComplete ( ) ;
197
+ await upstream1 . SendCompleteAsync ( ) ;
198
+ await upstream2 . SendCompleteAsync ( ) ;
204
199
205
- downstream . RequestNext ( ( 1 , "A" ) ) ;
206
- downstream . ExpectComplete ( ) ;
200
+ await downstream . RequestNextAsync ( ( 1 , "A" ) ) ;
201
+ await downstream . ExpectCompleteAsync ( ) ;
207
202
} , Materializer ) ;
208
203
}
209
204
210
205
[ Fact ]
211
- public void Zip_must_complete_if_one_side_complete_before_requested_with_elements_pending_2 ( )
206
+ public async Task Zip_must_complete_if_one_side_complete_before_requested_with_elements_pending_2 ( )
212
207
{
213
- this . AssertAllStagesStopped ( ( ) =>
214
- {
208
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
215
209
var upstream1 = this . CreatePublisherProbe < int > ( ) ;
216
210
var upstream2 = this . CreatePublisherProbe < string > ( ) ;
217
211
var downstream = this . CreateSubscriberProbe < ( int , string ) > ( ) ;
@@ -229,69 +223,67 @@ public void Zip_must_complete_if_one_side_complete_before_requested_with_element
229
223
return ClosedShape . Instance ;
230
224
} ) ) . Run ( Materializer ) ;
231
225
232
- downstream . EnsureSubscription ( ) ;
226
+ await downstream . EnsureSubscriptionAsync ( ) ;
233
227
234
- upstream1 . SendNext ( 1 ) ;
235
- upstream1 . SendComplete ( ) ;
236
- downstream . ExpectNoMsg ( TimeSpan . FromMilliseconds ( 500 ) ) ;
228
+ await upstream1 . SendNextAsync ( 1 ) ;
229
+ await upstream1 . SendCompleteAsync ( ) ;
230
+ await downstream . ExpectNoMsgAsync ( TimeSpan . FromMilliseconds ( 500 ) ) ;
237
231
238
- upstream2 . SendNext ( "A" ) ;
239
- upstream2 . SendComplete ( ) ;
232
+ await upstream2 . SendNextAsync ( "A" ) ;
233
+ await upstream2 . SendCompleteAsync ( ) ;
240
234
241
- downstream . RequestNext ( ( 1 , "A" ) ) ;
242
- downstream . ExpectComplete ( ) ;
235
+ await downstream . RequestNextAsync ( ( 1 , "A" ) ) ;
236
+ await downstream . ExpectCompleteAsync ( ) ;
243
237
} , Materializer ) ;
244
238
}
245
239
246
240
[ Fact ]
247
- public void Zip_must_work_with_one_immediately_completed_and_one_nonempty_publisher ( )
241
+ public async Task Zip_must_work_with_one_immediately_completed_and_one_nonempty_publisher ( )
248
242
{
249
- this . AssertAllStagesStopped ( ( ) =>
250
- {
243
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
251
244
var subscriber1 = Setup ( CompletedPublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
252
- subscriber1 . ExpectSubscriptionAndComplete ( ) ;
245
+ await subscriber1 . ExpectSubscriptionAndCompleteAsync ( ) ;
253
246
254
247
var subscriber2 = Setup ( NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) , CompletedPublisher < int > ( ) ) ;
255
- subscriber2 . ExpectSubscriptionAndComplete ( ) ;
248
+ await subscriber2 . ExpectSubscriptionAndCompleteAsync ( ) ;
256
249
} , Materializer ) ;
257
250
}
258
251
259
252
[ Fact ]
260
- public void Zip_must_work_with_one_delayed_completed_and_one_nonempty_publisher ( )
253
+ public async Task Zip_must_work_with_one_delayed_completed_and_one_nonempty_publisher ( )
261
254
{
262
- this . AssertAllStagesStopped ( ( ) =>
263
- {
255
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
264
256
var subscriber1 = Setup ( SoonToCompletePublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
265
- subscriber1 . ExpectSubscriptionAndComplete ( ) ;
257
+ await subscriber1 . ExpectSubscriptionAndCompleteAsync ( ) ;
266
258
267
259
var subscriber2 = Setup ( NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) , SoonToCompletePublisher < int > ( ) ) ;
268
- subscriber2 . ExpectSubscriptionAndComplete ( ) ;
260
+ await subscriber2 . ExpectSubscriptionAndCompleteAsync ( ) ;
269
261
} , Materializer ) ;
270
262
}
271
263
272
264
[ Fact ]
273
- public void Zip_must_work_with_one_immediately_failed_and_one_nonempty_publisher ( )
265
+ public async Task Zip_must_work_with_one_immediately_failed_and_one_nonempty_publisher ( )
274
266
{
275
- this . AssertAllStagesStopped ( ( ) =>
276
- {
267
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
277
268
var subscriber1 = Setup ( FailedPublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
278
269
subscriber1 . ExpectSubscriptionAndError ( ) . Should ( ) . Be ( TestException ( ) ) ;
279
270
280
271
var subscriber2 = Setup ( NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) , FailedPublisher < int > ( ) ) ;
281
272
subscriber2 . ExpectSubscriptionAndError ( ) . Should ( ) . Be ( TestException ( ) ) ;
273
+ return Task . CompletedTask ;
282
274
} , Materializer ) ;
283
275
}
284
276
285
277
[ Fact ]
286
- public void Zip_must_work_with_one_delayed_failed_and_one_nonempty_publisher ( )
278
+ public async Task Zip_must_work_with_one_delayed_failed_and_one_nonempty_publisher ( )
287
279
{
288
- this . AssertAllStagesStopped ( ( ) =>
289
- {
280
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
290
281
var subscriber1 = Setup ( SoonToFailPublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
291
282
subscriber1 . ExpectSubscriptionAndError ( ) . Should ( ) . Be ( TestException ( ) ) ;
292
283
293
284
var subscriber2 = Setup ( NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) , SoonToFailPublisher < int > ( ) ) ;
294
285
subscriber2 . ExpectSubscriptionAndError ( ) . Should ( ) . Be ( TestException ( ) ) ;
286
+ return Task . CompletedTask ;
295
287
} , Materializer ) ;
296
288
}
297
289
}
0 commit comments