Skip to content

Commit fd322e9

Browse files
authored
[30-74] FlowSlidingSpec (#6577)
* [30-74] `FlowSlidingSpec` * Change to `async` TestKit
1 parent 0d6ec15 commit fd322e9

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/core/Akka.Streams.Tests/Dsl/FlowSlidingSpec.cs

+21-21
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Threading.Tasks;
1112
using Akka.Actor;
1213
using Akka.Streams.Dsl;
1314
using Akka.Streams.TestKit;
@@ -84,10 +85,9 @@ private static List<List<int>> Sliding(List<int> source, int win, int step)
8485
}
8586

8687
[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()
8889
{
89-
this.AssertAllStagesStopped(() =>
90-
{
90+
await this.AssertAllStagesStoppedAsync(() => {
9191
var random = new Random();
9292
var gen = Enumerable.Range(1, 1000)
9393
.Select(_ =>
@@ -97,14 +97,14 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_lower_th
9797
});
9898

9999
Check(gen);
100+
return Task.CompletedTask;
100101
}, Materializer);
101102
}
102103

103104
[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()
105106
{
106-
this.AssertAllStagesStopped(() =>
107-
{
107+
await this.AssertAllStagesStoppedAsync(() => {
108108
var random = new Random();
109109
var gen = Enumerable.Range(1, 1000)
110110
.Select(_ =>
@@ -114,14 +114,14 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_equals_w
114114
});
115115

116116
Check(gen);
117+
return Task.CompletedTask;
117118
}, Materializer);
118119
}
119120

120121
[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()
122123
{
123-
this.AssertAllStagesStopped(() =>
124-
{
124+
await this.AssertAllStagesStoppedAsync(() => {
125125
var random = new Random();
126126
var gen = Enumerable.Range(1, 1000)
127127
.Select(_ =>
@@ -131,23 +131,23 @@ public void Sliding_must_behave_just_like_collections_sliding_with_step_greater_
131131
});
132132

133133
Check(gen);
134+
return Task.CompletedTask;
134135
}, Materializer);
135136
}
136137

137138
[Fact]
138-
public void Sliding_must_work_with_empty_sources()
139+
public async Task Sliding_must_work_with_empty_sources()
139140
{
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;
151151
}, Materializer);
152152
}
153153
}

0 commit comments

Comments
 (0)