Currently I’m doing Unit testing of some project and all is fine except for the places where developers used something like this:
#if USING_EMULATOR
{ do nothing }
#else
{ do a lot of things }
#endif
or
#if USING_EMULATOR
return;
#endif
{ do a lot of things }
Where the code under USING_EMULATOR was done for debug purposes I think. Also sometimes #if DEBUG appears. How can I check the actual piece of code if now the one for the debugging purposes only is trying to execute?
#undef USING_EMULATOR doesn’t help. I don’t understand very clearly preprocessor constants and in C# they are even can’t be set only defined/undefined so maybe I just do smth wrong?
Remove
USING_EMULATORfrom the conditional compilation symbols in your project Build settings.You can also create different build configurations, with different set of conditional compilation symbols. E.g. Debug config defines DEBUG, while Release doesn’t. This also means that if you want to execute actual code, you should run Release build, not Debug build.