Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@ -29,8 +29,11 @@
//#define SPEW
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Text;
using System.Configuration;
using System.ComponentModel;
@ -284,16 +287,7 @@ namespace MonoTests.System.Configuration {
[Test]
public void TestSettings2_Properties ()
{
// This test will fail when there are newer versions
// of the test assemblies - so conditionalize it in
// such cases.
#if NET_4_5
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_5, Version=0.0.0.0";
#elif NET_4_0
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_0, Version=0.0.0.0";
#else
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_2_0, Version=0.0.0.0";
#endif
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_x, Version=0.0.0.0";
Assert.AreEqual (expected, new SettingsProviderAttribute (typeof (ProviderPoker)).ProviderTypeName.Substring (0, expected.Length), "#1");
TestSettings2 settings = new TestSettings2 ();
@ -470,6 +464,60 @@ namespace MonoTests.System.Configuration {
Assert.AreEqual ("eclair", holder1.TestKey, "#4");
Assert.AreEqual ("", holder2.TestKey, "#5");
}
class Settings : ApplicationSettingsBase
{
[UserScopedSetting]
public WindowPositionList WindowPositions {
get {
return ((WindowPositionList)(this ["WindowPositions"]));
}
set {
this ["WindowPositions"] = value;
}
}
}
[Serializable]
public class WindowPositionList : IXmlSerializable
{
public XmlSchema GetSchema ()
{
return null;
}
public void ReadXml (XmlReader reader)
{
reader.ReadStartElement ("sampleNode");
reader.ReadEndElement ();
}
public void WriteXml (XmlWriter writer)
{
writer.WriteStartElement ("sampleNode");
writer.WriteEndElement ();
}
}
[Test] //Covers 36388
public void XmlHeader ()
{
try {
var settings = new Settings ();
settings.Reset ();
settings.Save ();
settings.WindowPositions = new WindowPositionList ();
settings.Save ();
// If Reloads fails then saved data is corrupted
settings.Reload ();
} catch (ConfigurationErrorsException e) {
// Delete corrupted config file so other test won't fail.
File.Delete (e.Filename);
Assert.Fail ("Invalid data was saved to config file.");
}
}
}
}