コード例 #1
0
        public IEnumerator StopAllCoroutines_Successfully()
        {
            const int testValue1    = 5;
            const int testValue2    = 10;
            const int testValue3    = 20;
            int       testCompleted = 0;

            IAsyncCoroutine asyncCoroutine = _coroutineService.StartAsyncCoroutine(TestCoroutine(testValue1));

            asyncCoroutine.OnComplete(() => testCompleted = testValue2);
            _coroutineService.StartCoroutine(TestCoroutine(testValue3));

            _coroutineService.StopAllCoroutines();

            Assert.False(asyncCoroutine.IsCompleted);
            Assert.AreNotEqual(testValue1, _testValue);
            Assert.AreNotEqual(testValue2, testCompleted);
            Assert.AreNotEqual(testValue3, _testValue);

            yield return(new WaitForSeconds(0.1f));

            Assert.False(asyncCoroutine.IsCompleted);
            Assert.AreNotEqual(testValue1, _testValue);
            Assert.AreNotEqual(testValue2, testCompleted);
            Assert.AreNotEqual(testValue3, _testValue);
        }