public void GroupBy_must_abort_onError_from_upstream_when_substreams_are_running()
{
this.AssertAllStagesStopped(() =>
{
var publisherProbe = TestPublisher.CreateManualProbe<int>(this);
var publisher =
Source.FromPublisher(publisherProbe)
.GroupBy(2, x => x % 2)
.Lift(x => x % 2)
.RunWith(Sink.AsPublisher<Tuple<int, Source<int, NotUsed>>>(false), Materializer);
var subscriber = TestSubscriber.CreateManualProbe<Tuple<int, Source<int, NotUsed>>>(this);
publisher.Subscribe(subscriber);
var upstreamSubscription = publisherProbe.ExpectSubscription();
var downstreamSubscription = subscriber.ExpectSubscription();
downstreamSubscription.Request(100);
upstreamSubscription.SendNext(1);
var substream = subscriber.ExpectNext().Item2;
var substreamPuppet = new StreamPuppet(substream.RunWith(Sink.AsPublisher<int>(false), Materializer), this);
substreamPuppet.Request(1);
substreamPuppet.ExpectNext(1);
var ex = new TestException("test");
upstreamSubscription.SendError(ex);
substreamPuppet.ExpectError(ex);
subscriber.ExpectError().Should().Be(ex);
}, Materializer);
}