public IEnumerator CoroutineService_WaitForLateTick_WaitsForLateUpdate_WithServiceRunner()
        {
            bool didComplete = false;

            using (CoroutineServiceRunner serviceRunner = new GameObject()
                                                          .AddComponent <CoroutineServiceRunner>())
            {
                var coroutineService = new CoroutineService();
                serviceRunner.SetCoroutineService(coroutineService);

                IEnumerator RunCoroutine()
                {
                    yield return(coroutineService.WaitForLateTick());

                    didComplete = true;
                }

                coroutineService.StartCoroutine(RunCoroutine());

                // This test may complete before ServiceRunner receives it's first update, depending on order of execution
                yield return(null);

                yield return(null);

                Assert.IsTrue(didComplete, "Coroutine did not complete");
            }
        }
Пример #2
0
        public void CoroutineService_TickLateCoroutines_TicksLateScheduledCoroutine()
        {
            bool isCompleted = false;

            var coroutineService = new CoroutineService();

            IEnumerator RunCoroutine()
            {
                yield return(coroutineService.WaitForLateTick());

                isCompleted = true;
            }

            coroutineService.StartCoroutine(RunCoroutine());

            coroutineService.TickLateCoroutines();

            Assert.IsTrue(isCompleted, "Coroutine did not complete");
        }