I am writing Silverlight tests that rely on data loaded at the start of the test, something like this:
string[] testVectors = new string[20];
EnqueueCallback( Load some data );
EnqueueConditional( Wait for loading of data to finish );
EnqueueCallback( Populate testVectors using the loaded data );
Next I want to enqueue more callbacks and conditions using the test vectors. But how do I loop?????
I can’t do this:
for(int iTest=0; iTest<20; iTest++ )
{
EnqueueConditional( Run test for testVector[iTest] );
EnqueueConditional( Wait for test to finish );
}
…because the test vector strings do not exists when the for loop runs.
Any ideas?
Thanks for reading!
All you want to do is queue another action to execute later, it just happens that this action includes queueing some more dependent actions.
What you can do is enqueue a callback which nests the remainder of your test, either directly or by chaining to another method.
Just probably don’t want to then put anything un-nested below the nested callback – it can be executed/queued before the nested things.