Click here to Skip to main content
15,867,986 members
Articles / Programming Languages / C#

Changing App.Config on the fly for unit testing

Rate me:
Please Sign up or sign in to vote.
4.33/5 (4 votes)
10 Jun 2011CPOL1 min read 33.2K   5  
Changing App.Config on the fly for unit testing

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
14 Jun 2011EbenRoux
An alternative is to abstract the settings that you intend to use.So instead of changing your app.config on the fly, simply change a mock or the instance values of the configuration object.For example:public interface IApplicationConfiguration{ string MaybeAFolderINeed { get; } ...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions