Let me show you my favorite unit test principles:
A test is not a unit test if:
- It talks to the database 0. It communicates across the network 0. It touches the file system 0. It can't run at the same time as any of your other unit tests 0. You have to do special things to your environment (such as editing config files) to run it.
If your unit test insists that it be the "main thread" it's hard not to run afoul of number 4.
This may seem harsh but remember that a unit test is just one of many different kinds of tests.
You're free to violate these principles. But when you do, don't call your test a unit test. Don't put it with the real unit tests and slow them down.
