public void TestCompositeTaskRunner()
{
int attempts = 0;
CompositeTaskRunner runner = new CompositeTaskRunner();
CountingTask task1 = new CountingTask("task1", 100);
CountingTask task2 = new CountingTask("task2", 200);
runner.AddTask( task1 );
runner.AddTask( task2 );
runner.Wakeup();
while( attempts++ != 10 )
{
Thread.Sleep( 1000 );
if(task1.Count == 100 && task2.Count == 200)
{
break;
}
}
Assert.IsTrue(task1.Count == 100);
Assert.IsTrue(task2.Count == 200);
runner.RemoveTask(task1);
runner.RemoveTask(task2);
}