Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }