From cc76977cedf1123a651419950c8cda7b4388e1cb Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Sun, 26 Mar 2023 11:17:03 +0100 Subject: [PATCH 1/2] [65-74] `SubscriberSinkSpec` --- src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs b/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs index ce5e5b158ef..f45e454e5d2 100644 --- a/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs @@ -6,6 +6,7 @@ //----------------------------------------------------------------------- using System.Linq; +using System.Threading.Tasks; using Akka.Streams.Dsl; using Akka.Streams.TestKit; using Akka.TestKit; @@ -25,10 +26,9 @@ public SubscriberSinkSpec(ITestOutputHelper helper = null) : base(helper) } [Fact] - public void A_Flow_with_SubscriberSink_must_publish_elements_to_the_subscriber() + public async Task A_Flow_with_SubscriberSink_must_publish_elements_to_the_subscriber() { - this.AssertAllStagesStopped(() => - { + await this.AssertAllStagesStoppedAsync(() => { var c = this.CreateManualSubscriberProbe(); Source.From(Enumerable.Range(1, 3)).To(Sink.FromSubscriber(c)).Run(Materializer); @@ -38,6 +38,7 @@ public void A_Flow_with_SubscriberSink_must_publish_elements_to_the_subscriber() c.ExpectNext(2); c.ExpectNext(3); c.ExpectComplete(); + return Task.CompletedTask; }, Materializer); } } From d27a4f904a374574fb6f51149828e4eb685938ff Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Wed, 29 Mar 2023 11:28:01 +0100 Subject: [PATCH 2/2] Changes to `async/await` --- .../Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs b/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs index f45e454e5d2..06c975a51e7 100644 --- a/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs +++ b/src/core/Akka.Streams.Tests/Dsl/SubscriberSinkSpec.cs @@ -28,17 +28,16 @@ public SubscriberSinkSpec(ITestOutputHelper helper = null) : base(helper) [Fact] public async Task A_Flow_with_SubscriberSink_must_publish_elements_to_the_subscriber() { - await this.AssertAllStagesStoppedAsync(() => { + await this.AssertAllStagesStoppedAsync(async() => { var c = this.CreateManualSubscriberProbe(); Source.From(Enumerable.Range(1, 3)).To(Sink.FromSubscriber(c)).Run(Materializer); - var s = c.ExpectSubscription(); + var s = await c.ExpectSubscriptionAsync(); s.Request(3); - c.ExpectNext(1); - c.ExpectNext(2); - c.ExpectNext(3); - c.ExpectComplete(); - return Task.CompletedTask; + await c.ExpectNextAsync(1); + await c.ExpectNextAsync(2); + await c.ExpectNextAsync(3); + await c.ExpectCompleteAsync(); }, Materializer); } }