Ejemplo n.º 1
0
        public void StreamLayout_should_not_fail_fusing_and_materialization_when_building_a_large_graph_with_simple_computation_when_using_Via()
        {
            var g = Source.FromGraph(Fuse.Aggressive(Enumerable.Range(1, TooDeepForStack)
                                                     .Aggregate(Source.Single(42).MapMaterializedValue(_ => 1), (source, i) => source.Select(x => x))));

            var t            = g.ToMaterialized(Sink.Seq <int>(), Keep.Both).Run(_materializer);
            var materialized = t.Item1;
            var result       = t.Item2.AwaitResult(VeryPatient);

            materialized.Should().Be(1);
            result.Count.Should().Be(1);
            result.Should().Contain(42);
        }
Ejemplo n.º 2
0
        public void StreamLayout_should_not_fail_fusing_and_materialization_when_building_a_large_graph_with_simple_computation_when_starting_from_a_Flow()
        {
            var g = Flow.FromGraph(Fuse.Aggressive(Enumerable.Range(1, TooDeepForStack)
                                                   .Aggregate(Flow.Create <int>().MapMaterializedValue(_ => 1), (source, i) => source.Select(x => x))));

            var t            = g.RunWith(Source.Single(42).MapMaterializedValue(_ => 1), Sink.Seq <int>(), _materializer);
            var materialized = t.Item1;
            var result       = t.Item2.Result;

            materialized.Should().Be(1);
            result.Count.Should().Be(1);
            result.Should().Contain(42);
        }