14
14
using Akka . Streams . Dsl . Internal ;
15
15
using Akka . TestKit ;
16
16
using Reactive . Streams ;
17
+ using System . Threading . Tasks ;
17
18
18
19
// ReSharper disable InvokeAsExtensionMethod
19
20
@@ -32,17 +33,16 @@ public FlowConcatAllSpec(ITestOutputHelper helper) : base(helper)
32
33
private static readonly TestException TestException = new TestException ( "test" ) ;
33
34
34
35
[ Fact ]
35
- public void ConcatAll_must_work_in_the_happy_case ( )
36
+ public async Task ConcatAll_must_work_in_the_happy_case ( )
36
37
{
37
- this . AssertAllStagesStopped ( ( ) =>
38
- {
39
- var s1 = Source . From ( new [ ] { 1 , 2 } ) ;
40
- var s2 = Source . From ( new int [ ] { } ) ;
41
- var s3 = Source . From ( new [ ] { 3 } ) ;
42
- var s4 = Source . From ( new [ ] { 4 , 5 , 6 } ) ;
43
- var s5 = Source . From ( new [ ] { 7 , 8 , 9 , 10 } ) ;
38
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
39
+ var s1 = Source . From ( new [ ] { 1 , 2 } ) ;
40
+ var s2 = Source . From ( new int [ ] { } ) ;
41
+ var s3 = Source . From ( new [ ] { 3 } ) ;
42
+ var s4 = Source . From ( new [ ] { 4 , 5 , 6 } ) ;
43
+ var s5 = Source . From ( new [ ] { 7 , 8 , 9 , 10 } ) ;
44
44
45
- var main = Source . From ( new [ ] { s1 , s2 , s3 , s4 , s5 } ) ;
45
+ var main = Source . From ( new [ ] { s1 , s2 , s3 , s4 , s5 } ) ;
46
46
47
47
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
48
48
main . ConcatMany ( s => s ) . To ( Sink . FromSubscriber ( subscriber ) ) . Run ( Materializer ) ;
@@ -53,6 +53,7 @@ public void ConcatAll_must_work_in_the_happy_case()
53
53
54
54
subscription . Request ( 1 ) ;
55
55
subscriber . ExpectComplete ( ) ;
56
+ return Task . CompletedTask ;
56
57
} , Materializer ) ;
57
58
}
58
59
@@ -75,10 +76,9 @@ public void ConcatAll_must_work_together_with_SplitWhen()
75
76
subscriber . ExpectComplete ( ) ; }
76
77
77
78
[ Fact ]
78
- public void ConcatAll_must_on_OnError_on_master_stream_cancel_the_current_open_substream_and_signal_error ( )
79
+ public async Task ConcatAll_must_on_OnError_on_master_stream_cancel_the_current_open_substream_and_signal_error ( )
79
80
{
80
- this . AssertAllStagesStopped ( ( ) =>
81
- {
81
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
82
82
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
83
83
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
84
84
Source . FromPublisher ( publisher )
@@ -99,14 +99,14 @@ public void ConcatAll_must_on_OnError_on_master_stream_cancel_the_current_open_s
99
99
upstream . SendError ( TestException ) ;
100
100
subscriber . ExpectError ( ) . Should ( ) . Be ( TestException ) ;
101
101
subUpstream . ExpectCancellation ( ) ;
102
+ return Task . CompletedTask ;
102
103
} , Materializer ) ;
103
104
}
104
105
105
106
[ Fact ]
106
- public void ConcatAll_must_on_OnError_on_master_stream_cancel_the_currently_opening_substream_and_signal_error ( )
107
+ public async Task ConcatAll_must_on_OnError_on_master_stream_cancel_the_currently_opening_substream_and_signal_error ( )
107
108
{
108
- this . AssertAllStagesStopped ( ( ) =>
109
- {
109
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
110
110
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
111
111
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
112
112
Source . FromPublisher ( publisher )
@@ -130,18 +130,18 @@ public void ConcatAll_must_on_OnError_on_master_stream_cancel_the_currently_open
130
130
131
131
subscriber . ExpectError ( ) . Should ( ) . Be ( TestException ) ;
132
132
subUpstream . ExpectCancellation ( ) ;
133
+ return Task . CompletedTask ;
133
134
} , Materializer ) ;
134
135
}
135
136
136
137
[ Fact ]
137
- public void ConcatAll_must_on_OnError_on_opening_substream_cancel_the_master_stream_and_signal_error ( )
138
+ public async Task ConcatAll_must_on_OnError_on_opening_substream_cancel_the_master_stream_and_signal_error ( )
138
139
{
139
- this . AssertAllStagesStopped ( ( ) =>
140
- {
140
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
141
141
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
142
142
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
143
143
Source . FromPublisher ( publisher )
144
- . ConcatMany < Source < int , NotUsed > , int , NotUsed > ( x => { throw TestException ; } )
144
+ . ConcatMany < Source < int , NotUsed > , int , NotUsed > ( x => { throw TestException ; } )
145
145
. To ( Sink . FromSubscriber ( subscriber ) )
146
146
. Run ( Materializer ) ;
147
147
@@ -155,14 +155,14 @@ public void ConcatAll_must_on_OnError_on_opening_substream_cancel_the_master_str
155
155
upstream . SendNext ( substreamFlow ) ;
156
156
subscriber . ExpectError ( ) . Should ( ) . Be ( TestException ) ;
157
157
upstream . ExpectCancellation ( ) ;
158
+ return Task . CompletedTask ;
158
159
} , Materializer ) ;
159
160
}
160
161
161
162
[ Fact ]
162
- public void ConcatAll_must_on_OnError_on_open_substream_cancel_the_master_stream_and_signal_error ( )
163
+ public async Task ConcatAll_must_on_OnError_on_open_substream_cancel_the_master_stream_and_signal_error ( )
163
164
{
164
- this . AssertAllStagesStopped ( ( ) =>
165
- {
165
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
166
166
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
167
167
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
168
168
Source . FromPublisher ( publisher )
@@ -183,14 +183,14 @@ public void ConcatAll_must_on_OnError_on_open_substream_cancel_the_master_stream
183
183
subUpstream . SendError ( TestException ) ;
184
184
subscriber . ExpectError ( ) . Should ( ) . Be ( TestException ) ;
185
185
upstream . ExpectCancellation ( ) ;
186
+ return Task . CompletedTask ;
186
187
} , Materializer ) ;
187
188
}
188
189
189
190
[ Fact ]
190
- public void ConcatAll_must_on_cancellation_cancel_the_current_open_substream_and_the_master_stream ( )
191
+ public async Task ConcatAll_must_on_cancellation_cancel_the_current_open_substream_and_the_master_stream ( )
191
192
{
192
- this . AssertAllStagesStopped ( ( ) =>
193
- {
193
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
194
194
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
195
195
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
196
196
Source . FromPublisher ( publisher )
@@ -212,14 +212,14 @@ public void ConcatAll_must_on_cancellation_cancel_the_current_open_substream_and
212
212
213
213
subUpstream . ExpectCancellation ( ) ;
214
214
upstream . ExpectCancellation ( ) ;
215
+ return Task . CompletedTask ;
215
216
} , Materializer ) ;
216
217
}
217
218
218
219
[ Fact ]
219
- public void ConcatAll_must_on_cancellation_cancel_the_currently_opening_substream_and_the_master_stream ( )
220
+ public async Task ConcatAll_must_on_cancellation_cancel_the_currently_opening_substream_and_the_master_stream ( )
220
221
{
221
- this . AssertAllStagesStopped ( ( ) =>
222
- {
222
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
223
223
var publisher = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
224
224
var subscriber = this . CreateManualSubscriberProbe < int > ( ) ;
225
225
Source . FromPublisher ( publisher )
@@ -243,14 +243,14 @@ public void ConcatAll_must_on_cancellation_cancel_the_currently_opening_substrea
243
243
244
244
subUpstream . ExpectCancellation ( ) ;
245
245
upstream . ExpectCancellation ( ) ;
246
+ return Task . CompletedTask ;
246
247
} , Materializer ) ;
247
248
}
248
249
249
250
[ Fact ]
250
- public void ConcatAll_must_pass_along_early_cancellation ( )
251
+ public async Task ConcatAll_must_pass_along_early_cancellation ( )
251
252
{
252
- this . AssertAllStagesStopped ( ( ) =>
253
- {
253
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
254
254
var up = this . CreateManualPublisherProbe < Source < int , NotUsed > > ( ) ;
255
255
var down = this . CreateManualSubscriberProbe < int > ( ) ;
256
256
@@ -264,6 +264,7 @@ public void ConcatAll_must_pass_along_early_cancellation()
264
264
up . Subscribe ( flowSubscriber ) ;
265
265
var upSub = up . ExpectSubscription ( ) ;
266
266
upSub . ExpectCancellation ( ) ;
267
+ return Task . CompletedTask ;
267
268
} , Materializer ) ;
268
269
}
269
270
}
0 commit comments