Exemplo n.º 1
0
        public void CoroutineCancelTest_OtherThread()
        {
            var scheduler = new InterleavedCoroutineScheduler();
            var coroutine = new CancelCoroutine();

            scheduler.Execute(coroutine);

            Task.Run(async() =>
            {
                await Task.Delay(100);
                coroutine.Cancel();
            });

            while (coroutine.Status == CoroutineStatus.Running)
            {
                scheduler.Update(0);
            }

            Assert.Equal(CoroutineStatus.Cancelled, coroutine.Status);
        }