public void CoroutineRunner_BeforePumpAdvances_NoFrameIsExecuted() { var pump = new TestPump(); int i = 0; var runner = new CoroutineRunner(TestRoutine(), pump); Assert.That(i, Is.EqualTo(0)); IEnumerator TestRoutine() { i = 1; yield return(null); } }
public void PumpMustHandlleExceptionsInCoroutine() { using (var pump = new TestPump()) { var runner = new CoroutineRunner(Routine(), pump); // frame 1 Assert.DoesNotThrow(() => pump.Advance()); // frame 2 Assert.Throws <NotImplementedException>(() => pump.Advance()); } IEnumerator Routine() { yield return(null); throw new NotImplementedException("Second frame"); } }