I need to test my vigorously tested code works when called by many threads
So I am calling the code in a loop in a TestMethod using TreadPool.QueueUserWorkItem
however there does not seem to be anyway of holding the current thread while all the threads kicked off are still running.
i.e. pretend code....
using Microsoft.VisualStudio.TestTools.UnitTesting
10 create a server
20 for( a number of iterations ) start a thread running a function
30 while all the threads are still doing stuff hang on to the server
40 now dispose of the server
Without the wait my unit test is disposing of the server before the job is done.
Any insights gratefully received...?