public void ExceptionsFromTasks()
{
StartPoint<int> start = StandardTasks.GetRangeEnumerator(1, 10);
int i = 0;
EndPoint<int> end = new EndPoint<int>(
(int input) =>
{
i++;
throw new InvalidTimeZoneException();
}
);
end.Retries = 3;
Flow f = Flow.FromAsciiArt("b<--a", start, end);
f.Start();
try
{
f.RunToCompletion();
Assert.Fail("RunToCompletion should throw any stopping exceptions from tasks");
}
catch (InvalidTimeZoneException)
{ }
Console.WriteLine("Exceptions thown : {0}", i);
Console.WriteLine("Status of flow after error: \n{0}", f.GetStateSnapshot());
Assert.AreEqual(RunStatus.Error, end.Status);
Assert.AreEqual(0, end.ItemsProcessed);
}