What is the best way to test production only config files before they are deployed to produciton?
The config files for non production environment could get easily tested in their respective environments. But how can be production environment tested before production deployment happens?
For example, the DB name in STAGE is different than the DB name in prod.
What if STAGE config file has correct DB name and is tested okay. Now, the prod config file has "typo" in the config file. This typo will not be discovered until its deployed in production.
Is there a way to test this config file with typo error before it goes to production?
thanks
Under appSettings
in the web.config file, I use this key:
<add key="CurrentEnvironment" value="0"/>
<!--
Public Enum Environments
Development = 0
Alpha = 1
ReleaseCandidate = 2
Production = 3
End Enum
-->
And as you can see in my comments, this corresponds to an Enum in my Helpers.vb class that is used like so:
Public Shared CurrentEnvironment As Environments = DirectCast(WebConfigurationManager.AppSettings("CurrentEnvironment"), Environments)
This allows you to write Environment specific code such as URLs, Database Connections, etc.
I've found it super helpful.
-- sorry for the VB.NET code, but I'm sure you can covert easily --
EDIT based on the OP edit:
Why don't you create a Unit Test project?