private bool DoCallTest(bool testErrors)
{
// follow tree from each starting node.
bool success = true;
// collection writeable variables that don't change during the test.
List<TestMethod> methods = new List<TestMethod>();
foreach (Node node in AvailableNodes.Values)
{
if (!CollectMethods(node, testErrors, methods))
{
return false;
}
}
Log("Starting CallTest for {0} Methods", methods.Count);
double increment = MaxProgress/(10*methods.Count);
double position = 0;
CallMethodRequestCollection methodsToCall = new CallMethodRequestCollection();
for (int ii = 0; success && ii < 10; ii++)
{
int nodes = 0;
int operations = 0;
foreach (TestMethod method in methods)
{
nodes++;
AddMethodCall(method, methodsToCall, testErrors);
// process batch.
if (methodsToCall.Count > 100)
{
operations += methodsToCall.Count;
if (!Call(methodsToCall))
{
success = false;
break;
}
if (nodes > (10*methods.Count)/5)
{
Log("Called {1} methods {0} times.", operations, nodes);
nodes = 0;
operations = 0;
}
methodsToCall.Clear();
}
position += increment;
ReportProgress(position);
}
// process final batch.
if (success)
{
if (methodsToCall.Count > 0)
{
operations += methodsToCall.Count;
if (!Call(methodsToCall))
{
success = false;
}
else
{
Log("Called {1} methods {0} times.", operations, nodes);
}
methodsToCall.Clear();
}
}
if (testErrors)
{
break;
}
}
return success;
}
#endregion