updated unit test to be more complex.

This commit is contained in:
Zaafar 2021-03-19 16:44:24 -04:00
parent 355c3a4f8c
commit 7bff370663

View file

@ -88,6 +88,8 @@ namespace Tests {
[Test] [Test]
public void TestNestedCoroutine() { public void TestNestedCoroutine() {
var onChildCreated = new Event();
var onParentCreated = new Event();
var myEvent = new Event(); var myEvent = new Event();
var counterAlwaysRunning = 0; var counterAlwaysRunning = 0;
@ -120,8 +122,12 @@ namespace Tests {
counterGrandParent++; counterGrandParent++;
// Nested corotuine starting. // Nested corotuine starting.
var p = CoroutineHandler.Start(Parent()); var p = CoroutineHandler.Start(Parent());
CoroutineHandler.RaiseEvent(onParentCreated);
// Nested corotuine starting in OnFinished. // Nested corotuine starting in OnFinished.
p.OnFinished += ac => CoroutineHandler.Start(Child()); p.OnFinished += ac => {
CoroutineHandler.Start(Child());
CoroutineHandler.RaiseEvent(onChildCreated);
};
} }
CoroutineHandler.Start(AlwaysRunning()); CoroutineHandler.Start(AlwaysRunning());