public void SetUp() { CoroutineRunner cr = new CoroutineRunner(); runnerUnderTest = cr; moveNextCallCount = 0; mockTickGroup = ETickGroup.Update; mockCoroutine = new MockCoroutine(this); }
public IEnumerator MoveNext_is_called_for_FixedUpdate() { mockTickGroup = ETickGroup.FixedUpdate; runnerUnderTest.Start(mockCoroutine); yield return(null); yield return(null); Assert.AreEqual(2, moveNextCallCount); }
public void SetUp() { expectedCallCount = 10; runnerUnderTest = new CoroutineRunner(); moveNextCallCount = 0; mockTickGroup = ETickGroup.Update; mockCoroutine = Substitute.For <ICFunc>(); mockCoroutine.MoveNext().Returns(ci => ++ moveNextCallCount < expectedCallCount); mockCoroutine.TickGroup.Returns(ci => mockTickGroup); }
void StepRoutines(ETickGroup tickGroup) { _removedDuringStepCount = 0; for (int i = _routines.Count - 1; i >= _removedDuringStepCount; i--) { ICFunc cw = _routines[i - _removedDuringStepCount]; if (cw.TickGroup == tickGroup) { if (MoveNextWithTryCatch(cw) == false) { RemoveFunction(cw); } } } }
public IEnumerator MoveNextIsCalledAsExpected( [Values] ETickGroup tickGroup, [Range(1, 10)] int callCount ) { expectedCallCount = callCount; mockTickGroup = tickGroup; runnerUnderTest.Start(mockCoroutine); int i = 15; // more than enough to complete the coroutine while (i-- > 0) { yield return(null); } mockCoroutine.Received(expectedCallCount).MoveNext(); }