Skip to content

Commit 342ea04

Browse files
authored
[15-74]FlowInitialDelaySpec (#6671)
1 parent b63df56 commit 342ea04

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

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

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
//-----------------------------------------------------------------------
22
// <copyright file="FlowInitialDelaySpec.cs" company="Akka.NET Project">
3-
// Copyright (C) 2009-2023 Lightbend Inc. <http://www.lightbend.com>
4-
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net>
3+
// Copyright (C) 2009-2022 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2022 .NET Foundation <https://github.com/akkadotnet/akka.net>
55
// </copyright>
66
//-----------------------------------------------------------------------
77

88
using System;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using System.Threading.Tasks;
1112
using Akka.Streams.Dsl;
1213
using Akka.Streams.TestKit;
1314
using Akka.TestKit;
@@ -30,48 +31,47 @@ public FlowInitialDelaySpec(ITestOutputHelper helper) : base(helper)
3031
}
3132

3233
[Fact]
33-
public void Flow_InitialDelay_must_work_with_zero_delay()
34+
public async Task Flow_InitialDelay_must_work_with_zero_delay()
3435
{
35-
this.AssertAllStagesStopped(() =>
36-
{
36+
await this.AssertAllStagesStoppedAsync(() => {
3737
var task = Source.From(Enumerable.Range(1, 10))
38-
.InitialDelay(TimeSpan.Zero)
39-
.Grouped(100)
40-
.RunWith(Sink.First<IEnumerable<int>>(), Materializer);
38+
.InitialDelay(TimeSpan.Zero)
39+
.Grouped(100)
40+
.RunWith(Sink.First<IEnumerable<int>>(), Materializer);
4141
task.Wait(TimeSpan.FromSeconds(1)).Should().BeTrue();
42-
task.Result.Should().BeEquivalentTo(Enumerable.Range(1,10));
42+
task.Result.Should().BeEquivalentTo(Enumerable.Range(1, 10));
43+
return Task.CompletedTask;
4344
}, Materializer);
4445
}
4546

4647
[Fact]
47-
public void Flow_InitialDelay_must_delay_elements_by_the_specified_time_but_not_more()
48+
public async Task Flow_InitialDelay_must_delay_elements_by_the_specified_time_but_not_more()
4849
{
49-
this.AssertAllStagesStopped(() =>
50-
{
50+
await this.AssertAllStagesStoppedAsync(() => {
5151
var task = Source.From(Enumerable.Range(1, 10))
52-
.InitialDelay(TimeSpan.FromSeconds(2))
53-
.InitialTimeout(TimeSpan.FromSeconds(1))
54-
.RunWith(Sink.Ignore<int>(), Materializer);
52+
.InitialDelay(TimeSpan.FromSeconds(2))
53+
.InitialTimeout(TimeSpan.FromSeconds(1))
54+
.RunWith(Sink.Ignore<int>(), Materializer);
5555
task.Invoking(t => t.Wait(TimeSpan.FromSeconds(2))).Should().Throw<TimeoutException>();
56+
return Task.CompletedTask;
5657
}, Materializer);
5758
}
5859

5960
[Fact]
60-
public void Flow_InitialDelay_must_properly_ignore_timer_while_backpressured()
61+
public async Task Flow_InitialDelay_must_properly_ignore_timer_while_backpressured()
6162
{
62-
this.AssertAllStagesStopped(() =>
63-
{
63+
await this.AssertAllStagesStoppedAsync(async() => {
6464
var probe = this.CreateSubscriberProbe<int>();
6565
Source.From(Enumerable.Range(1, 10))
6666
.InitialDelay(TimeSpan.FromSeconds(0.5))
6767
.RunWith(Sink.FromSubscriber(probe), Materializer);
6868

69-
probe.EnsureSubscription();
70-
probe.ExpectNoMsg(TimeSpan.FromSeconds(1.5));
71-
probe.Request(20);
72-
probe.ExpectNextN(Enumerable.Range(1, 10));
69+
await probe.EnsureSubscriptionAsync();
70+
await probe.ExpectNoMsgAsync(TimeSpan.FromSeconds(1.5));
71+
await probe.RequestAsync(20);
72+
await probe.ExpectNextNAsync(Enumerable.Range(1, 10));
7373

74-
probe.ExpectComplete();
74+
await probe.ExpectCompleteAsync();
7575
}, Materializer);
7676
}
7777
}

0 commit comments

Comments
 (0)