As already mentioned, you can use unit test multi-threaded components, but are not as clean as regular unit tests. I mostly met him in Acceptance Tests and had great success with .net 4 Task and Parallel . However, in this case, a simple dream may make you, but if you start to do many of these tests, you may need a more efficient way to do this.
[Test] public void Test1() { bool wasCalled = false; SomeClass someObject = new SomeClass(); someObject.Finishing += new SomeClass.FinishingEventHandler((sender, a) => { wasCalled = true; }); someObject.Start();
Whatever you do, you need some time to make the test finish, and not hang forever, this can be done in the test itself or in some test libraries there is a Timeout you can decorate the test.
source share