vendredi 8 mai 2015

How to set compiler symbols in unit test, or how to detect running unit test?

I want to run some tests on SomeProject, so I have a unit test project. But the classes I'm trying to run tests on have some logging capabilities built in, and I'd like to just disable those when unit testing.

If I set something like UNITTEST compiler symbol on the test project, that symbol doesn't carry over into the other project. So [Conditional] and #if UNITTEST don't work.

How can I make some classes aware that they're running as part of a unit test, in order to skip unnecessary stuff - specifically unnecessary logging?

Aucun commentaire:

Enregistrer un commentaire