public void continuation_action_is_invoked_when_tasks_faults()
{
using(var task = new Task(ThrowException))
{
int invocationCount = 0;
var continuationTask = TaskExtensions.ContinueFaultWith(task, _ => ++invocationCount);
Assert.NotNull(continuationTask);
task.Start();
continuationTask.Wait(1000);
Assert.Equal(1, invocationCount);
// To prevent the exception from being thrown on the finalizer you must wait on the
// faulted task or access the Exception property.
Assert.Throws<AggregateException>(() => task.Wait());
}
}