public void SplitWhen_must_fail_substream_if_materialized_twice()
{
this.AssertAllStagesStopped(() =>
{
var task = Source.Single(1).SplitWhen(_ => true).Lift()
.SelectAsync(1, source =>
{
source.RunWith(Sink.Ignore<int>(), Materializer);
// Sink.ignore+mapAsync pipes error back
return Task.Run(() =>
{
source.RunWith(Sink.Ignore<int>(), Materializer).Wait(TimeSpan.FromSeconds(3));
return 1;
});
})
.RunWith(Sink.Ignore<int>(), Materializer);
task.Invoking(t => t.Wait(TimeSpan.FromSeconds(3)))
.ShouldThrow<IllegalStateException>();
}, Materializer);
}