mirror of
https://github.com/Ellpeck/Coroutine.git
synced 2024-11-21 21:33:29 +01:00
Added a unit test to expose an exception (#14)
* added a unit test to expose the bug. * made unit test simple. * adding extra lines.
This commit is contained in:
parent
5dc11e0d26
commit
0d51954b63
1 changed files with 37 additions and 0 deletions
|
@ -301,5 +301,42 @@ namespace Tests {
|
|||
Assert.AreEqual(cr.Name, "Bird", "Incorrect name of the coroutine.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MovingCoroutineTest()
|
||||
{
|
||||
var evt = new Event();
|
||||
IEnumerator<Wait> MovingCoroutine() {
|
||||
while (true) {
|
||||
yield return new Wait(evt);
|
||||
yield return new Wait(0d);
|
||||
}
|
||||
}
|
||||
|
||||
CoroutineHandler.Start(MovingCoroutine(), "MovingCoroutine");
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.Tick(1d);
|
||||
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.Tick(1d);
|
||||
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
CoroutineHandler.Tick(1d);
|
||||
CoroutineHandler.RaiseEvent(evt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue