Skip to content

[40-74] FlowZipSpec #6587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/core/Akka.Streams.Tests/Dsl/FlowZipSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Streams.Dsl;
using Akka.Streams.TestKit;
using FluentAssertions;
Expand All @@ -32,47 +33,46 @@ public FlowZipSpec(ITestOutputHelper output = null) : base(output)
}

[Fact]
public void A_Zip_for_Flow_must_work_in_the_happy_case()
public async Task A_Zip_for_Flow_must_work_in_the_happy_case()
{
this.AssertAllStagesStopped(() =>
{
await this.AssertAllStagesStoppedAsync(async() => {
var probe = this.CreateManualSubscriberProbe<(int, string)>();
Source.From(Enumerable.Range(1, 4))
.Zip(Source.From(new[] {"A", "B", "C", "D", "E", "F"}))
.Zip(Source.From(new[] { "A", "B", "C", "D", "E", "F" }))
.RunWith(Sink.FromSubscriber(probe), Materializer);
var subscription = probe.ExpectSubscription();
var subscription = await probe.ExpectSubscriptionAsync();

subscription.Request(2);
probe.ExpectNext((1, "A"));
probe.ExpectNext((2, "B"));
await probe.ExpectNextAsync((1, "A"));
await probe.ExpectNextAsync((2, "B"));

subscription.Request(1);
probe.ExpectNext((3, "C"));
await probe.ExpectNextAsync((3, "C"));
subscription.Request(1);
probe.ExpectNext((4, "D"));
await probe.ExpectNextAsync((4, "D"));

probe.ExpectComplete();
await probe.ExpectCompleteAsync();
}, Materializer);
}

[Fact]
public void A_Zip_for_Flow_must_work_with_one_immediately_completed_and_one_nonempty_publisher()
public async Task A_Zip_for_Flow_must_work_with_one_immediately_completed_and_one_nonempty_publisher()
{
var subscriber1 = Setup(CompletedPublisher<int>(), NonEmptyPublisher(Enumerable.Range(1, 4)));
subscriber1.ExpectSubscriptionAndComplete();
await subscriber1.ExpectSubscriptionAndCompleteAsync();

var subscriber2 = Setup(NonEmptyPublisher(Enumerable.Range(1, 4)), CompletedPublisher<int>());
subscriber2.ExpectSubscriptionAndComplete();
await subscriber2.ExpectSubscriptionAndCompleteAsync();
}

[Fact]
public void A_Zip_for_Flow_must_work_with_one_delayed_completed_and_one_nonempty_publisher()
public async Task A_Zip_for_Flow_must_work_with_one_delayed_completed_and_one_nonempty_publisher()
{
var subscriber1 = Setup(SoonToCompletePublisher<int>(), NonEmptyPublisher(Enumerable.Range(1, 4)));
subscriber1.ExpectSubscriptionAndComplete();
await subscriber1.ExpectSubscriptionAndCompleteAsync();

var subscriber2 = Setup(NonEmptyPublisher(Enumerable.Range(1, 4)), SoonToCompletePublisher<int>());
subscriber2.ExpectSubscriptionAndComplete();
await subscriber2.ExpectSubscriptionAndCompleteAsync();
}

[Fact]
Expand Down