public void Unfold_Source_must_terminate_with_a_failure_if_there_is_an_exception_thrown()
{
EventFilter.Exception<SystemException>(message: "expected").ExpectOne(() =>
{
var task = Source.Unfold(Tuple.Create(0, 1), tuple =>
{
var a = tuple.Item1;
var b = tuple.Item2;
if (a > 10000000)
throw new SystemException("expected");
return Tuple.Create(Tuple.Create(b, a + b), a);
}).RunAggregate(new LinkedList<int>(), (ints, i) =>
{
ints.AddFirst(i);
return ints;
}, Materializer);
task.Invoking(t => t.Wait(TimeSpan.FromSeconds(3)))
.ShouldThrow<SystemException>()
.WithMessage("expected");
});
}