9
9
using System . Collections . Generic ;
10
10
using System . Linq ;
11
11
using System . Threading ;
12
+ using System . Threading . Tasks ;
12
13
using Akka . Streams . Dsl ;
13
14
using Akka . Streams . TestKit ;
14
15
using Akka . Util . Internal ;
@@ -32,10 +33,9 @@ protected override TestSubscriber.Probe<int> Setup(IPublisher<int> p1, IPublishe
32
33
}
33
34
34
35
[ Fact ]
35
- public void An_Interleave_for_Flow_must_work_in_the_happy_case ( )
36
+ public async Task An_Interleave_for_Flow_must_work_in_the_happy_case ( )
36
37
{
37
- this . AssertAllStagesStopped ( ( ) =>
38
- {
38
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
39
39
var probe = this . CreateManualSubscriberProbe < int > ( ) ;
40
40
41
41
Source . From ( Enumerable . Range ( 0 , 4 ) )
@@ -52,61 +52,61 @@ public void An_Interleave_for_Flow_must_work_in_the_happy_case()
52
52
collected . Add ( probe . ExpectNext ( ) ) ;
53
53
}
54
54
55
- collected . Should ( ) . BeEquivalentTo ( new [ ] { 0 , 1 , 4 , 7 , 8 , 9 , 5 , 2 , 3 , 10 , 11 , 6 } ) ;
55
+ collected . Should ( ) . BeEquivalentTo ( new [ ] { 0 , 1 , 4 , 7 , 8 , 9 , 5 , 2 , 3 , 10 , 11 , 6 } ) ;
56
56
probe . ExpectComplete ( ) ;
57
+ return Task . CompletedTask ;
57
58
} , Materializer ) ;
58
59
}
59
60
60
61
[ Fact ]
61
- public void An_Interleave_for_Flow_must_work_when_segmentSize_is_not_equal_elements_in_stream ( )
62
+ public async Task An_Interleave_for_Flow_must_work_when_segmentSize_is_not_equal_elements_in_stream ( )
62
63
{
63
- this . AssertAllStagesStopped ( ( ) =>
64
- {
64
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
65
65
var probe = this . CreateManualSubscriberProbe < int > ( ) ;
66
66
67
67
Source . From ( Enumerable . Range ( 0 , 3 ) )
68
68
. Interleave ( Source . From ( Enumerable . Range ( 3 , 3 ) ) , 2 )
69
69
. RunWith ( Sink . FromSubscriber ( probe ) , Materializer ) ;
70
70
71
71
probe . ExpectSubscription ( ) . Request ( 10 ) ;
72
- probe . ExpectNext ( 0 , 1 , 3 , 4 , 2 , 5 ) ;
72
+ probe . ExpectNext ( 0 , 1 , 3 , 4 , 2 , 5 ) ;
73
73
probe . ExpectComplete ( ) ;
74
+ return Task . CompletedTask ;
74
75
} , Materializer ) ;
75
76
}
76
77
77
78
[ Fact ]
78
- public void An_Interleave_for_Flow_must_work_with_segmentSize_1 ( )
79
+ public async Task An_Interleave_for_Flow_must_work_with_segmentSize_1 ( )
79
80
{
80
- this . AssertAllStagesStopped ( ( ) =>
81
- {
81
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
82
82
var probe = this . CreateManualSubscriberProbe < int > ( ) ;
83
83
84
84
Source . From ( Enumerable . Range ( 0 , 3 ) )
85
85
. Interleave ( Source . From ( Enumerable . Range ( 3 , 3 ) ) , 1 )
86
86
. RunWith ( Sink . FromSubscriber ( probe ) , Materializer ) ;
87
87
88
88
probe . ExpectSubscription ( ) . Request ( 10 ) ;
89
- probe . ExpectNext ( 0 , 3 , 1 , 4 , 2 , 5 ) ;
89
+ probe . ExpectNext ( 0 , 3 , 1 , 4 , 2 , 5 ) ;
90
90
probe . ExpectComplete ( ) ;
91
+ return Task . CompletedTask ;
91
92
} , Materializer ) ;
92
93
}
93
94
94
95
[ Fact ]
95
- public void An_Interleave_for_Flow_must_not_work_with_segmentSize_0 ( )
96
+ public async Task An_Interleave_for_Flow_must_not_work_with_segmentSize_0 ( )
96
97
{
97
- this . AssertAllStagesStopped ( ( ) =>
98
- {
98
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
99
99
var source = Source . From ( Enumerable . Range ( 0 , 3 ) ) ;
100
100
source . Invoking ( s => s . Interleave ( Source . From ( Enumerable . Range ( 3 , 3 ) ) , 0 ) )
101
101
. Should ( ) . Throw < ArgumentException > ( ) ;
102
+ return Task . CompletedTask ;
102
103
} , Materializer ) ;
103
104
}
104
105
105
106
[ Fact ]
106
- public void An_Interleave_for_Flow_must_work_when_segmentSize_is_greater_than_stream_elements ( )
107
+ public async Task An_Interleave_for_Flow_must_work_when_segmentSize_is_greater_than_stream_elements ( )
107
108
{
108
- this . AssertAllStagesStopped ( ( ) =>
109
- {
109
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
110
110
var probe = this . CreateManualSubscriberProbe < int > ( ) ;
111
111
Source . From ( Enumerable . Range ( 0 , 3 ) )
112
112
. Interleave ( Source . From ( Enumerable . Range ( 3 , 13 ) ) , 10 )
@@ -126,14 +126,14 @@ public void An_Interleave_for_Flow_must_work_when_segmentSize_is_greater_than_st
126
126
Enumerable . Range ( 21 , 5 ) . ForEach ( i => probe2 . ExpectNext ( i ) ) ;
127
127
Enumerable . Range ( 11 , 10 ) . ForEach ( i => probe2 . ExpectNext ( i ) ) ;
128
128
probe2 . ExpectComplete ( ) ;
129
+ return Task . CompletedTask ;
129
130
} , Materializer ) ;
130
131
}
131
132
132
133
[ Fact ]
133
- public void An_Interleave_for_Flow_must_work_with_one_immediately_completed_and_one_nonempty_publisher ( )
134
+ public async Task An_Interleave_for_Flow_must_work_with_one_immediately_completed_and_one_nonempty_publisher ( )
134
135
{
135
- this . AssertAllStagesStopped ( ( ) =>
136
- {
136
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
137
137
var subscriber1 = Setup ( CompletedPublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
138
138
var subscription1 = subscriber1 . ExpectSubscription ( ) ;
139
139
subscription1 . Request ( 4 ) ;
@@ -146,14 +146,14 @@ public void An_Interleave_for_Flow_must_work_with_one_immediately_completed_and_
146
146
subscription2 . Request ( 4 ) ;
147
147
Enumerable . Range ( 1 , 4 ) . ForEach ( i => subscriber2 . ExpectNext ( i ) ) ;
148
148
subscriber2 . ExpectComplete ( ) ;
149
+ return Task . CompletedTask ;
149
150
} , Materializer ) ;
150
151
}
151
152
152
153
[ Fact ]
153
- public void An_Interleave_for_Flow_must_work_with_one_delayed_completed_and_one_nonempty_publisher ( )
154
+ public async Task An_Interleave_for_Flow_must_work_with_one_delayed_completed_and_one_nonempty_publisher ( )
154
155
{
155
- this . AssertAllStagesStopped ( ( ) =>
156
- {
156
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
157
157
var subscriber1 = Setup ( SoonToCompletePublisher < int > ( ) , NonEmptyPublisher ( Enumerable . Range ( 1 , 4 ) ) ) ;
158
158
var subscription1 = subscriber1 . ExpectSubscription ( ) ;
159
159
subscription1 . Request ( 4 ) ;
@@ -166,6 +166,7 @@ public void An_Interleave_for_Flow_must_work_with_one_delayed_completed_and_one_
166
166
subscription2 . Request ( 4 ) ;
167
167
Enumerable . Range ( 1 , 4 ) . ForEach ( i => subscriber2 . ExpectNext ( i ) ) ;
168
168
subscriber2 . ExpectComplete ( ) ;
169
+ return Task . CompletedTask ;
169
170
} , Materializer ) ;
170
171
}
171
172
@@ -209,10 +210,9 @@ public void An_Interleave_for_Flow_must_work_with_one_delayed_failed_and_one_non
209
210
}
210
211
211
212
[ Fact ]
212
- public void An_Interleave_for_Flow_must_pass_along_early_cancellation ( )
213
+ public async Task An_Interleave_for_Flow_must_pass_along_early_cancellation ( )
213
214
{
214
- this . AssertAllStagesStopped ( ( ) =>
215
- {
215
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
216
216
var up1 = this . CreateManualPublisherProbe < int > ( ) ;
217
217
var up2 = this . CreateManualPublisherProbe < int > ( ) ;
218
218
var down = this . CreateManualSubscriberProbe < int > ( ) ;
@@ -230,6 +230,7 @@ public void An_Interleave_for_Flow_must_pass_along_early_cancellation()
230
230
up2 . Subscribe ( graphSubscriber2 ) ;
231
231
up1 . ExpectSubscription ( ) . ExpectCancellation ( ) ;
232
232
up2 . ExpectSubscription ( ) . ExpectCancellation ( ) ;
233
+ return Task . CompletedTask ;
233
234
} , Materializer ) ;
234
235
}
235
236
}
0 commit comments