whats a good way to test the settings (especially keys) in web.config? I think its not really testable with NUnit, or is it?
Example: <add key="SomeKey" value="SomeValue" />
Thanks for ideas 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How do you mean “test”? There’s no real value, that I can see at least, in running tests against a .config file, given that there’s no code of yours actually executing, unless you’ve written a custom ConfigSectionHandler?
If you have a defined set of keys that your application requires, you might consider it worthwhile to wrap calls to
System.Configuration.ConfigurationManagerin a configuration helper class that exposes your application specific configuration, parses values into their appropriate datatypes and so on. That would be something that would be worth testing, but not the web.config file itself. For example: