Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have multiple props like this:

C#
public static bool ForwardMessagesToEmail
{
    get
    {
        string forwardToEmail =
            WebConfigurationManager.AppSettings["ForwardToEmail"];
        return String.IsNullOrEmpty(forwardToEmail) ?
            false :
            forwardToEmail.ToLower() == Boolean.TrueString.ToLower();
    }
}


which I want to Unit-Test using predefined combinations of AppSettings

My problem is:
1. Is it possible without Dependency Injection (of WebConfigurationManager) ?
1.1 If so, how I can achieve this?
2. How can I populate WebConfigurationManager.AppSettings with some values and is this possible without having some extra web.config ?

Thanks a lot!
Posted
Updated 13-May-15 3:39am
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900