상속: MonoBehaviour
        public IEnumerator Start()
        {
            var executer  = new CoroutineExecuterGameObject();
            var coroutine = new TestCoroutine();

            executer.Initialize();

            Assert.False(coroutine.IsCompleted);
            Assert.False(coroutine.IsStarted);
            Assert.False(coroutine.IsEnded);

            executer.Start(coroutine);

            Assert.False(coroutine.IsCompleted);
            Assert.True(coroutine.IsStarted);
            Assert.False(coroutine.IsEnded);

            yield return(coroutine);

            Assert.True(coroutine.IsCompleted);
            Assert.True(coroutine.IsStarted);
            Assert.True(coroutine.IsEnded);

            executer.Uninitialize();
        }
예제 #2
0
        public IEnumerator IsCompleted()
        {
            var coroutine = new TestCoroutine();

            Assert.False(coroutine.IsCompleted);

            yield return(coroutine);

            Assert.True(coroutine.IsCompleted);
        }
예제 #3
0
        public IEnumerator HasResult()
        {
            var coroutine = new TestCoroutine();

            Assert.False(coroutine.HasResult);

            yield return(coroutine);

            Assert.True(coroutine.HasResult);
        }
예제 #4
0
        public IEnumerator Routine()
        {
            var coroutine = new TestCoroutine();

            Assert.False(coroutine.IsStarted);
            Assert.False(coroutine.IsEnded);

            yield return(coroutine);

            Assert.True(coroutine.IsStarted);
            Assert.True(coroutine.IsEnded);
        }
예제 #5
0
        public IEnumerator CompletedWithResult()
        {
            bool completed = false;
            var  coroutine = new TestCoroutine();

            coroutine.Completed += coroutine1 => completed = true;

            Assert.False(completed);

            yield return(coroutine);

            Assert.True(completed);
        }
예제 #6
0
        public IEnumerator Result()
        {
            var coroutine = new TestCoroutine();

            Assert.Throws <InvalidOperationException>(() =>
            {
                // ReSharper disable once UnusedVariable
                Target result = coroutine.Result;
            });

            yield return(coroutine);

            Assert.DoesNotThrow(() =>
            {
                // ReSharper disable once UnusedVariable
                Target result = coroutine.Result;
            });
        }
        public IEnumerator Started()
        {
            var executer  = new GameObject().AddComponent <CoroutineExecuter>();
            var coroutine = new TestCoroutine();

            Assert.False(coroutine.IsCompleted);
            Assert.False(coroutine.IsStarted);
            Assert.False(coroutine.IsEnded);

            executer.StartCoroutine(coroutine);

            Assert.False(coroutine.IsCompleted);
            Assert.True(coroutine.IsStarted);
            Assert.False(coroutine.IsEnded);

            yield return(coroutine);

            Assert.True(coroutine.IsCompleted);
            Assert.True(coroutine.IsStarted);
            Assert.True(coroutine.IsEnded);
        }