public void UnzipWith_must_work_with_up_to_6_outputs()
{
// the jvm version uses 20 outputs but we have only 7 so changed this spec a little bit
this.AssertAllStagesStopped(() =>
{
var probe0 = TestSubscriber.CreateManualProbe<int>(this);
var probe1 = TestSubscriber.CreateManualProbe<string>(this);
var probe2 = TestSubscriber.CreateManualProbe<int>(this);
var probe3 = TestSubscriber.CreateManualProbe<string>(this);
var probe4 = TestSubscriber.CreateManualProbe<int>(this);
var probe5 = TestSubscriber.CreateManualProbe<string>(this);
RunnableGraph.FromGraph(GraphDsl.Create(b =>
{
// odd input ports will be Int, even input ports will be String
var unzip =
b.Add(
new UnzipWith<List<int>, int, string, int, string, int, string>(
ints =>
Tuple.Create(ints[0], ints[0].ToString(), ints[1], ints[1].ToString(), ints[2],
ints[2].ToString())));
var source = Source.Single(Enumerable.Range(1,3).ToList());
b.From(source).To(unzip.In);
b.From(unzip.Out0).To(Sink.FromSubscriber(probe0));
b.From(unzip.Out1).To(Sink.FromSubscriber(probe1));
b.From(unzip.Out2).To(Sink.FromSubscriber(probe2));
b.From(unzip.Out3).To(Sink.FromSubscriber(probe3));
b.From(unzip.Out4).To(Sink.FromSubscriber(probe4));
b.From(unzip.Out5).To(Sink.FromSubscriber(probe5));
return ClosedShape.Instance;
})).Run(Materializer);
probe0.ExpectSubscription().Request(1);
probe1.ExpectSubscription().Request(1);
probe2.ExpectSubscription().Request(1);
probe3.ExpectSubscription().Request(1);
probe4.ExpectSubscription().Request(1);
probe5.ExpectSubscription().Request(1);
probe0.ExpectNext(1);
probe1.ExpectNext("1");
probe2.ExpectNext(2);
probe3.ExpectNext("2");
probe4.ExpectNext(3);
probe5.ExpectNext("3");
probe0.ExpectComplete();
probe1.ExpectComplete();
probe2.ExpectComplete();
probe3.ExpectComplete();
probe4.ExpectComplete();
probe5.ExpectComplete();
}, Materializer);
}