From fab12881af8984db45b1165b76b024de355774d9 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Mon, 27 Mar 2023 23:39:33 +0100 Subject: [PATCH] [74-74] `InputStreamSourceSpec` (#6622) Co-authored-by: Aaron Stannard --- .../IO/InputStreamSourceSpec.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/Akka.Streams.Tests/IO/InputStreamSourceSpec.cs b/src/core/Akka.Streams.Tests/IO/InputStreamSourceSpec.cs index aa9aa4745e7..428533642d3 100644 --- a/src/core/Akka.Streams.Tests/IO/InputStreamSourceSpec.cs +++ b/src/core/Akka.Streams.Tests/IO/InputStreamSourceSpec.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Akka.IO; using Akka.Streams.Dsl; using Akka.Streams.TestKit; @@ -174,23 +175,22 @@ public void InputStreamSource_must_not_signal_when_no_demand() } [Fact] - public void InputStreamSource_must_read_bytes_from_InputStream() + public async Task InputStreamSource_must_read_bytes_from_InputStream() { - this.AssertAllStagesStopped(() => - { - var f = StreamConverters.FromInputStream(() => new ListInputStream(new[] {"a", "b", "c"})) - .RunWith(Sink.First(), _materializer); + await this.AssertAllStagesStoppedAsync(() => { + var f = StreamConverters.FromInputStream(() => new ListInputStream(new[] { "a", "b", "c" })) + .RunWith(Sink.First(), _materializer); f.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); f.Result.Should().BeEquivalentTo(ByteString.FromString("abc")); + return Task.CompletedTask; }, _materializer); } [Fact] - public void InputStreamSource_must_emit_as_soon_as_read() + public async Task InputStreamSource_must_emit_as_soon_as_read() { - this.AssertAllStagesStopped(() => - { + await this.AssertAllStagesStoppedAsync(() => { var latch = new TestLatch(1); var probe = StreamConverters.FromInputStream(() => new EmittedInputStream(latch), chunkSize: 1) .RunWith(this.SinkProbe(), _materializer); @@ -199,6 +199,7 @@ public void InputStreamSource_must_emit_as_soon_as_read() probe.ExpectNext(ByteString.FromString("M")); latch.CountDown(); probe.ExpectComplete(); + return Task.CompletedTask; }, _materializer); } }