8
8
using System ;
9
9
using System . Collections . Generic ;
10
10
using System . Linq ;
11
+ using System . Threading . Tasks ;
11
12
using Akka . Actor ;
12
13
using Akka . Streams . Dsl ;
13
14
using Akka . Streams . TestKit ;
@@ -84,10 +85,9 @@ private static List<List<int>> Sliding(List<int> source, int win, int step)
84
85
}
85
86
86
87
[ Fact ]
87
- public void Sliding_must_behave_just_like_collections_sliding_with_step_lower_than_window ( )
88
+ public async Task Sliding_must_behave_just_like_collections_sliding_with_step_lower_than_window ( )
88
89
{
89
- this . AssertAllStagesStopped ( ( ) =>
90
- {
90
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
91
91
var random = new Random ( ) ;
92
92
var gen = Enumerable . Range ( 1 , 1000 )
93
93
. Select ( _ =>
@@ -97,14 +97,14 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_lower_th
97
97
} ) ;
98
98
99
99
Check ( gen ) ;
100
+ return Task . CompletedTask ;
100
101
} , Materializer ) ;
101
102
}
102
103
103
104
[ Fact ]
104
- public void Sliding_must_behave_just_like_collections_sliding_with_step_equals_window ( )
105
+ public async Task Sliding_must_behave_just_like_collections_sliding_with_step_equals_window ( )
105
106
{
106
- this . AssertAllStagesStopped ( ( ) =>
107
- {
107
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
108
108
var random = new Random ( ) ;
109
109
var gen = Enumerable . Range ( 1 , 1000 )
110
110
. Select ( _ =>
@@ -114,14 +114,14 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_equals_w
114
114
} ) ;
115
115
116
116
Check ( gen ) ;
117
+ return Task . CompletedTask ;
117
118
} , Materializer ) ;
118
119
}
119
120
120
121
[ Fact ]
121
- public void Sliding_must_behave_just_like_collections_sliding_with_step_greater_than_window ( )
122
+ public async Task Sliding_must_behave_just_like_collections_sliding_with_step_greater_than_window ( )
122
123
{
123
- this . AssertAllStagesStopped ( ( ) =>
124
- {
124
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
125
125
var random = new Random ( ) ;
126
126
var gen = Enumerable . Range ( 1 , 1000 )
127
127
. Select ( _ =>
@@ -131,23 +131,23 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_greater_
131
131
} ) ;
132
132
133
133
Check ( gen ) ;
134
+ return Task . CompletedTask ;
134
135
} , Materializer ) ;
135
136
}
136
137
137
138
[ Fact ]
138
- public void Sliding_must_work_with_empty_sources ( )
139
+ public async Task Sliding_must_work_with_empty_sources ( )
139
140
{
140
- this . AssertAllStagesStopped ( ( ) =>
141
- {
142
- Source . Empty < int > ( ) . Sliding ( 1 ) . RunForeach ( ints => TestActor . Tell ( ints ) , Materializer )
143
- . ContinueWith ( t =>
144
- {
145
- if ( t . IsCompleted && t . Exception == null )
146
- TestActor . Tell ( "done" ) ;
147
- } ) ;
148
-
149
-
150
- ExpectMsg ( "done" ) ;
141
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
142
+ await Source . Empty < int > ( ) . Sliding ( 1 )
143
+ . RunForeach ( ints => TestActor . Tell ( ints ) , Materializer )
144
+ . ContinueWith ( t =>
145
+ {
146
+ if ( t . IsCompleted && t . Exception == null )
147
+ TestActor . Tell ( "done" ) ;
148
+ } ) ;
149
+ await ExpectMsgAsync ( "done" ) ;
150
+ return Task . CompletedTask ;
151
151
} , Materializer ) ;
152
152
}
153
153
}
0 commit comments