public void TestResult2() { Coroutine routine = new Coroutine(ResultTest2); routine.Resume(); CoroutineUnhandledException ex = Assert.Throws <CoroutineUnhandledException>(() => routine.Resume()); Assert.Same(ex, routine.FaultingException); AssertCoroutineFinished(routine, CoroutineStatus.Faulted); Assert.Null(routine.Result); }
public void TestException() { Coroutine routine = new Coroutine(() => ThrowsException()); routine.Resume(); CoroutineUnhandledException ex = Assert.Throws <CoroutineUnhandledException>(() => routine.Resume()); Assert.Same(ex, routine.FaultingException); Assert.Same(_thrownException, ex.InnerException); AssertCoroutineFinished(routine, CoroutineStatus.Faulted); }
public void TestFinally() { Coroutine routine = new Coroutine(() => FinallyTest()); CoroutineUnhandledException ex = Assert.Throws <CoroutineUnhandledException>( () => { do { routine.Resume(); } while (!routine.IsFinished); }); Assert.Same(ex, routine.FaultingException); Assert.Same(_thrownException, ex.InnerException); AssertCoroutineFinished(routine, CoroutineStatus.Faulted); Assert.True(_executedFinally); }