-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[39-74] FlowWireTapSpec
#6586
Merged
Merged
[39-74] FlowWireTapSpec
#6586
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0f75de1
[39-74] `FlowWireTapSpec`
eaba b04f871
Changes to `async` TestKit
eaba 77b1fba
Merge branch 'dev' into FlowWireTapSpec
eaba 9b6bee3
fix
eaba 12d5d4d
Update FlowWireTapSpec.cs
Aaronontheweb d854709
Merge branch 'dev' into FlowWireTapSpec
eaba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Akka.Actor; | ||
using Akka.Streams.Dsl; | ||
using Akka.Streams.TestKit; | ||
|
@@ -30,62 +31,59 @@ public FlowWireTapSpec(ITestOutputHelper helper) | |
} | ||
|
||
[Fact] | ||
public void A_wireTap_must_call_the_procedure_for_each_element() | ||
public async Task A_wireTap_must_call_the_procedure_for_each_element() | ||
{ | ||
this.AssertAllStagesStopped(() => | ||
{ | ||
Source.From(Enumerable.Range(1, 100)) | ||
.WireTap(i => TestActor.Tell(i)) | ||
.RunWith(Sink.Ignore<int>(), Materializer).Wait(); | ||
|
||
Enumerable.Range(1, 100).Select(i => ExpectMsg(i)); | ||
await this.AssertAllStagesStoppedAsync(async () => { | ||
Source.From(Enumerable.Range(1, 100)) | ||
.WireTap(i => TestActor.Tell(i)) | ||
.RunWith(Sink.Ignore<int>(), Materializer).Wait(); | ||
foreach (var i in Enumerable.Range(1, 100)) | ||
await ExpectMsgAsync(i); | ||
//Enumerable.Range(1, 100).Select(i => ExpectMsg(i)); | ||
//return Task.CompletedTask; | ||
}, Materializer); | ||
} | ||
|
||
[Fact] | ||
public void A_wireTap_must_complete_the_future_for_an_empty_stream() | ||
public async Task A_wireTap_must_complete_the_future_for_an_empty_stream() | ||
{ | ||
this.AssertAllStagesStopped(() => | ||
{ | ||
Source.Empty<string>() | ||
.WireTap(i => TestActor.Tell(i)) | ||
.RunWith(Sink.Ignore<string>(), Materializer) | ||
.ContinueWith(_ => TestActor.Tell("done")); | ||
|
||
ExpectMsg("done"); | ||
|
||
await this.AssertAllStagesStoppedAsync(async() => { | ||
await Source.Empty<string>() | ||
.WireTap(i => TestActor.Tell(i)) | ||
.RunWith(Sink.Ignore<string>(), Materializer) | ||
.ContinueWith(_ => TestActor.Tell("done")); | ||
await ExpectMsgAsync("done"); | ||
//return Task.CompletedTask; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete commented code |
||
}, Materializer); | ||
} | ||
|
||
[Fact] | ||
public void A_wireTap_must_yield_the_first_error() | ||
public async Task A_wireTap_must_yield_the_first_error() | ||
{ | ||
this.AssertAllStagesStopped(() => | ||
{ | ||
await this.AssertAllStagesStoppedAsync(async() => { | ||
var p = this.CreateManualPublisherProbe<int>(); | ||
|
||
Source.FromPublisher(p) | ||
.WireTap(i => TestActor.Tell(i)) | ||
.RunWith(Sink.Ignore<int>(), Materializer) | ||
.ContinueWith(t => TestActor.Tell(t.Exception.InnerException)); | ||
|
||
var proc = p.ExpectSubscription(); | ||
proc.ExpectRequest(); | ||
var proc = await p.ExpectSubscriptionAsync(); | ||
await proc.ExpectRequestAsync(); | ||
var rte = new Exception("ex"); | ||
proc.SendError(rte); | ||
ExpectMsg(rte); | ||
|
||
await ExpectMsgAsync(rte); | ||
}, Materializer); | ||
} | ||
|
||
[Fact] | ||
public void A_wireTap_must_no_cause_subsequent_stages_to_be_failed_if_throws() | ||
public async Task A_wireTap_must_no_cause_subsequent_stages_to_be_failed_if_throws() | ||
{ | ||
this.AssertAllStagesStopped(() => | ||
{ | ||
await this.AssertAllStagesStoppedAsync(() => { | ||
var error = new TestException("Boom!"); | ||
var future = Source.Single(1).WireTap(_ => throw error).RunWith(Sink.Ignore<int>(), Materializer); | ||
Invoking(() => future.Wait()).Should().NotThrow(); | ||
return Task.CompletedTask; | ||
}, Materializer); | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete commented code