There are times when we need to test our code in concurrent manner where there are some numbers of instances running simultaneously.
This is different with the invocation such as below code where the method will be executed in sequential manner, this kind of test may be useful to test how long it may take to execute the method.
for (int iTest = 0; iTest < 100; iTest++)
Code below in plain English : Submit 5 invocations of TestingMethodA with 10 maximum concurrent threads.
MultiThreadRunner runner = new MultiThreadRunner();
The MultiThreadRunner class :
// Adjust the min threads
for (int i = 1; i <= iRow; i++)
ThreadPool.GetAvailableThreads(out iEndWorker, out iCompletion);
ThreadPool.GetMaxThreads(out iMaxWorker, out iCompletion);
if (concurrentNoOfInstances != 0)
or get the complete project from here :
Hope this helps with your test as well :D