diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2015-05-12 09:42:19 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2015-05-12 09:42:19 +0300 |
commit | ddca46d22be8d1f717cd6166bd57b59b51cec4b0 (patch) | |
tree | 20e13f81db9057703d0c0d05681644704aed4122 /mcs/class/System.XML/Test | |
parent | 093a116f0f87748f8090a7bb7848cfb280e8eb93 (diff) |
Revert "[system.xml] Serialization from reference sources for desktop"
This reverts commit 6ae517ea65af8cf7585c3a080caaa53d05447cc1.
Diffstat (limited to 'mcs/class/System.XML/Test')
8 files changed, 67 insertions, 39 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/ComplexDataStructure.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/ComplexDataStructure.cs index 043c5107eb0..e05a22d7e91 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/ComplexDataStructure.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/ComplexDataStructure.cs @@ -286,17 +286,17 @@ namespace MonoTests.System.XmlSerialization AssertionHelper.AssertEqualsArray ("t.ttList", exp.ttList.ToArray(), t.ttList.ToArray()); Assert.IsNotNull (t.RoList, "t.RoList"); -// Assert.AreEqual (exp.RoList.Count, t.RoList.Count, "t.RoList.Count"); - for (int n=0; n<t.RoList.Count; n++) + Assert.AreEqual (exp.RoList.Count, t.RoList.Count, "t.RoList.Count"); + for (int n=0; n<exp.RoList.Count; n++) TestPart.AssertEquals ("t.RoList " + n, (TestPart)exp.RoList[n], (TestPart)t.RoList[n]); Assert.AreEqual (exp.struc.aa, t.struc.aa, "t.struc.aa"); Assert.AreSame (exp.struc.cc, t.struc.cc, "t.struc.cc"); - Assert.IsNull (t.multiList, "t.multiList"); -// Assert.AreEqual (exp.multiList.Length, t.multiList.Length, "t.multiList.Count"); -// for (int n=0; n<exp.multiList.Length; n++) -// AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray()); + Assert.IsNotNull (t.multiList, "t.multiList"); + Assert.AreEqual (exp.multiList.Length, t.multiList.Length, "t.multiList.Count"); + for (int n=0; n<exp.multiList.Length; n++) + AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray()); Assert.AreEqual (exp.defElem, t.defElem, "t.defElem"); Assert.AreEqual (exp.defAttr, t.defAttr, "t.defAttr"); @@ -305,18 +305,18 @@ namespace MonoTests.System.XmlSerialization Assert.AreEqual (exp.attqname, t.attqname, "t.attqname"); - Assert.IsNull (t.dbscontainer, "t.dbscontainer"); -// DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer; -// DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer; -// Assert.IsNotNull (tdbca, "t.dbscontainer.at"); + Assert.IsNotNull (t.dbscontainer, "t.dbscontainer"); + DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer; + DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer; + Assert.IsNotNull (tdbca, "t.dbscontainer.at"); -// Assert.IsNotNull (tdbca, "t.dbscontainer.dbca"); -// AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring); + Assert.IsNotNull (tdbca, "t.dbscontainer.dbca"); + AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring); -// AnotherTestPart tat = tdbca.at as AnotherTestPart; -// AnotherTestPart expat = expdbca.at as AnotherTestPart; -// Assert.IsNotNull (tat, "t.dbscontainer.dbca.at"); -// Assert.AreEqual (expat.lo, tat.lo, "t.dbscontainer.dbca.at.lo"); + AnotherTestPart tat = tdbca.at as AnotherTestPart; + AnotherTestPart expat = expdbca.at as AnotherTestPart; + Assert.IsNotNull (tat, "t.dbscontainer.dbca.at"); + Assert.AreEqual (expat.lo, tat.lo, "t.dbscontainer.dbca.at.lo"); } void CheckParts (string id, TestPart[] exp, TestPart[] parts) @@ -514,7 +514,7 @@ namespace MonoTests.System.XmlSerialization } [SoapIgnore] - [XmlIgnore] // Causes NRE in System.Xml.Serialization.CodeGenerator.GetVariableType (System.Object var) +// [XmlIgnore] public ArrayList[] multiList; [SoapIgnore] diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs index 009bfb862a3..7c4295f4554 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs @@ -163,7 +163,7 @@ namespace MonoTests.System.XmlSerialization } [Test] - [ExpectedException (typeof (InvalidOperationException))] + [Category ("NotDotNet")] public void DeserializeArrayReferences () { string s = "<Sample xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; @@ -248,6 +248,7 @@ namespace MonoTests.System.XmlSerialization ListDefaults d2 = (ListDefaults) Deserialize (typeof (ListDefaults), "<root/>"); Assert.IsNotNull (d2.list2, "#A1"); + Assert.IsNull (d2.list3, "#A2"); Assert.IsNull (d2.list4, "#A3"); Assert.IsNotNull (d2.list5, "#A4"); Assert.IsNotNull (d2.ed, "#A5"); @@ -256,6 +257,7 @@ namespace MonoTests.System.XmlSerialization d2 = (ListDefaults) Deserialize (typeof (ListDefaults), "<root></root>"); Assert.IsNotNull (d2.list2, "#B1"); + Assert.IsNull (d2.list3, "#B2"); Assert.IsNull (d2.list4, "#B3"); Assert.IsNotNull (d2.list5, "#B4"); Assert.IsNotNull (d2.ed, "#B5"); @@ -817,6 +819,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [ExpectedException (typeof (InvalidOperationException))] public void TestDeserializeObjectWithReadonlyNulCollection () { string s3 = ""; @@ -827,8 +830,7 @@ namespace MonoTests.System.XmlSerialization s3 += " </Collection1>"; s3 += "</Container>"; - var obj = (ObjectWithReadonlyNulCollection) Deserialize (typeof (ObjectWithReadonlyNulCollection), s3); - Assert.IsNull (obj.Collection1); + Deserialize (typeof (ObjectWithReadonlyNulCollection), s3); } [Test] @@ -1058,7 +1060,7 @@ namespace MonoTests.System.XmlSerialization } [Test] - [Category ("NotWorking")] // MS.NET results in compilation error (probably it generates bogus source.) + [Category ("NotDotNet")] // MS.NET results in compilation error (probably it generates bogus source.) public void TestDeserialize_Field_Encoded () { Field_Encoded f = null; @@ -1545,12 +1547,11 @@ namespace MonoTests.System.XmlSerialization } [Test] - [Category ("MobileNotWorking")] public void NotExactDateParse () { XmlSerializer xs = new XmlSerializer (typeof (NotExactDateParseClass)); NotExactDateParseClass o = (NotExactDateParseClass) xs.Deserialize (new StringReader ("<NotExactDateParseClass xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SomeDate xsi:type=\"xsd:date\">2012-02-05-09:00</SomeDate></NotExactDateParseClass>")); - Assert.AreEqual (new DateTime (2012,2,5,10,0,0), o.SomeDate); + Assert.AreEqual (new DateTime (2012,2,5), o.SomeDate); } diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/SoapAttributesTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/SoapAttributesTests.cs index a517c856d78..88bf4a643de 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/SoapAttributesTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/SoapAttributesTests.cs @@ -20,11 +20,15 @@ namespace MonoTests.System.XmlSerialization public class SoapAttributesTests { [Test] + // in .NET 2.0, SoapDefaultValue should be null by default, but we need + // more tests before making this change + [Category ("NotDotNet")] public void Defaults () { SoapAttributes atts = new SoapAttributes (); Assert.IsNull (atts.SoapAttribute, "#1"); - Assert.IsNull (atts.SoapDefaultValue, "#2"); + Assert.IsNotNull (atts.SoapDefaultValue, "#2"); + Assert.AreEqual (DBNull.Value, atts.SoapDefaultValue, "#3"); Assert.IsNull (atts.SoapElement, "#4"); Assert.IsNull (atts.SoapEnum, "#5"); Assert.AreEqual (false, atts.SoapIgnore, "#6"); diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributesTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributesTests.cs index ef42de89b6c..9cf534f2012 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributesTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributesTests.cs @@ -74,7 +74,9 @@ namespace MonoTests.System.XmlSerialization Assert.AreEqual (0, atts.XmlArrayItems.Count, "#6"); Assert.IsNull (atts.XmlAttribute, "#7"); Assert.IsNull (atts.XmlChoiceIdentifier, "#8"); - Assert.IsNull (atts.XmlDefaultValue, "#9"); + Assert.IsNotNull (atts.XmlDefaultValue, "#9"); + // DBNull?? + Assert.AreEqual (DBNull.Value, atts.XmlDefaultValue, "#10"); Assert.IsNotNull (atts.XmlElements, "#11"); Assert.AreEqual (0, atts.XmlElements.Count, "#12"); Assert.IsNull (atts.XmlEnum, "#13"); diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs index 7b5a1c76687..c83ef788f46 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs @@ -455,6 +455,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Ignore ("Additional namespace prefixes are added")] public void TestWritePotentiallyReferencingElement () { XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester (); @@ -497,6 +498,13 @@ namespace MonoTests.System.XmlSerialization } [Test] + public void TestWriteSerializable() + { + // FIXME + //Assert.AreEqual (, ""); + } + + [Test] public void TestWriteStartDocument() { Assert.AreEqual ("", Content); @@ -828,6 +836,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Category ("NotWorking")] // enum name is output instead of integral value public void TestWriteTypedPrimitive_Enum () { XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester (); @@ -875,6 +884,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Category ("NotWorking")] // InvalidOperationException is thrown public void TestWriteTypedPrimitive_Enum_XsiType () { XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester (); @@ -1573,16 +1583,10 @@ namespace MonoTests.System.XmlSerialization ser.Serialize (sw, d); string str = sw.ToString (); - var expected = -"<?xml version=\"1.0\" encoding=\"utf-16\"?>" + Environment.NewLine + -"<root xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + Environment.NewLine + -" <MyTime>10:00:00.0000000+02:00</MyTime>" + Environment.NewLine + -" <MyTimeNullable>10:00:00.0000000+02:00</MyTimeNullable>" + Environment.NewLine + -" <MyDate>2012-01-03</MyDate>" + Environment.NewLine + -" <MyDateNullable>2012-01-03</MyDateNullable>" + Environment.NewLine + -"</root>"; - - Assert.AreEqual (expected, str); + Assert.IsTrue (str.IndexOf ("<MyTime>10:00:00</MyTime>") != -1, "Time"); + Assert.IsTrue (str.IndexOf ("<MyTimeNullable>10:00:00</MyTimeNullable>") != -1, "Nullable Time"); + Assert.IsTrue (str.IndexOf ("<MyDate>2012-01-03</MyDate>") != -1, "Date"); + Assert.IsTrue (str.IndexOf ("<MyDateNullable>2012-01-03</MyDateNullable>") != -1, "Nullable Datwe"); } diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs index 597acd1df54..1a5f6e8f26c 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs @@ -465,7 +465,7 @@ namespace MonoTests.System.Xml.TestClasses public ArrayList list2; -// public MyList list3; + public MyList list3; public string[] list4; diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs index 712e9d1543a..2569fd2e694 100644 --- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs @@ -278,6 +278,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Category ("NotWorking")] public void TestSerializeEnumeration_FromValue_Encoded () { SerializeEncoded ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration)); @@ -375,6 +376,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Category ("NotWorking")] public void TestSerializeEnumDefaultValue_Encoded () { SerializeEncoded (new EnumDefaultValue ()); @@ -727,7 +729,7 @@ namespace MonoTests.System.XmlSerialization } [Test] - [Category ("NotWorking")] // MS bug + [Category ("NotDotNet")] // MS bug public void TestSerializeField_Encoded () { Field_Encoded f = new Field_Encoded (); @@ -1552,6 +1554,7 @@ namespace MonoTests.System.XmlSerialization } [Test] + [Category ("NotWorking")] // SerializationCodeGenerator outputs wrong xsi:type for flagencoded in #C1 public void TestSerializeDefaultValueAttribute_Encoded () { SoapAttributeOverrides overrides = new SoapAttributeOverrides (); @@ -1749,6 +1752,7 @@ namespace MonoTests.System.XmlSerialization [Test] [ExpectedException (typeof (InvalidOperationException))] + [Category ("NotWorking")] public void TestSerializeXmlNodeArrayIncludesAttribute () { XmlDocument doc = new XmlDocument (); @@ -2231,12 +2235,14 @@ namespace MonoTests.System.XmlSerialization } [Test] + [ExpectedException (typeof (InvalidOperationException))] public void XmlArrayAttributeUnqualifiedWithNamespace () { new XmlSerializer (typeof (XmlArrayUnqualifiedWithNamespace)); } [Test] + [ExpectedException (typeof (InvalidOperationException))] public void XmlArrayItemAttributeUnqualifiedWithNamespace () { new XmlSerializer (typeof (XmlArrayItemUnqualifiedWithNamespace)); @@ -3352,7 +3358,7 @@ namespace MonoTests.System.XmlSerialization } [Test] - [Category("NotWorking")] + [Category("NotDotNet")] public void ShouldSerializeGeneric () { var ser = new XmlSerializer (typeof (ClassWithShouldSerializeGeneric)); @@ -3537,4 +3543,5 @@ namespace MonoTests.System.XmlSerialization public string SecondMember { get; set; } } #endregion + } diff --git a/mcs/class/System.XML/Test/XmlFiles/literal-data.xml b/mcs/class/System.XML/Test/XmlFiles/literal-data.xml index 7900290505f..b1104a1fcec 100644 --- a/mcs/class/System.XML/Test/XmlFiles/literal-data.xml +++ b/mcs/class/System.XML/Test/XmlFiles/literal-data.xml @@ -246,7 +246,17 @@ <ttList> <anyType xsi:type="xsd:string">two</anyType> <anyType xsi:type="xsd:string">strings</anyType> - </ttList>aa<xmltext>33</xmltext>bb<xmltext>776</xmltext><special> + </ttList> + <multiList> + <ArrayOfAnyType> + <anyType xsi:type="xsd:int">22</anyType> + <anyType xsi:type="xsd:int">33</anyType> + </ArrayOfAnyType> + <ArrayOfAnyType> + <anyType xsi:type="xsd:int">888</anyType> + <anyType xsi:type="xsd:int">999</anyType> + </ArrayOfAnyType> + </multiList>aa<xmltext>33</xmltext>bb<xmltext>776</xmltext><special> <data> <two>2</two> <one>1</one> |