c# - spawning threads in a unit test -


there lot of information on how unit test threaded code not on spawning threads inside unit test method test synchronization mechanisms.

[testmethod] public void testdiscountthreading() {   thread[] threads = new thread[50];   (int = 0; < threads.length; i++) {     threads[i] = new thread(pricethread);     threads[i].start();   }    (int = 0; < threads.length; i++)     threads[i].join(); } 

i want stresstest if synchronization in code inside pricethread implemented correctly every single time method runs error "the agent process stopped while test running". possible spawn threads inside unit tests or can wrong here?

im using visual studio 2010 shipped unit testing framework

this not full answer, recommend have @ vs 2010 test runner error "the agent process stopped while test running." ideas.

do know in code exception thrown?

edit answer:

this result when thread other main thread throws unhandled exception. case here, ie no issues loops or threads themselves.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -