public void ErrorHandlingTest() { var errorActor = new ErrorExampleActor(); var task = errorActor.ThrowAnError(); AssertException(typeof(AggregateException), typeof(InvalidProgramException), () => task.Wait(5000)); }
public void ErrorHandlingTestReturnValueMethod() { var errorActor = new ErrorExampleActor(); var task = errorActor.MethodWithReturnThrowsAnError(); AggregateException ex = null; try { task.Wait(5000); } catch (AggregateException aggEx) { ex = aggEx; } Assert.IsNotNull(ex); Assert.IsInstanceOfType(ex.InnerExceptions[0], typeof(InvalidProgramException)); Assert.AreEqual(TaskStatus.Faulted, task.Status); }