I'm writing some unit tests, this unit test do use code in an external library, this library expects the config file to contain some information. I know that to use App.config
in my UnitTest, I need to mark my TestMethod with [DeploymentItem("App.config")]
, but as far as I know, this will by default look for configuration tags in the section <appSettings>
. How can I specify if my App.config defines a custom config section?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MySettingSection" type="System.Configuration.AppSettingsSection" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<MySettingSection>
<add key="ApplicationName" value="My Test Application" />
</MySettingSection>
</configuration>