Author: lluis
Date: 2005-04-26 05:20:55 -0400 (Tue, 26 Apr 2005)
New Revision: 43585
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
Log:
2005-04-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* XmlSerializerTests.cs:
* DeserializeTests.cs:
* XmlSerializerTestClasses.cs: Added tests for readonly properties and
elements with spaces on them.
Modified: trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
2005-04-26 09:20:34 UTC (rev 43584)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
2005-04-26 09:20:55 UTC (rev 43585)
@@ -1,3 +1,10 @@
+2005-04-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * XmlSerializerTests.cs:
+ * DeserializeTests.cs:
+ * XmlSerializerTestClasses.cs: Added tests for readonly properties and
+ elements with spaces on them.
+
2005-03-30 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* XmlSerializerTests.cs:
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
===================================================================
---
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
2005-04-26 09:20:34 UTC (rev 43584)
+++
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
2005-04-26 09:20:55 UTC (rev 43585)
@@ -192,6 +192,14 @@
ch = (Choices) Deserialize (typeof(Choices),
"<Choices><ChoiceTwo>choice text</ChoiceTwo></Choices>");
Assertion.AssertEquals ("#1", "choice text",
ch.MyChoice);
Assertion.AssertEquals ("#2", ItemChoiceType.ChoiceTwo,
ch.ItemType);
- }
+ }
+
+ [Test]
+ public void TestDeserializeNamesWithSpaces ()
+ {
+ TestSpace ts = (TestSpace) Deserialize
(typeof(TestSpace), "<Type_x0020_with_x0020_space
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
Attribute_x0020_with_x0020_space='5'><Element_x0020_with_x0020_space>4</Element_x0020_with_x0020_space></Type_x0020_with_x0020_space>");
+ Assertion.AssertEquals ("#1", 4, ts.elem);
+ Assertion.AssertEquals ("#2", 5, ts.attr);
+ }
}
}
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
===================================================================
---
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
2005-04-26 09:20:34 UTC (rev 43584)
+++
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
2005-04-26 09:20:55 UTC (rev 43585)
@@ -180,5 +180,28 @@
[XmlIgnore]
public ItemChoiceType ItemType;
- }
+ }
+
+ [XmlType ("Type with space")]
+ public class TestSpace
+ {
+ [XmlElement (ElementName = "Element with space")]
+ public int elem;
+
+ [XmlAttribute (AttributeName = "Attribute with space")]
+ public int attr;
+ }
+
+ [Serializable]
+ public class ReadOnlyProperties {
+ string[] strArr = new string[2] { "string1", "string2" };
+
+ public string[] StrArr {
+ get { return strArr; }
+ }
+
+ public string dat {
+ get { return "fff"; }
+ }
+ }
}
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
===================================================================
---
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
2005-04-26 09:20:34 UTC (rev 43584)
+++
trunk/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
2005-04-26 09:20:55 UTC (rev 43585)
@@ -716,6 +716,24 @@
AssertEquals(Infoset("<Choices
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ChoiceTwo>choice
text</ChoiceTwo></Choices>"), WriterText);
}
+ [Test]
+ public void TestSerializeNamesWithSpaces ()
+ {
+ TestSpace ts = new TestSpace();
+ ts.elem = 4;
+ ts.attr = 5;
+ Serialize (ts);
+ AssertEquals(Infoset("<Type_x0020_with_x0020_space
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
Attribute_x0020_with_x0020_space='5'><Element_x0020_with_x0020_space>4</Element_x0020_with_x0020_space></Type_x0020_with_x0020_space>"),
WriterText);
+ }
+
+ [Test]
+ public void TestSerializeReadOnlyProps ()
+ {
+ ReadOnlyProperties ts = new ReadOnlyProperties();
+ Serialize (ts);
+ AssertEquals(Infoset("<ReadOnlyProperties
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+ }
+
public static string Infoset (string sx)
{
XmlDocument doc = new XmlDocument ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches