I have this specific call in my code and I found the config needs to be different when running the full app as to when I'm testing using an integration unit test.
Is there a way to check for a call from a unit test using the #if
directive?
#if TestMethod
...do this config
#else
...do this config
#endif
Maybe someway to detect an attribute on the unit test function?
No, because either the code exists in the built binary or it doesn't. The decision is made entirely at compile-time, so there's nothing you can do at execution time to reintroduce the "missing" code. You'd have to dynamically load one of two different binaries, and run the tests that way.
Do you have to use conditional compilation, instead of deciding which route to take at execution time?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With