示例#1
0
        public void SMKEE()
        {
            // Arrange
            int  value = 0;
            bool pass  = false;

            IEnumerator <ICoData> TestMethod()
            {
                value = 1;
                // ReSharper disable once AccessToModifiedClosure
                yield return(CoRoCtrl.WaitUntilTrue(() => pass));

                value = 2;
            }

            // Act & Assert
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            Assert.AreEqual(0, value);
            CoRoCtrl.RunCoRoutine(TestMethod());
            Assert.AreEqual(1, value);
            CoRoCtrl.Update();
            Assert.AreEqual(1, value);
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(1, value);
            pass = true;
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(2, value);
        }
示例#2
0
        public void GWTZL()
        {
            // Arrange
            int value = 0;

            IEnumerator <ICoData> TestMethod()
            {
                value = 1;
                yield return(CoRoCtrl.WaitUntilDone(CoRoCtrl.RunCoRoutine(TestMethodTwo())));

                value = 4;
            }

            IEnumerator <ICoData> TestMethodTwo()
            {
                value = 2;
                yield return(CoRoCtrl.WaitForOneTick());

                value = 3;
            }

            // Act & Assert
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            Assert.AreEqual(0, value);
            CoRoCtrl.RunCoRoutine(TestMethod());
            Assert.AreEqual(2, value);
            CoRoCtrl.Update();
            Assert.AreEqual(2, value);
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(3, value);
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(4, value);
        }
示例#3
0
        public void BELZH()
        {
            // Arrange
            int value = 0;

            IEnumerator <ICoData> TestMethod()
            {
                value = 1;
                yield return(CoRoCtrl.WaitForSeconds(0.5f));

                value = 2;
            }

            // Act & Assert
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            Assert.AreEqual(0, value);
            CoRoCtrl.RunCoRoutine(TestMethod());
            Assert.AreEqual(1, value);
            CoRoCtrl.Update();
            Assert.AreEqual(1, value);
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(1, value);
            CoRoCtrl.SetNextCoState(CoSegment.Normal, 0.33f);
            CoRoCtrl.Update();
            Assert.AreEqual(2, value);
        }