Test to identify your development environment?

Posted by lance on Stack Overflow See other posts from Stack Overflow or by lance
Published on 2010-03-12T14:47:18Z Indexed on 2010/03/12 19:17 UTC
Read the original article Hit count: 575

The code has a runtime dependency which is not available in our development environment (and is available in test and prod). It's expensive to actually test for the dependency, and I want to test for the environment instead.

if (isDevEnvironment) {
    // fake it
}
else {
    // actually do it
}

Without using appSettings, what code/technique/test would you use to set isDevEnvironment?

Example answers:

  • check machine name (partial or full)
  • check for running instance of Visual Studio
  • check for environment variable

I'm hoping for a test I hadn't considered.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about development-environment