Ejemplo n.º 1
0
        public void HandledExceptionsAreNotSentToUnity( )
        {
            bool       exception_thrown = false;
            ActionTask task             = Hikari.Schedule((_) =>
            {
                throw new ExpectedException();
            });

            task.AddErrorHandler((_) => exception_thrown = true);

            Hikari.Instance.Update();

            for (int ms = 0; ms < 10000; ms += 1)
            {
                System.Threading.Thread.Sleep(1);
                if (task.Failed)
                {
                    break;
                }
            }

            Assert.IsFalse(task.IsCompleted, "Task thinks it completed.");
            Assert.IsTrue(task.Failed, "Task doesn't think it failed.");

            Hikari.Instance.Update();

            Assert.IsTrue(exception_thrown, "Exception not thrown on Unity's thread.");
        }