@@ -44,66 +44,63 @@ private static Flow<int, int, NotUsed> SumFlow
44
44
private static Sink < int , Task < int > > SumSink => Sink . Sum < int > ( ( i , i1 ) => i + i1 ) ;
45
45
46
46
[ Fact ]
47
- public void A_Sum_must_work_when_using_Source_RunSum ( )
47
+ public async Task A_Sum_must_work_when_using_Source_RunSum ( )
48
48
{
49
- this . AssertAllStagesStopped ( ( ) =>
50
- {
49
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
51
50
var t = InputSource . RunSum ( ( i , i1 ) => i + i1 , Materializer ) ;
52
51
t . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
53
52
t . Result . Should ( ) . Be ( Expected ) ;
53
+ return Task . CompletedTask ;
54
54
} , Materializer ) ;
55
55
}
56
56
57
57
[ Fact ]
58
- public void A_Sum_must_work_when_using_Source_Sum ( )
58
+ public async Task A_Sum_must_work_when_using_Source_Sum ( )
59
59
{
60
- this . AssertAllStagesStopped ( ( ) =>
61
- {
60
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
62
61
var t = SumSource . RunWith ( Sink . First < int > ( ) , Materializer ) ;
63
62
t . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
64
63
t . Result . Should ( ) . Be ( Expected ) ;
64
+ return Task . CompletedTask ;
65
65
} , Materializer ) ;
66
66
}
67
67
[ Fact ]
68
- public void A_Sum_must_work_when_using_Sink_Sum ( )
68
+ public async Task A_Sum_must_work_when_using_Sink_Sum ( )
69
69
{
70
- this . AssertAllStagesStopped ( ( ) =>
71
- {
70
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
72
71
var t = InputSource . RunWith ( SumSink , Materializer ) ;
73
72
t . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
74
73
t . Result . Should ( ) . Be ( Expected ) ;
75
-
74
+ return Task . CompletedTask ;
76
75
} , Materializer ) ;
77
76
}
78
77
79
78
[ Fact ]
80
- public void A_Sum_must_work_when_using_Flow_Sum ( )
79
+ public async Task A_Sum_must_work_when_using_Flow_Sum ( )
81
80
{
82
- this . AssertAllStagesStopped ( ( ) =>
83
- {
81
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
84
82
var t = InputSource . Via ( SumFlow ) . RunWith ( Sink . First < int > ( ) , Materializer ) ;
85
83
t . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
86
84
t . Result . Should ( ) . Be ( Expected ) ;
85
+ return Task . CompletedTask ;
87
86
} , Materializer ) ;
88
87
}
89
88
90
89
[ Fact ]
91
- public void A_Sum_must_work_when_using_Source_Sum_and_Flow_Sum_and_Sink_Sum ( )
90
+ public async Task A_Sum_must_work_when_using_Source_Sum_and_Flow_Sum_and_Sink_Sum ( )
92
91
{
93
- this . AssertAllStagesStopped ( ( ) =>
94
- {
92
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
95
93
var t = SumSource . Via ( SumFlow ) . RunWith ( SumSink , Materializer ) ;
96
94
t . Wait ( TimeSpan . FromSeconds ( 3 ) ) . Should ( ) . BeTrue ( ) ;
97
95
t . Result . Should ( ) . Be ( Expected ) ;
98
-
96
+ return Task . CompletedTask ;
99
97
} , Materializer ) ;
100
98
}
101
99
102
100
[ Fact ]
103
- public void A_Sum_must_propagate_an_error ( )
101
+ public async Task A_Sum_must_propagate_an_error ( )
104
102
{
105
- this . AssertAllStagesStopped ( ( ) =>
106
- {
103
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
107
104
var error = new TestException ( "test" ) ;
108
105
var task = InputSource . Select ( x =>
109
106
{
@@ -113,14 +110,14 @@ public void A_Sum_must_propagate_an_error()
113
110
} ) . RunSum ( ( i , i1 ) => 0 , Materializer ) ;
114
111
115
112
task . Invoking ( t => t . Wait ( TimeSpan . FromSeconds ( 3 ) ) ) . Should ( ) . Throw < TestException > ( ) . WithMessage ( "test" ) ;
113
+ return Task . CompletedTask ;
116
114
} , Materializer ) ;
117
115
}
118
116
119
117
[ Fact ]
120
- public void A_Sum_must_complete_task_with_failure_when_reduce_function_throws_and_the_supervisor_strategy_decides_to_stop ( )
118
+ public async Task A_Sum_must_complete_task_with_failure_when_reduce_function_throws_and_the_supervisor_strategy_decides_to_stop ( )
121
119
{
122
- this . AssertAllStagesStopped ( ( ) =>
123
- {
120
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
124
121
var error = new TestException ( "test" ) ;
125
122
var task = InputSource . RunSum ( ( x , y ) =>
126
123
{
@@ -130,13 +127,14 @@ public void A_Sum_must_complete_task_with_failure_when_reduce_function_throws_an
130
127
} , Materializer ) ;
131
128
132
129
task . Invoking ( t => t . Wait ( TimeSpan . FromSeconds ( 3 ) ) ) . Should ( ) . Throw < TestException > ( ) . WithMessage ( "test" ) ;
130
+ return Task . CompletedTask ;
133
131
} , Materializer ) ;
134
132
}
135
133
136
134
[ Fact ]
137
- public void A_Sum_must_resume_with_the_accumulated_state_when_the_reduce_funtion_throws_and_the_supervisor_strategy_decides_to_resume ( )
135
+ public async Task A_Sum_must_resume_with_the_accumulated_state_when_the_reduce_funtion_throws_and_the_supervisor_strategy_decides_to_resume ( )
138
136
{
139
- this . AssertAllStagesStopped ( async ( ) =>
137
+ await this . AssertAllStagesStoppedAsync ( async ( ) =>
140
138
{
141
139
var error = new Exception ( "boom" ) ;
142
140
var sum = Sink . Sum ( ( int x , int y ) =>
@@ -155,9 +153,9 @@ public void A_Sum_must_resume_with_the_accumulated_state_when_the_reduce_funtion
155
153
}
156
154
157
155
[ Fact ]
158
- public void A_Aggregate_must_resume_and_reset_the_state_when_the_reduce_funtion_throws_and_the_supervisor_strategy_decides_to_restart ( )
156
+ public async Task A_Aggregate_must_resume_and_reset_the_state_when_the_reduce_funtion_throws_and_the_supervisor_strategy_decides_to_restart ( )
159
157
{
160
- this . AssertAllStagesStopped ( async ( ) =>
158
+ await this . AssertAllStagesStoppedAsync ( async ( ) =>
161
159
{
162
160
var error = new Exception ( "boom" ) ;
163
161
var sum = Sink . Sum ( ( int x , int y ) =>
@@ -176,44 +174,44 @@ public void A_Aggregate_must_resume_and_reset_the_state_when_the_reduce_funtion_
176
174
}
177
175
178
176
[ Fact ]
179
- public void A_Sum_must_fail_on_Empty_stream_using_Source_RunSum ( )
177
+ public async Task A_Sum_must_fail_on_Empty_stream_using_Source_RunSum ( )
180
178
{
181
- this . AssertAllStagesStopped ( ( ) =>
182
- {
179
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
183
180
var result = Source . Empty < int > ( ) . RunSum ( ( i , i1 ) => i + i1 , Materializer ) ;
184
181
result . Invoking ( t => t . Wait ( TimeSpan . FromSeconds ( 3 ) ) )
185
182
. Should ( ) . Throw < NoSuchElementException > ( )
186
183
. And . Message . Should ( )
187
184
. Contain ( "empty stream" ) ;
185
+ return Task . CompletedTask ;
188
186
} , Materializer ) ;
189
187
}
190
188
191
189
[ Fact ]
192
- public void A_Sum_must_fail_on_Empty_stream_using_Flow_Sum ( )
190
+ public async Task A_Sum_must_fail_on_Empty_stream_using_Flow_Sum ( )
193
191
{
194
- this . AssertAllStagesStopped ( ( ) =>
195
- {
196
- var result = Source . Empty < int > ( )
197
- . Via ( SumFlow )
198
- . RunWith ( Sink . Aggregate < int , int > ( 0 , ( i , i1 ) => i + i1 ) , Materializer ) ;
192
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
193
+ var result = Source . Empty < int > ( )
194
+ . Via ( SumFlow )
195
+ . RunWith ( Sink . Aggregate < int , int > ( 0 , ( i , i1 ) => i + i1 ) , Materializer ) ;
199
196
result . Invoking ( t => t . Wait ( TimeSpan . FromSeconds ( 3 ) ) )
200
197
. Should ( ) . Throw < NoSuchElementException > ( )
201
198
. And . Message . Should ( )
202
199
. Contain ( "empty stream" ) ;
200
+ return Task . CompletedTask ;
203
201
} , Materializer ) ;
204
202
}
205
203
206
204
[ Fact ]
207
- public void A_Sum_must_fail_on_Empty_stream_using_Sink_Sum ( )
205
+ public async Task A_Sum_must_fail_on_Empty_stream_using_Sink_Sum ( )
208
206
{
209
- this . AssertAllStagesStopped ( ( ) =>
210
- {
211
- var result = Source . Empty < int > ( )
212
- . RunWith ( SumSink , Materializer ) ;
207
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
208
+ var result = Source . Empty < int > ( )
209
+ . RunWith ( SumSink , Materializer ) ;
213
210
result . Invoking ( t => t . Wait ( TimeSpan . FromSeconds ( 3 ) ) )
214
211
. Should ( ) . Throw < NoSuchElementException > ( )
215
212
. And . Message . Should ( )
216
213
. Contain ( "empty stream" ) ;
214
+ return Task . CompletedTask ;
217
215
} , Materializer ) ;
218
216
}
219
217
}
0 commit comments