M
mrshrinkray
Hi all,
I'm trying to write tests for a custom section of a .config file. I
need to tell the ConfigurationManager to use the invalid app.config
file, in order to make sure my validation of config file is working.
This is what I've got, but I can't get the ConfigurationManager to use
my IConfigurationSectionHandler class.
ExeConfigurationFileMap exeConfig = new ExeConfigurationFileMap();
exeConfig.ExeConfigFilename = @"c:\path\InvalidApp.config";
Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(exeConfig,
ConfigurationUserLevel.None);
ConfigurationSection section = config.GetSection("mysection");
I need the equivalent of ConfigurationManager.GetSection("mysection");
I also get the problem that the test refuses to copy my
InvalidApp.config to its "Out" directory when it runs, so I'm hard
coding it for now.
I'm trying to write tests for a custom section of a .config file. I
need to tell the ConfigurationManager to use the invalid app.config
file, in order to make sure my validation of config file is working.
This is what I've got, but I can't get the ConfigurationManager to use
my IConfigurationSectionHandler class.
ExeConfigurationFileMap exeConfig = new ExeConfigurationFileMap();
exeConfig.ExeConfigFilename = @"c:\path\InvalidApp.config";
Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(exeConfig,
ConfigurationUserLevel.None);
ConfigurationSection section = config.GetSection("mysection");
I need the equivalent of ConfigurationManager.GetSection("mysection");
I also get the problem that the test refuses to copy my
InvalidApp.config to its "Out" directory when it runs, so I'm hard
coding it for now.