Unit testing multi-threaded, asynchronous code and/or events

I’ve been writing some unit tests recently that test some multi-threaded functionality.

Typically this involves hooking up some event handlers then waiting for some asynchronous code to fire the event before proceeding with the unit test and assertions.

The ManualResetEvent class (MSDN) seems a good choice for this, and this post has a small example of using it . . . → Read More: Unit testing multi-threaded, asynchronous code and/or events