Files
mono/mcs/class/System.Configuration/Test/standalone/t28.cs
T
Raja R Harinath cd51491631 Fix a few cases of mixed line-endings
This is a scripted conversion of mixed line-ending files to LF-only or CRLF-only
based on which patch is smaller.  I used a threshold of upto a quarter of the
lines to determine whether to keep the patch or not.
2010-07-26 02:20:13 +05:30

37 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Configuration;
using System.Web;
class T1
{
static void Main(string[] args)
{
try {
NameValueCollection AppSettings = ConfigurationManager.AppSettings;
Assert.Fail ("#1:" + AppSettings);
} catch (ConfigurationErrorsException ex) {
// Configuration system failed to initialize
Assert.AreEqual (typeof (ConfigurationErrorsException), ex.GetType (), "#2");
Assert.IsNull (ex.Filename, "#3");
Assert.IsNotNull (ex.InnerException, "#6");
Assert.AreEqual (0, ex.Line, "#7");
Assert.IsNotNull (ex.Message, "#8");
// <location> sections are allowed only within <configuration> sections
ConfigurationErrorsException inner = ex.InnerException as ConfigurationErrorsException;
Assert.AreEqual (typeof (ConfigurationErrorsException), inner.GetType (), "#9");
Assert.AreEqual (AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, inner.Filename, "#10");
Assert.IsNull (inner.InnerException, "#11");
Assert.AreEqual (3, inner.Line, "#12");
Assert.IsNotNull (inner.Message, "#13");
Assert.IsTrue (inner.Message.IndexOf ("<location>") != -1, "#14:" + inner.Message);
Assert.IsTrue (inner.Message.IndexOf ("<configuration>") != -1, "#15:" + inner.Message);
Console.WriteLine ("configuration exception thrown.");
}
}
}