Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Henrich <marcos.henrich@xamarin.com>2016-01-05 14:05:35 +0300
committerMarcos Henrich <marcos.henrich@xamarin.com>2016-01-05 14:56:24 +0300
commit4980c52fff6f0721d21132a97dac889423116016 (patch)
tree27df2e7343b9c3bf9ae7dd62311e625df2be5fc2 /mcs/class/System.Configuration
parent59ca29cd71be332d03d5578ea12acbd32aef2155 (diff)
[System.Configuration] Test bad xml loading.
When ConfigurationManager.OpenMappedMachineConfiguration loads broken xml ConfigurationErrorsException should be trown instead of XmlException.
Diffstat (limited to 'mcs/class/System.Configuration')
-rw-r--r--mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs b/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
index d2e1a240f6d..7efff1dddff 100644
--- a/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
+++ b/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
@@ -627,5 +627,23 @@ namespace MonoTests.System.Configuration {
Assert.AreEqual ("Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;",
connString);
}
+
+ [Test]
+ public void BadConfig ()
+ {
+ string xml = @" badXml";
+
+ var file = Path.Combine (tempFolder, "badConfig.config");
+ File.WriteAllText (file, xml);
+
+ try {
+ var fileMap = new ConfigurationFileMap (file);
+ var configuration = ConfigurationManager.OpenMappedMachineConfiguration (fileMap);
+ Assert.Fail ("Exception ConfigurationErrorsException was expected.");
+ } catch (ConfigurationErrorsException e) {
+ Assert.AreEqual (file, e.Filename);
+ }
+
+ }
}
}