Exemplo n.º 1
0
        public void CoroutineService_WaitWhile_CompletesCoroutineAfterPredicateReturnsTrue()
        {
            bool condition = false;

            bool didComplete = false;

            var coroutineService = new CoroutineService();

            IEnumerator RunCoroutine()
            {
                yield return(coroutineService.WaitWhile(() => condition));

                didComplete = true;
            };

            coroutineService.StartCoroutine(RunCoroutine());

            Assert.IsFalse(didComplete, "Completed too early");

            condition = true;

            coroutineService.TickCoroutines();

            Assert.IsTrue(didComplete, "Did not complete");
        }