public void GraphDSLs_must_be_possible_to_use_as_lego_bricks() { Func <int, Source <int, (NotUsed, NotUsed, NotUsed, Task <IEnumerable <int> >)> > source = i => Source.From(Enumerable.Range(i, 3)) .MapMaterializedValue(_ => default((NotUsed, NotUsed, NotUsed, Task <IEnumerable <int> >))); var shuffler = Shuffle.Create(Flow.Create <int>().Select(x => x + 1)); var task = RunnableGraph.FromGraph(GraphDsl.Create(shuffler, shuffler, shuffler, Sink.First <IEnumerable <int> >(), ValueTuple.Create, (b, s1, s2, s3, sink) => { var merge = b.Add(new Merge <int>(2)); b.From(source(1)).To(s1.In1); b.From(source(10)).To(s1.In2); b.From(s1.Out1).To(s2.In1); b.From(s1.Out2).To(s2.In2); b.From(s2.Out1).To(s3.In1); b.From(s2.Out2).To(s3.In2); b.From(s3.Out1).To(merge.In(0)); b.From(s3.Out2).To(merge.In(1)); b.From(merge.Out).Via(Flow.Create <int>().Grouped(1000)).To(sink); return(ClosedShape.Instance); })).Run(Materializer).Item4; task.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); task.Result.ShouldAllBeEquivalentTo(new[] { 4, 5, 6, 13, 14, 15 }); }