@@ -49,10 +49,9 @@ public FileSourceSpec(ITestOutputHelper helper) : base(Utils.UnboundedMailboxCon
49
49
}
50
50
51
51
[ Fact ]
52
- public void FileSource_should_read_contents_from_a_file ( )
52
+ public async Task FileSource_should_read_contents_from_a_file ( )
53
53
{
54
- this . AssertAllStagesStopped ( ( ) =>
55
- {
54
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
56
55
var chunkSize = 512 ;
57
56
var bufferAttributes = Attributes . CreateInputBuffer ( 1 , 2 ) ;
58
57
@@ -99,14 +98,14 @@ public void FileSource_should_read_contents_from_a_file()
99
98
}
100
99
sub . Request ( 1 ) ;
101
100
c . ExpectComplete ( ) ;
101
+ return Task . CompletedTask ;
102
102
} , _materializer ) ;
103
103
}
104
104
105
105
[ Fact ]
106
- public void Filesource_could_read_partial_contents_from_a_file ( )
106
+ public async Task Filesource_could_read_partial_contents_from_a_file ( )
107
107
{
108
- this . AssertAllStagesStopped ( ( ) =>
109
- {
108
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
110
109
var chunkSize = 512 ;
111
110
var startPosition = 1000 ;
112
111
var bufferAttributes = Attributes . CreateInputBuffer ( 1 , 2 ) ;
@@ -121,7 +120,8 @@ public void Filesource_could_read_partial_contents_from_a_file()
121
120
122
121
var remaining = _testText . Substring ( 1000 ) ;
123
122
124
- var nextChunk = new Func < string > ( ( ) => {
123
+ var nextChunk = new Func < string > ( ( ) =>
124
+ {
125
125
string chunks ;
126
126
127
127
if ( remaining . Length <= chunkSize )
@@ -141,21 +141,20 @@ public void Filesource_could_read_partial_contents_from_a_file()
141
141
sub . Request ( 5000 ) ;
142
142
143
143
var expectedChunk = nextChunk ( ) ;
144
- for ( int i = 0 ; i < 10 ; ++ i )
144
+ for ( int i = 0 ; i < 10 ; ++ i )
145
145
{
146
146
c . ExpectNext ( ) . ToString ( ) . Should ( ) . Be ( expectedChunk ) ;
147
147
expectedChunk = nextChunk ( ) ;
148
148
}
149
149
c . ExpectComplete ( ) ;
150
-
150
+ return Task . CompletedTask ;
151
151
} , _materializer ) ;
152
152
}
153
153
154
154
[ Fact ]
155
- public void FileSource_should_complete_only_when_all_contents_of_a_file_have_been_signalled ( )
155
+ public async Task FileSource_should_complete_only_when_all_contents_of_a_file_have_been_signalled ( )
156
156
{
157
- this . AssertAllStagesStopped ( ( ) =>
158
- {
157
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
159
158
var chunkSize = 512 ;
160
159
var bufferAttributes = Attributes . CreateInputBuffer ( 1 , 2 ) ;
161
160
var demandAllButOnechunks = _testText . Length / chunkSize - 1 ;
@@ -199,18 +198,18 @@ public void FileSource_should_complete_only_when_all_contents_of_a_file_have_bee
199
198
sub . Request ( 1 ) ;
200
199
c . ExpectNext ( ) . ToString ( Encoding . UTF8 ) . Should ( ) . Be ( nextChunk ( ) ) ;
201
200
c . ExpectComplete ( ) ;
201
+ return Task . CompletedTask ;
202
202
} , _materializer ) ;
203
203
}
204
204
205
205
[ Fact ]
206
- public void FileSource_should_open_file_in_shared_mode_for_reading_multiple_times ( )
206
+ public async Task FileSource_should_open_file_in_shared_mode_for_reading_multiple_times ( )
207
207
{
208
- this . AssertAllStagesStopped ( ( ) =>
209
- {
208
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
210
209
var testFile = TestFile ( ) ;
211
210
var p1 = FileIO . FromFile ( testFile ) . RunWith ( Sink . AsPublisher < ByteString > ( false ) , _materializer ) ;
212
211
var p2 = FileIO . FromFile ( testFile ) . RunWith ( Sink . AsPublisher < ByteString > ( false ) , _materializer ) ;
213
-
212
+
214
213
var c1 = this . CreateManualSubscriberProbe < ByteString > ( ) ;
215
214
var c2 = this . CreateManualSubscriberProbe < ByteString > ( ) ;
216
215
p1 . Subscribe ( c1 ) ;
@@ -223,14 +222,14 @@ public void FileSource_should_open_file_in_shared_mode_for_reading_multiple_time
223
222
224
223
c1 . ExpectNext ( ) ;
225
224
c2 . ExpectNext ( ) ;
226
-
225
+ return Task . CompletedTask ;
227
226
} , _materializer ) ;
228
227
}
229
228
230
229
[ Fact ]
231
- public void FileSource_should_onError_with_failure_and_return_a_failed_IOResult_when_trying_to_read_from_file_which_does_not_exist ( )
230
+ public async Task FileSource_should_onError_with_failure_and_return_a_failed_IOResult_when_trying_to_read_from_file_which_does_not_exist ( )
232
231
{
233
- this . AssertAllStagesStopped ( async ( ) =>
232
+ await this . AssertAllStagesStoppedAsync ( async ( ) =>
234
233
{
235
234
var t = FileIO . FromFile ( NotExistingFile ( ) )
236
235
. ToMaterialized ( Sink . AsPublisher < ByteString > ( false ) , Keep . Both )
@@ -267,10 +266,9 @@ public void FileSource_should_count_lines_in_a_real_file(int chunkSize, int read
267
266
}
268
267
269
268
[ Fact ]
270
- public void FileSource_should_use_dedicated_blocking_io_dispatcher_by_default ( )
269
+ public async Task FileSource_should_use_dedicated_blocking_io_dispatcher_by_default ( )
271
270
{
272
- this . AssertAllStagesStopped ( ( ) =>
273
- {
271
+ await this . AssertAllStagesStoppedAsync ( ( ) => {
274
272
var sys = ActorSystem . Create ( "dispatcher-testing" , Utils . UnboundedMailboxConfig ) ;
275
273
var materializer = sys . Materializer ( ) ;
276
274
@@ -293,6 +291,8 @@ public void FileSource_should_use_dedicated_blocking_io_dispatcher_by_default()
293
291
{
294
292
Shutdown ( sys ) ;
295
293
}
294
+
295
+ return Task . CompletedTask ;
296
296
} , _materializer ) ;
297
297
}
298
298
0 commit comments