Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@ -1117,5 +1117,83 @@ namespace MonoTests.System.Xml.TestClasses
[XmlElement ("Extra", Order=1)]
public string[] Extra;
}
public class SimpleObjectA
{
[XmlAttribute]
public string Text
{
get; set;
}
public static implicit operator SimpleObjectA (SimpleObjectB o)
{
return new SimpleObjectA { Text = o.Text };
}
public static implicit operator SimpleObjectB (SimpleObjectA o)
{
return new SimpleObjectB { Text = o.Text };
}
}
public class SimpleObjectB
{
[XmlAttribute]
public string Text
{
get; set;
}
}
public class ObjectWithElementRequiringImplicitCast
{
public ObjectWithElementRequiringImplicitCast () { }
public ObjectWithElementRequiringImplicitCast (string text)
{
Object = new SimpleObjectB { Text = text };
}
[XmlElement(Type = typeof (SimpleObjectA))]
public SimpleObjectB Object
{
get; set;
}
}
public class ObjectWithNullableArrayItems
{
[XmlArrayItem ("Element", IsNullable = true)]
public List<SimpleClass> Elements;
}
public class ObjectWithNonNullableArrayItems
{
[XmlArrayItem ("Element", IsNullable = false)]
public List<SimpleClass> Elements;
}
public class ObjectWithNotSpecifiedNullableArrayItems
{
[XmlArrayItem ("Element")]
public List<SimpleClass> Elements;
}
[Serializable]
public sealed class ClassWithDefaultTextNotNull
{
[XmlText]
public string Value;
public const string DefaultValue = "NotNull";
public ClassWithDefaultTextNotNull (string v) {
Value = v;
}
public ClassWithDefaultTextNotNull () {
Value = DefaultValue;
}
}
}

View File

@ -1 +1 @@
6001f7f247689571d9181a9a36a4e1a33efbdf6a
ef6ba78867fa3b99cb16bbe347f37608795cc92a

View File

@ -33,7 +33,7 @@ using System.Xml;
using NUnit.Framework;
namespace MonoTest.System.Xml {
namespace MonoTests.System.Xml {
[TestFixture]
public class XmlResolverTest {

View File

@ -38,7 +38,7 @@ using System.Security.Permissions;
using System.Security.Policy;
using System.Xml;
using MonoTestsXml;
using MonoTests.System.Xml;
namespace MonoCasTests.System.Xml {
@ -85,4 +85,4 @@ namespace MonoCasTests.System.Xml {
}
}
#endif
#endif

View File

@ -20,7 +20,7 @@ using System.Security.Permissions;
using System.Xml;
using NUnit.Framework;
namespace MonoTestsXml
namespace MonoTests.System.Xml
{
[TestFixture]
public class XmlSecureResolverTests

View File

@ -1382,5 +1382,56 @@ namespace MonoTests.System.Xml
var xtr = new XmlTextReader (ms);
xtr.Read ();
}
[Test]
public void XmlDeclarationReadAttributeValue ()
{
const string input = "<?xml version=\"1.0\" encoding=\"utf-8\"?><hello />";
var reader = new XmlTextReader (new StringReader (input));
reader.WhitespaceHandling = WhitespaceHandling.All;
reader.Read ();
Assert.AreEqual ("1.0", reader.GetAttribute ("version"), "#0");
Assert.AreEqual ("utf-8", reader.GetAttribute ("encoding"), "#0-2");
Assert.IsTrue (reader.MoveToNextAttribute (), "#1");
Assert.AreEqual ("1.0", reader.Value, "#1-1");
Assert.IsTrue (reader.ReadAttributeValue (), "#2");
Assert.AreEqual ("1.0", reader.Value, "#3");
Assert.IsFalse (reader.ReadAttributeValue (), "#4");
Assert.IsTrue (reader.MoveToNextAttribute (), "#5");
Assert.AreEqual ("utf-8", reader.Value, "#5-1");
Assert.IsTrue (reader.ReadAttributeValue (), "#6");
Assert.AreEqual ("utf-8", reader.Value, "#7");
Assert.IsFalse (reader.ReadAttributeValue (), "#8");
Assert.IsFalse (reader.MoveToNextAttribute (), "#9");
Assert.IsFalse (reader.ReadAttributeValue (), "#10");
}
[Test]
public void XmlDeclarationReadAttributeValue2 ()
{
const string input = "<?xml version=\"1.0\" encoding=\"utf-8\"?><hello />";
var reader = new XmlTextReader (new StringReader (input));
reader.WhitespaceHandling = WhitespaceHandling.All;
reader.Read ();
Assert.IsTrue (reader.MoveToNextAttribute (), "#1a");
Assert.IsTrue (reader.ReadAttributeValue (), "#1b");
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#1c");
Assert.AreEqual ("1.0", reader.Value, "#1d");
Assert.IsFalse (reader.ReadAttributeValue(), "#1e");
Assert.IsTrue (reader.MoveToNextAttribute(), "#2a");
Assert.IsTrue (reader.ReadAttributeValue(), "#2b");
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#2c");
Assert.AreEqual ("utf-8", reader.Value, "#2d");
Assert.IsFalse (reader.ReadAttributeValue(), "#2e");
Assert.IsFalse (reader.MoveToNextAttribute(), "#3");
Assert.IsFalse (reader.ReadAttributeValue(), "#4");
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#5");
}
}
}