Detect if Visual Studio Test is running
Posted
by RTigger
on Stack Overflow
See other posts from Stack Overflow
or by RTigger
Published on 2010-04-06T17:23:52Z
Indexed on
2010/04/06
17:33 UTC
Read the original article
Hit count: 206
Is there an easy way to detect if you're running in the context of a Visual Studio Test as opposed to debug or release?
Here's the scenario - we have a factory class that we use heavily throughout our existing codebase, and I figured instead of refactoring it out in each class so we can substitute the default factory with one that would return mock/fake objects, I could add something in the factory class itself to return those mock objects if it detects it's running in "test" mode.
© Stack Overflow or respective owner