Without actually running the real code in the three examples, I don't know that I can give an authoritative answer, but my advice would be to use # 2, and well avoid # 1 and # 3.
I shot through the source for the Silverlight Unit Test for Jeff Wilcox, and as far as I remember, it uses a smart, but really terrible hack for EnqueueConditional, i.e. it repeatedly calls the predicate passed to EnqueueConditional () on the timer / background thread, each time checking to see if it returns true. (This is not what you want in the production code, but it is good enough for the test structure, it is logic, I suppose.)
So, if your test takes a couple of seconds, I expect your waitHandler.WaitOne () to either (a) be called many times, blocking each thread as it arrives; or (b) block the flow that other things are supposed to do. I believe a (c) is also possible, i.e. You may be lucky WaitOne () will not block anything important and will be called only once. But, of course, No. 2 is the "standard" way to use this test environment, and if you had no specific reason to introduce more complex WaitHandle logic, I would not try to push the test structure in this direction.
However, if someone wants to poke and give a more authoritative answer, Iām all ears :-).
source share