eol-style:native.
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 10 Nov 2006 10:13:46 +0000 (10:13 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 10 Nov 2006 10:13:46 +0000 (10:13 -0000)
svn path=/trunk/mcs/; revision=67663

23 files changed:
mcs/class/System.XML/Test/System.Xml.Serialization/ComplexDataStructure.cs
mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapAttributeAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapElementAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapEnumAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapIncludeAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaMemberTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/SoapTypeAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlAnyElementAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlArrayAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlArrayItemAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributeAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlAttributesTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlChoiceIdentifierAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlElementAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlEnumAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlIncludeAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlRootAttributeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlTextAttributeTests.cs

index 9c5b560f33d748c05575e07936632c3b6922596c..a0cf5a4d995c96762f7c22563df7a61bf65414cf 100644 (file)
-//\r
-// ComplexDataStructure.cs\r
-//\r
-// Author:\r
-//     Lluis Sanchez Gual (lluis@ximian.com)\r
-//\r
-// (C) 2004 Novell, Inc.\r
-//\r
-//\r
-using System;\r
-using System.IO;\r
-using System.Xml;\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-using System.Collections;\r
-using System.ComponentModel; \r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class ComplexDataStructure: Assertion\r
-       {\r
-               [Test]\r
-               [NUnit.Framework.Category("NotDotNet")] // FDBK50639 \r
-               public void WriteLiteral ()\r
-               {\r
-                       Test data = BuildTestObject ();\r
-\r
-                       XmlSerializer ss = new XmlSerializer (GetLiteralTypeMapping ());\r
-                       XmlSerializerNamespaces nams = new XmlSerializerNamespaces ();\r
-                       StringWriter sw = new StringWriter();\r
-                       ss.Serialize (sw,data,nams);\r
-                       string serialized = sw.ToString ();\r
-                       serialized = XmlSerializerTests.Infoset (serialized);\r
-\r
-                       StreamReader sr = new StreamReader ("Test/XmlFiles/literal-data.xml");\r
-                       string expected = sr.ReadToEnd ();\r
-                       sr.Close ();\r
-                       \r
-                       expected = XmlSerializerTests.Infoset (expected);\r
-                       AssertEquals (expected, serialized);\r
-               }\r
-               \r
-               [Test]\r
-               [NUnit.Framework.Category("NotDotNet")]\r
-               public void ReadLiteral ()\r
-               {\r
-                       XmlSerializer ss = new XmlSerializer (GetLiteralTypeMapping ());\r
-                       XmlSerializerNamespaces nams = new XmlSerializerNamespaces ();\r
-                       \r
-                       StreamReader sr = new StreamReader ("Test/XmlFiles/literal-data.xml");\r
-                       Test data = (Test) ss.Deserialize (sr);\r
-                       sr.Close ();\r
-                       \r
-                       CheckObjectContent (BuildTestObject(), data);\r
-               }\r
-               \r
-               XmlTypeMapping GetLiteralTypeMapping ()\r
-               {\r
-                       XmlRootAttribute root = new XmlRootAttribute("rootroot");\r
-                       Type[] types = new Type[] {typeof(UknTestPart), typeof(AnotherTestPart), typeof(DblStringContainer) };\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter ();\r
-                       foreach (Type t in types) ri.IncludeType (t);\r
-                       return ri.ImportTypeMapping (typeof(Test), root);\r
-               }\r
-\r
-               XmlTypeMapping GetEncodedTypeMapping ()\r
-               {\r
-                       SoapReflectionImporter sri = new SoapReflectionImporter ();\r
-                       sri.IncludeType (typeof(UknTestPart));\r
-                       sri.IncludeType (typeof(AnotherTestPart));\r
-                       sri.IncludeType (typeof(DblStringContainer));\r
-                       return sri.ImportTypeMapping (typeof(Test));\r
-               }\r
-               \r
-               Test BuildTestObject ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument();\r
-\r
-                       Test t = new UknTestPart();\r
-                       t.a = 1;\r
-                       t.b = "hola";\r
-                       t.bbis = t.b;\r
-                       t.c = 44;\r
-                       t.parts = new TestPart[3];\r
-                       t.parts[0] = new TestPart();\r
-                       t.parts[0].name = "un";\r
-                       t.parts[0].bval = true;\r
-                       t.parts[1] = new TestPart();\r
-                       t.parts[1].name = "dos";\r
-                       t.parts[1].bval = false;\r
-                       t.parts[2] = t.parts[0];\r
-                       t.part = t.parts[1];\r
-                       t.strings = new string[] { "un", "dos", null, "tres" };\r
-                       t.ushorts = new ushort[] { 1,2,3 };\r
-                       t.ta = new TB();\r
-                       t.ta.extraTextNodes = new XmlNode[] { doc.CreateTextNode ("AA"), doc.CreateTextNode ("BB") };\r
-\r
-                       t.tam2 = new TA[][][]\r
-                                       {\r
-                                               new TA[][] { new TA[] {new TA(), new TA()}, new TA[] {new TA(), new TA()}},\r
-                                               new TA[][] { new TA[] {new TB(), new TA()}, new TA[] {new TB(), new TA()}},\r
-                                               new TA[][] { new TA[] {new TA(), new TB()}, new TA[] {new TA(), new TA()}} \r
-                                       };\r
-\r
-                       t.tam3 = t.tam2;\r
-                       t.flatParts = t.parts;\r
-\r
-                       t.flatParts2 = new TA[] {new TA(), new TB(), null, new TB()};\r
-\r
-                       t.anot = new AnotherTestPart ();\r
-                       ((AnotherTestPart)t.anot).lo = 1234567890;\r
-\r
-                       t.ob = t.parts[1];\r
-                       t.ob2 = t.parts[1];\r
-\r
-                       XmlElement e1 = doc.CreateElement ("explicitElement");\r
-                       XmlElement e2 = doc.CreateElement ("subElement");\r
-                       e2.SetAttribute ("unAtrib","val");\r
-                       doc.AppendChild (e1);\r
-                       e1.AppendChild (e2);\r
-\r
-                       t.oneElem = e1;\r
-                       t.oneElem2 = e1;\r
-                       t.someElems = new XmlNode[3];\r
-                       t.someElems[0] = e1;\r
-                       t.someElems[1] = null;\r
-                       t.someElems[2] = e2;\r
-\r
-                       t.extraElems = new XmlElement[1];\r
-                       t.extraElems[0] = doc.CreateElement ("extra1");\r
-                       t.extraElems[0].SetAttribute ("val","1");\r
-\r
-                       t.extraElems23 = new XmlElement[2];\r
-                       t.extraElems23[0] = doc.CreateElement ("extra2");\r
-                       t.extraElems23[0].SetAttribute ("val","2");\r
-                       t.extraElems23[1] = doc.CreateElement ("extra3");\r
-                       t.extraElems23[1].SetAttribute ("val","3");\r
-\r
-                       t.extraElemsRest = doc.CreateElement ("extra4");\r
-                       t.extraElemsRest.SetAttribute ("val","4");\r
-\r
-                       t.uktester = new UnknownAttributeTester();\r
-                       t.uktester.aa = "hihi";\r
-\r
-                       t.uktester.extraAtts = new XmlAttribute[3];\r
-                       t.uktester.extraAtts[0] = doc.CreateAttribute ("extraAtt1");\r
-                       t.uktester.extraAtts[0].Value = "val1";\r
-                       t.uktester.extraAtts[1] = doc.CreateAttribute ("extraAtt2");\r
-                       t.uktester.extraAtts[1].Value = "val2";\r
-                       t.uktester.extraAtts[2] = doc.CreateAttribute ("extraAtt3");\r
-                       t.uktester.extraAtts[2].Value = "val3";\r
-\r
-                       t.ob3 = 12345;\r
-                       t.ob4 = (float)54321.12;\r
-\r
-                       t.op1 = option.AA;\r
-                       t.opArray = new option[] { option.CC, option.BB, option.AA };\r
-                       t.ukOpt = option.DD;\r
-                       t.opAtt = option.BB;\r
-\r
-                       t.byteArray = new byte[] { 11,33,55,222 };\r
-                       t.byteByteArray = new byte[][] { t.byteArray, t.byteArray };\r
-\r
-                       t.ttList = new ArrayList();\r
-                       t.ttList.Add ("two");\r
-                       t.ttList.Add ("strings");\r
-                       //                      t.extraText = "Additional text";\r
-\r
-                       t.RoList = new ArrayList ();\r
-                       t.RoList.Add (t.parts[0]);\r
-                       t.RoList.Add (t.parts[1]);\r
-\r
-/*                     t.struc = new OneStruct();\r
-                       t.struc.aa = 776655;\r
-                       t.struc.cc = "this is a struct";\r
-*/\r
-                       t.multiList = new ArrayList[2];\r
-                       t.multiList[0] = new ArrayList ();\r
-                       t.multiList[0].Add (22);\r
-                       t.multiList[0].Add (33);\r
-                       t.multiList[1] = new ArrayList ();\r
-                       t.multiList[1].Add (888);\r
-                       t.multiList[1].Add (999);\r
-\r
-\r
-                       t.defElem = "theDefValue";\r
-                       t.defAttr = "theDefValue";\r
-\r
-                       t.special = new CustomHashtable ();\r
-                       t.special.Add ("one","1");\r
-                       t.special.Add ("two","2");\r
-                       t.special.Add ("three","3");\r
-\r
-                       t.attqname = new XmlQualifiedName ("thename","thenamespace");\r
-\r
-                       DblStringContainer dbc = new DblStringContainer ();\r
-                       dbc.doublestring = new string [][] { null, new string[] {"hello"} };\r
-                       AnotherTestPart at = new AnotherTestPart ();\r
-                       at.lo = 567;\r
-                       dbc.at = at;\r
-\r
-                       DblStringContainerAnm dbca = new DblStringContainerAnm ();\r
-                       dbca.at = dbc;\r
-                       t.dbscontainer = dbca;\r
-                       \r
-                       return t;\r
-               }\r
-               \r
-               void CheckObjectContent (Test exp, Test t)\r
-               {\r
-                       AssertEquals ("t.a", exp.a, t.a);\r
-                       AssertEquals ("t.b", exp.b, t.b);\r
-                       AssertEquals ("t.bbis", exp.bbis, t.bbis);\r
-                       AssertEquals ("t.c", exp.c, t.c);\r
-                       \r
-                       AssertNotNull ("t.parts", t.parts);\r
-                       CheckParts ("t.parts", exp.parts, t.parts);\r
-                       \r
-                       TestPart.AssertEquals ("t.part", exp.part, t.part);\r
-                       \r
-                       AssertionHelper.AssertEqualsArray ("t.strings", exp.strings, t.strings);\r
-                       AssertionHelper.AssertEqualsArray ("t.ushorts", exp.ushorts, t.ushorts);\r
-                       \r
-                       TA.AssertEquals ("t.ta", exp.ta, t.ta);\r
-\r
-                       AssertNotNull ("t.tam2", t.tam2);\r
-                       CheckTaArray ("t.tam2", exp.tam2, t.tam2);\r
-                       \r
-                       AssertNotNull ("t.tam3", t.tam3);\r
-                       CheckTaArray ("t.tam3", exp.tam3, t.tam3);\r
-                       \r
-                       AssertNotNull ("t.flatParts", t.flatParts);\r
-                       CheckParts ("t.flatParts", exp.flatParts, t.flatParts);\r
-\r
-                       // Null element is ignored\r
-                       AssertNotNull ("t.flatParts2", t.flatParts2);\r
-                       AssertEquals ("t.flatParts2.Length", 3, t.flatParts2.Length);\r
-                       TA.AssertEquals ("t.flatParts2 0", exp.flatParts2[0], t.flatParts2[0]);\r
-                       TA.AssertEquals ("t.flatParts2 1", exp.flatParts2[1], t.flatParts2[1]);\r
-                       TA.AssertEquals ("t.flatParts2 2", exp.flatParts2[3], t.flatParts2[2]);\r
-                       \r
-                       AssertNotNull ("t.anot", t.anot);\r
-                       AssertEquals ("t.anot.lo", ((AnotherTestPart)exp.anot).lo, ((AnotherTestPart)t.anot).lo);\r
-\r
-                       TestPart.AssertEquals ("t.ob", exp.ob as TestPart, t.ob as TestPart);\r
-                       TestPart.AssertEquals ("t.ob2", exp.ob2 as TestPart, t.ob2 as TestPart);\r
-                       \r
-                       AssertionHelper.AssertEqualsXml ("t.oneElem", exp.oneElem, t.oneElem);\r
-                       AssertionHelper.AssertEqualsXml ("t.oneElem2", exp.oneElem2, t.oneElem2);\r
-                       \r
-                       // One of the elements was null and it is ignored\r
-                       AssertNotNull ("t.someElems", t.someElems);\r
-                       AssertEquals ("t.someElems.Length", 2, t.someElems.Length);\r
-                       AssertionHelper.AssertEqualsXml ("t.someElems[0]", exp.someElems[0], t.someElems[0]);\r
-                       AssertionHelper.AssertEqualsXml ("t.someElems[1]", exp.someElems[2], t.someElems[1]);\r
-\r
-                       AssertNotNull ("t.extraElems", t.extraElems);\r
-                       AssertEquals ("t.extraElems.Length", exp.extraElems.Length, t.extraElems.Length);\r
-                       for (int n=0; n<exp.extraElems.Length; n++)\r
-                               AssertionHelper.AssertEqualsXml ("t.extraElems[" + n + "]", exp.extraElems[n], t.extraElems[n]);\r
-                       \r
-                       AssertNotNull ("t.extraElems23", t.extraElems23);\r
-                       AssertEquals ("t.extraElems23.Length", exp.extraElems23.Length, t.extraElems23.Length);\r
-                       for (int n=0; n<t.extraElems23.Length; n++)\r
-                               AssertionHelper.AssertEqualsXml ("t.extraElems23[" + n + "]", exp.extraElems23[n], t.extraElems23[n]);\r
-                       \r
-                       AssertionHelper.AssertEqualsXml ("t.extraElemsRest", exp.extraElemsRest, t.extraElemsRest);\r
-                       \r
-                       UnknownAttributeTester.AssertEquals ("t.uktester", exp.uktester, t.uktester);\r
-\r
-                       AssertEquals ("t.ob3", exp.ob3, t.ob3);\r
-                       AssertEquals ("t.ob4", exp.ob4, t.ob4);\r
-                       AssertEquals ("t.op1", exp.op1, t.op1);\r
-                       \r
-                       AssertionHelper.AssertEqualsArray ("t.opArray", exp.opArray, t.opArray);\r
-\r
-                       AssertEquals ("t.ukOpt", exp.ukOpt, t.ukOpt);\r
-                       AssertEquals ("t.opAtt", exp.opAtt, t.opAtt);\r
-\r
-                       AssertionHelper.AssertEqualsArray ("t.byteArray", exp.byteArray, t.byteArray);\r
-                       AssertionHelper.AssertEqualsArray ("t.byteByteArray", exp.byteByteArray, t.byteByteArray);\r
-                       \r
-                       AssertNotNull ("t.ttList", t.ttList);\r
-                       AssertionHelper.AssertEqualsArray ("t.ttList", exp.ttList.ToArray(), t.ttList.ToArray());\r
-                       \r
-                       AssertNotNull ("t.RoList", t.RoList);\r
-                       AssertEquals ("t.RoList.Count", exp.RoList.Count, t.RoList.Count);\r
-                       for (int n=0; n<exp.RoList.Count; n++)\r
-                               TestPart.AssertEquals ("t.RoList " + n, (TestPart)exp.RoList[n], (TestPart)t.RoList[n]);\r
-                       \r
-                       AssertEquals ("t.struc.aa", exp.struc.aa, t.struc.aa);\r
-                       AssertEquals ("t.struc.cc", exp.struc.cc, t.struc.cc);\r
-\r
-                       AssertNotNull ("t.multiList", t.multiList);\r
-                       AssertEquals ("t.multiList.Count", exp.multiList.Length, t.multiList.Length);\r
-                       for (int n=0; n<exp.multiList.Length; n++)\r
-                               AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray());\r
-                       \r
-                       AssertEquals ("t.defElem", exp.defElem, t.defElem);\r
-                       AssertEquals ("t.defAttr", exp.defAttr, t.defAttr);\r
-\r
-                       CustomHashtable.AssertEquals ("t.special", exp.special, t.special);\r
-\r
-                       AssertEquals ("t.attqname", exp.attqname, t.attqname);\r
-\r
-                       AssertNotNull ("t.dbscontainer", t.dbscontainer);\r
-                       DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer;\r
-                       DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer;\r
-                       AssertNotNull ("t.dbscontainer.at", tdbca);\r
-                       \r
-                       AssertNotNull ("t.dbscontainer.dbca", tdbca);\r
-                       AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring);\r
-                       \r
-                       AnotherTestPart tat = tdbca.at as AnotherTestPart;\r
-                       AnotherTestPart expat = expdbca.at as AnotherTestPart;\r
-                       AssertNotNull ("t.dbscontainer.dbca.at", tat);\r
-                       AssertEquals ("t.dbscontainer.dbca.at.lo", expat.lo, tat.lo);\r
-               }\r
-               \r
-               void CheckParts (string id, TestPart[] exp, TestPart[] parts)\r
-               {\r
-                       AssertionHelper.AssertType (id, exp, parts);\r
-                       AssertEquals (id + " Len", exp.Length, parts.Length);\r
-                       for (int n=0; n<exp.Length; n++)\r
-                               TestPart.AssertEquals (id + "[" + n + "]", exp[n], parts[n]);\r
-               }\r
-               \r
-               void CheckTaArray (string id, TA[][][] exp, TA[][][] arr)\r
-               {\r
-                       AssertionHelper.AssertType (id, exp, arr);\r
-                       AssertEquals (id + " Len", exp.Length, arr.Length);\r
-                       for (int n=0; n<exp.Length; n++)\r
-                       {\r
-                               TA[][] tar = arr[n];\r
-                               TA[][] expar = exp[n];\r
-                               \r
-                               AssertionHelper.AssertType (id, expar, tar);\r
-                               AssertEquals (expar.Length, tar.Length);\r
-                               \r
-                               for (int m=0; m<expar.Length; m++)\r
-                               {\r
-                                       TA[] tar2 = tar[m];\r
-                                       TA[] expar2 = expar[m];\r
-                                       \r
-                                       AssertionHelper.AssertType (id, expar2, tar2);\r
-                                       AssertEquals (id, expar2.Length, tar2.Length);\r
-                                       \r
-                                       for (int i=0; i<expar2.Length; i++)\r
-                                               TA.AssertEquals (id + "[" + n + "][" + m + "][" + i + "]", expar2[i], tar2[i]);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       \r
-       public class AssertionHelper\r
-       {\r
-               public static bool AssertType (string id, object exp, object ob)\r
-               {\r
-                       if (exp == null) {\r
-                               Assertion.AssertNull (id, ob);\r
-                               return false;\r
-                       }\r
-                       else {\r
-                               Assertion.AssertNotNull (id, ob);\r
-                               Assertion.AssertEquals (id + " type", exp.GetType(), ob.GetType());\r
-                               return true;\r
-                       }\r
-               }\r
-               \r
-               public static void AssertEqualsXml (string id, XmlNode exp, XmlNode ob)\r
-               {\r
-                       if (!AssertType (id, exp, ob)) return;\r
-                       Assertion.AssertEquals (id, XmlSerializerTests.Infoset (exp), XmlSerializerTests.Infoset (ob));\r
-               }\r
-               \r
-               public static void AssertEqualsArray (string id, Array exp, Array ob)\r
-               {\r
-                       if (!AssertType (id, exp, ob)) return;\r
-                       Assertion.AssertEquals (id + " Length", exp.GetLength(0), ob.GetLength(0));\r
-                       for (int n=0; n<exp.GetLength(0); n++) {\r
-                               object it = exp.GetValue(n);\r
-                               if (it is Array) \r
-                                       AssertEqualsArray (id + "[" + n + "]", it as Array, ob.GetValue(n) as Array);\r
-                               else\r
-                                       Assertion.AssertEquals (id + "[" + n + "]", it, ob.GetValue(n));\r
-                       }\r
-               }\r
-       }\r
-       \r
-       [XmlType(TypeName="")]\r
-       [XmlRoot(ElementName="aaaaaa",Namespace="")]\r
-       [XmlInclude(typeof(UknTestPart))]\r
-       [SoapInclude(typeof(UknTestPart))]\r
-       public class Test\r
-       {\r
-               //              public option op;elem.SchemaTypeName\r
-               public object anot;\r
-\r
-               [SoapElement(ElementName="suba")]\r
-               [XmlElement(ElementName="suba",Namespace="kk")]\r
-               public int a;\r
-\r
-               public string b;\r
-               public string bbis;\r
-\r
-               [SoapAttribute]\r
-               [XmlAttribute (Namespace="attribns")]\r
-               public byte c;\r
-\r
-               [XmlElement(Namespace="oo")]\r
-               public TestPart part;\r
-\r
-               public TA ta;\r
-\r
-               public TestPart[] parts;\r
-\r
-               [SoapElement(ElementName="multita")]\r
-               [XmlArray(ElementName="multita")]\r
-                       //              [XmlArrayItem(ElementName="itema",NestingLevel=1)]\r
-               [XmlArrayItem(ElementName="itema",Type=typeof(TA),NestingLevel=1)]\r
-               [XmlArrayItem(ElementName="itemb",Type=typeof(TB),NestingLevel=1)]\r
-               public TA[][] tam = new TA[][] { new TA[] {new TA(), new TB()}, new TA[] {new TA(), new TA()}};\r
-\r
-//             [SoapElement(ElementName="multita2")]\r
-               [SoapIgnore]\r
-               [XmlArray(ElementName="multita2")]\r
-               [XmlArrayItem(ElementName="data1",NestingLevel=0)]\r
-\r
-               [XmlArrayItem(ElementName="data2",NestingLevel=1,Namespace="da2")]\r
-               [XmlArrayItem(ElementName="data3a",Type=typeof(TA),NestingLevel=2,Namespace="da3")]\r
-               [XmlArrayItem(ElementName="data3b",Type=typeof(TB),NestingLevel=2,Namespace="da3")]\r
-               public TA[][][] tam2;\r
-\r
-               [SoapIgnore]\r
-               public TA[][][] tam3;\r
-\r
-               [SoapElement(IsNullable=true)]\r
-               [XmlElement(IsNullable=true)]\r
-               public string mayBeNull;\r
-\r
-               public string[] strings;\r
-\r
-               [XmlArray(Namespace="arrayNamespace")]\r
-               public ushort[] ushorts;\r
-\r
-               [XmlElement]\r
-               public TestPart[] flatParts;\r
-\r
-               [SoapElement (ElementName="flatTAs")]\r
-               [XmlElement (ElementName="flatTAs")]\r
-               public TA[] flatParts2;\r
-\r
-               public object ob;\r
-\r
-               [XmlElement (Namespace="uimp")]\r
-               public object ob2;\r
-\r
-               public object ob3;\r
-               public object ob4;\r
-\r
-               [SoapIgnore]\r
-               public XmlElement oneElem;\r
-\r
-               [SoapIgnore]\r
-               [XmlElement (ElementName="unElement", Namespace="elemns")]\r
-               public XmlElement oneElem2;\r
-\r
-               [SoapIgnore]\r
-               [XmlElement (ElementName="unsElements", Namespace="elemns")]\r
-               public XmlNode[] someElems;\r
-\r
-               [SoapIgnore]\r
-               [XmlAnyElement ("extra1")]\r
-               public XmlElement[] extraElems;\r
-\r
-               [SoapIgnore]\r
-               [XmlAnyElement ("extra2")]\r
-               [XmlAnyElement ("extra3")]\r
-               [XmlAnyElement ("extra3","nnn")]\r
-               public XmlElement[] extraElems23;\r
-\r
-               [SoapIgnore]\r
-               [XmlAnyElement]\r
-               public XmlElement extraElemsRest;\r
-\r
-               public UnknownAttributeTester uktester;\r
-\r
-               public option op1;\r
-               public option[] opArray;\r
-               public object ukOpt;\r
-\r
-               [XmlAttribute]\r
-               [SoapIgnore]\r
-               public option opAtt;\r
-\r
-\r
-               public byte[] byteArray;\r
-               [SoapIgnore]\r
-               public byte[][] byteByteArray;\r
-\r
-               [XmlElement(Type=typeof(string))]\r
-               [XmlElement(ElementName="kk",Type=typeof(int))]\r
-               public object[] tt = new object[] { "aa",22 };\r
-\r
-               public ArrayList ttList;\r
-\r
-               ArrayList roList;\r
-               public ArrayList RoList\r
-               {\r
-                       get { return roList; }\r
-                       set { roList = value; }\r
-               }\r
-\r
-               [SoapIgnore]\r
-//             [XmlIgnore]\r
-               public ArrayList[] multiList;\r
-\r
-               [SoapIgnore]\r
-               [XmlIgnore]\r
-               public OneStruct struc;\r
-\r
-               [DefaultValue("theDefValue")]\r
-               public string defElem;\r
-\r
-               [XmlAttribute]\r
-               [DefaultValue("theDefValue")]\r
-               public string defAttr;\r
-\r
-               [XmlText (Type=typeof(string))]\r
-               [XmlElement (Type=typeof(int))]\r
-               public object[] xmltext = new object[] {"aa",33,"bb",776};\r
-\r
-               [SoapIgnore]\r
-               public CustomHashtable special;\r
-\r
-               [XmlAttribute]\r
-               public XmlQualifiedName attqname;\r
-\r
-               [XmlAttribute]\r
-               public DateTime[] arrayAttribute;\r
-\r
-               [XmlArray (Namespace="mm")]\r
-               public string[][] dummyStringArray = new string[][] {null,null};\r
-               \r
-               [XmlElement (Namespace="mm")]\r
-               public DblStringContainerAnm dbscontainer;\r
-       }\r
-\r
-       public class DblStringContainerAnm\r
-       {\r
-               public object at;\r
-       }\r
-\r
-       [XmlType(Namespace="mm")]\r
-       public class DblStringContainer\r
-       {\r
-               [XmlArrayItem (NestingLevel=1, IsNullable=true)]\r
-               public string [][] doublestring;\r
-               public object at;\r
-       }\r
-\r
-       [SoapType(TypeName="TC")]\r
-       [XmlType(TypeName="TC")]\r
-       [XmlInclude(typeof(TB))]\r
-       [SoapInclude(typeof(TB))]\r
-       public class TA\r
-       {\r
-               public int xx = 1;\r
-\r
-               [XmlText]\r
-               [SoapIgnore]\r
-               public XmlNode[] extraTextNodes;\r
-               \r
-               public static void AssertEquals (string id, TA expected, TA ob)\r
-               {\r
-                       if (!AssertionHelper.AssertType (id, expected, ob)) return;\r
-                       Assertion.AssertEquals (id + " xx", expected.xx, ob.xx);\r
-                       // TODO: extraTextNodes\r
-               }\r
-       }\r
-\r
-       public class TB: TA\r
-       {\r
-               public int yy = 2;\r
-               \r
-               public static void AssertEquals (string id, TB expected, TB ob)\r
-               {\r
-                       if (!AssertionHelper.AssertType (id, expected, ob)) return;\r
-                       Assertion.AssertEquals (id + " yy", expected.yy, ob.yy);\r
-                       TA.AssertEquals (id + " base", expected, ob);\r
-               }\r
-       }\r
-\r
-       public class UnknownAttributeTester\r
-\r
-       {\r
-               [SoapAttribute]\r
-               [XmlAttribute]\r
-               public string aa;\r
-       \r
-               [SoapIgnore]\r
-               [XmlAnyAttribute]\r
-               public XmlAttribute[] extraAtts;\r
-\r
-               //              [XmlText(Type=typeof(XmlNode))]\r
-               //              public XmlNode extraText;\r
-               \r
-               public static void AssertEquals (string id, UnknownAttributeTester exp, UnknownAttributeTester ob)\r
-               {\r
-                       if (!AssertionHelper.AssertType (id, exp, ob)) return;\r
-                       Assertion.AssertEquals (id + " aa", exp.aa, ob.aa);\r
-                       \r
-                       if (!AssertionHelper.AssertType (id + " extraAtts", exp.extraAtts, ob.extraAtts)) return;\r
-                       \r
-                       int p = 0;\r
-                       for (int n=0; n<ob.extraAtts.Length; n++)\r
-                       {\r
-                               XmlAttribute at = ob.extraAtts [n];\r
-                               if (at.NamespaceURI == "http://www.w3.org/2000/xmlns/") continue;\r
-                               Assertion.Assert (id + " extraAtts length", p < exp.extraAtts.Length);\r
-                               AssertionHelper.AssertEqualsXml (id + ".extraAtts " + n, exp.extraAtts [p], ob.extraAtts[n]);\r
-                               p++;\r
-                       }\r
-               }\r
-       }\r
-\r
-       [SoapType(TypeName="UnTestPart", Namespace="mm")]\r
-       [XmlType(TypeName="UnTestPart", Namespace="mm")]\r
-       public class TestPart\r
-       {\r
-               public string name;\r
-               public bool bval;\r
-               \r
-               public static void AssertEquals (string id, TestPart expected, TestPart ob)\r
-               {\r
-                       if (!AssertionHelper.AssertType (id, expected, ob)) return;\r
-                       Assertion.AssertEquals (id + " name", expected.name, ob.name);\r
-                       Assertion.AssertEquals (id + " bval", expected.bval, ob.bval);\r
-               }\r
-       }\r
-\r
-       [SoapType(Namespace="mm")]\r
-       [XmlType(Namespace="mm")]\r
-       public class AnotherTestPart\r
-       {\r
-               [XmlText]\r
-               public long lo;\r
-       }\r
-\r
-       public class UknTestPart : Test\r
-       {\r
-               [XmlElement(IsNullable=true)]\r
-               public string uname;\r
-               public bool uval;\r
-       }\r
-\r
-       public struct OneStruct\r
-       {\r
-               public int aa;\r
-               public string cc;\r
-       }\r
-\r
-//     [XmlType(Namespace="enum_namespace")]\r
-       public enum option \r
-       { \r
-               AA, \r
-               [SoapEnum(Name="xmlBB")]\r
-               [XmlEnum(Name="xmlBB")]\r
-               BB, \r
-               CC, \r
-               DD \r
-       }\r
-\r
-       public class CustomHashtable : IXmlSerializable\r
-       {\r
-               Hashtable data = new Hashtable ();\r
-\r
-               public void Add (string key, string value)\r
-               {\r
-                       data.Add (key, value);\r
-               }\r
-               \r
-               public static void AssertEquals (string id, CustomHashtable exp, CustomHashtable ob)\r
-               {\r
-                       if (!AssertionHelper.AssertType (id, exp, ob)) return;\r
-                       if (!AssertionHelper.AssertType (id, exp.data, ob.data)) return;\r
-                       \r
-                       Assertion.AssertEquals (id + " data Count", exp.data.Count, ob.data.Count);\r
-                       \r
-                       foreach (DictionaryEntry entry in exp.data)\r
-                               Assertion.AssertEquals (entry.Value, ob.data[entry.Key]);\r
-               }\r
-               \r
-               public void ReadXml (XmlReader reader)\r
-               {\r
-                       // Read the element enclosing the object\r
-                       reader.ReadStartElement();\r
-                       reader.MoveToContent ();\r
-\r
-                       // Reads the "data" element\r
-                       reader.ReadStartElement();\r
-                       reader.MoveToContent ();\r
-                       while (reader.NodeType != XmlNodeType.EndElement)\r
-                       {\r
-                               if (reader.NodeType == XmlNodeType.Element)\r
-                               {\r
-                                       string key = reader.LocalName;\r
-                                       data [key] = reader.ReadElementString ();\r
-                               }\r
-                               else\r
-                                       reader.Skip ();\r
-                               reader.MoveToContent ();\r
-                       }\r
-\r
-                       reader.ReadEndElement ();\r
-               }\r
-\r
-               public void WriteXml (XmlWriter writer)\r
-               {\r
-                       writer.WriteStartElement ("data");\r
-                       foreach (DictionaryEntry entry in data) \r
-                       {\r
-                               writer.WriteElementString ((string)entry.Key, (string)entry.Value);\r
-                       }\r
-                       writer.WriteEndElement ();\r
-               }\r
-\r
-               public XmlSchema GetSchema ()\r
-               {\r
-                       XmlSchema s = new XmlSchema ();\r
-                       s.TargetNamespace = "http://www.go-mono.org/schemas";\r
-                       s.Id = "monoschema";\r
-                       XmlSchemaElement e = new XmlSchemaElement ();\r
-                       e.Name = "data";\r
-                       s.Items.Add (e);\r
-                       XmlSchemaComplexType cs = new XmlSchemaComplexType ();\r
-                       XmlSchemaSequence seq = new XmlSchemaSequence ();\r
-                       XmlSchemaAny any = new XmlSchemaAny ();\r
-                       any.MinOccurs = 0;\r
-                       any.MaxOccurs = decimal.MaxValue;\r
-                       seq.Items.Add (any);\r
-                       cs.Particle = seq;\r
-                       e.SchemaType = cs;\r
-                       return s;\r
-               }\r
-       }\r
-}\r
+//
+// ComplexDataStructure.cs
+//
+// Author:
+//     Lluis Sanchez Gual (lluis@ximian.com)
+//
+// (C) 2004 Novell, Inc.
+//
+//
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+using System.Collections;
+using System.ComponentModel; 
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class ComplexDataStructure: Assertion
+       {
+               [Test]
+               [NUnit.Framework.Category("NotDotNet")] // FDBK50639 
+               public void WriteLiteral ()
+               {
+                       Test data = BuildTestObject ();
+
+                       XmlSerializer ss = new XmlSerializer (GetLiteralTypeMapping ());
+                       XmlSerializerNamespaces nams = new XmlSerializerNamespaces ();
+                       StringWriter sw = new StringWriter();
+                       ss.Serialize (sw,data,nams);
+                       string serialized = sw.ToString ();
+                       serialized = XmlSerializerTests.Infoset (serialized);
+
+                       StreamReader sr = new StreamReader ("Test/XmlFiles/literal-data.xml");
+                       string expected = sr.ReadToEnd ();
+                       sr.Close ();
+                       
+                       expected = XmlSerializerTests.Infoset (expected);
+                       AssertEquals (expected, serialized);
+               }
+               
+               [Test]
+               [NUnit.Framework.Category("NotDotNet")]
+               public void ReadLiteral ()
+               {
+                       XmlSerializer ss = new XmlSerializer (GetLiteralTypeMapping ());
+                       XmlSerializerNamespaces nams = new XmlSerializerNamespaces ();
+                       
+                       StreamReader sr = new StreamReader ("Test/XmlFiles/literal-data.xml");
+                       Test data = (Test) ss.Deserialize (sr);
+                       sr.Close ();
+                       
+                       CheckObjectContent (BuildTestObject(), data);
+               }
+               
+               XmlTypeMapping GetLiteralTypeMapping ()
+               {
+                       XmlRootAttribute root = new XmlRootAttribute("rootroot");
+                       Type[] types = new Type[] {typeof(UknTestPart), typeof(AnotherTestPart), typeof(DblStringContainer) };
+                       XmlReflectionImporter ri = new XmlReflectionImporter ();
+                       foreach (Type t in types) ri.IncludeType (t);
+                       return ri.ImportTypeMapping (typeof(Test), root);
+               }
+
+               XmlTypeMapping GetEncodedTypeMapping ()
+               {
+                       SoapReflectionImporter sri = new SoapReflectionImporter ();
+                       sri.IncludeType (typeof(UknTestPart));
+                       sri.IncludeType (typeof(AnotherTestPart));
+                       sri.IncludeType (typeof(DblStringContainer));
+                       return sri.ImportTypeMapping (typeof(Test));
+               }
+               
+               Test BuildTestObject ()
+               {
+                       XmlDocument doc = new XmlDocument();
+
+                       Test t = new UknTestPart();
+                       t.a = 1;
+                       t.b = "hola";
+                       t.bbis = t.b;
+                       t.c = 44;
+                       t.parts = new TestPart[3];
+                       t.parts[0] = new TestPart();
+                       t.parts[0].name = "un";
+                       t.parts[0].bval = true;
+                       t.parts[1] = new TestPart();
+                       t.parts[1].name = "dos";
+                       t.parts[1].bval = false;
+                       t.parts[2] = t.parts[0];
+                       t.part = t.parts[1];
+                       t.strings = new string[] { "un", "dos", null, "tres" };
+                       t.ushorts = new ushort[] { 1,2,3 };
+                       t.ta = new TB();
+                       t.ta.extraTextNodes = new XmlNode[] { doc.CreateTextNode ("AA"), doc.CreateTextNode ("BB") };
+
+                       t.tam2 = new TA[][][]
+                                       {
+                                               new TA[][] { new TA[] {new TA(), new TA()}, new TA[] {new TA(), new TA()}},
+                                               new TA[][] { new TA[] {new TB(), new TA()}, new TA[] {new TB(), new TA()}},
+                                               new TA[][] { new TA[] {new TA(), new TB()}, new TA[] {new TA(), new TA()}} 
+                                       };
+
+                       t.tam3 = t.tam2;
+                       t.flatParts = t.parts;
+
+                       t.flatParts2 = new TA[] {new TA(), new TB(), null, new TB()};
+
+                       t.anot = new AnotherTestPart ();
+                       ((AnotherTestPart)t.anot).lo = 1234567890;
+
+                       t.ob = t.parts[1];
+                       t.ob2 = t.parts[1];
+
+                       XmlElement e1 = doc.CreateElement ("explicitElement");
+                       XmlElement e2 = doc.CreateElement ("subElement");
+                       e2.SetAttribute ("unAtrib","val");
+                       doc.AppendChild (e1);
+                       e1.AppendChild (e2);
+
+                       t.oneElem = e1;
+                       t.oneElem2 = e1;
+                       t.someElems = new XmlNode[3];
+                       t.someElems[0] = e1;
+                       t.someElems[1] = null;
+                       t.someElems[2] = e2;
+
+                       t.extraElems = new XmlElement[1];
+                       t.extraElems[0] = doc.CreateElement ("extra1");
+                       t.extraElems[0].SetAttribute ("val","1");
+
+                       t.extraElems23 = new XmlElement[2];
+                       t.extraElems23[0] = doc.CreateElement ("extra2");
+                       t.extraElems23[0].SetAttribute ("val","2");
+                       t.extraElems23[1] = doc.CreateElement ("extra3");
+                       t.extraElems23[1].SetAttribute ("val","3");
+
+                       t.extraElemsRest = doc.CreateElement ("extra4");
+                       t.extraElemsRest.SetAttribute ("val","4");
+
+                       t.uktester = new UnknownAttributeTester();
+                       t.uktester.aa = "hihi";
+
+                       t.uktester.extraAtts = new XmlAttribute[3];
+                       t.uktester.extraAtts[0] = doc.CreateAttribute ("extraAtt1");
+                       t.uktester.extraAtts[0].Value = "val1";
+                       t.uktester.extraAtts[1] = doc.CreateAttribute ("extraAtt2");
+                       t.uktester.extraAtts[1].Value = "val2";
+                       t.uktester.extraAtts[2] = doc.CreateAttribute ("extraAtt3");
+                       t.uktester.extraAtts[2].Value = "val3";
+
+                       t.ob3 = 12345;
+                       t.ob4 = (float)54321.12;
+
+                       t.op1 = option.AA;
+                       t.opArray = new option[] { option.CC, option.BB, option.AA };
+                       t.ukOpt = option.DD;
+                       t.opAtt = option.BB;
+
+                       t.byteArray = new byte[] { 11,33,55,222 };
+                       t.byteByteArray = new byte[][] { t.byteArray, t.byteArray };
+
+                       t.ttList = new ArrayList();
+                       t.ttList.Add ("two");
+                       t.ttList.Add ("strings");
+                       //                      t.extraText = "Additional text";
+
+                       t.RoList = new ArrayList ();
+                       t.RoList.Add (t.parts[0]);
+                       t.RoList.Add (t.parts[1]);
+
+/*                     t.struc = new OneStruct();
+                       t.struc.aa = 776655;
+                       t.struc.cc = "this is a struct";
+*/
+                       t.multiList = new ArrayList[2];
+                       t.multiList[0] = new ArrayList ();
+                       t.multiList[0].Add (22);
+                       t.multiList[0].Add (33);
+                       t.multiList[1] = new ArrayList ();
+                       t.multiList[1].Add (888);
+                       t.multiList[1].Add (999);
+
+
+                       t.defElem = "theDefValue";
+                       t.defAttr = "theDefValue";
+
+                       t.special = new CustomHashtable ();
+                       t.special.Add ("one","1");
+                       t.special.Add ("two","2");
+                       t.special.Add ("three","3");
+
+                       t.attqname = new XmlQualifiedName ("thename","thenamespace");
+
+                       DblStringContainer dbc = new DblStringContainer ();
+                       dbc.doublestring = new string [][] { null, new string[] {"hello"} };
+                       AnotherTestPart at = new AnotherTestPart ();
+                       at.lo = 567;
+                       dbc.at = at;
+
+                       DblStringContainerAnm dbca = new DblStringContainerAnm ();
+                       dbca.at = dbc;
+                       t.dbscontainer = dbca;
+                       
+                       return t;
+               }
+               
+               void CheckObjectContent (Test exp, Test t)
+               {
+                       AssertEquals ("t.a", exp.a, t.a);
+                       AssertEquals ("t.b", exp.b, t.b);
+                       AssertEquals ("t.bbis", exp.bbis, t.bbis);
+                       AssertEquals ("t.c", exp.c, t.c);
+                       
+                       AssertNotNull ("t.parts", t.parts);
+                       CheckParts ("t.parts", exp.parts, t.parts);
+                       
+                       TestPart.AssertEquals ("t.part", exp.part, t.part);
+                       
+                       AssertionHelper.AssertEqualsArray ("t.strings", exp.strings, t.strings);
+                       AssertionHelper.AssertEqualsArray ("t.ushorts", exp.ushorts, t.ushorts);
+                       
+                       TA.AssertEquals ("t.ta", exp.ta, t.ta);
+
+                       AssertNotNull ("t.tam2", t.tam2);
+                       CheckTaArray ("t.tam2", exp.tam2, t.tam2);
+                       
+                       AssertNotNull ("t.tam3", t.tam3);
+                       CheckTaArray ("t.tam3", exp.tam3, t.tam3);
+                       
+                       AssertNotNull ("t.flatParts", t.flatParts);
+                       CheckParts ("t.flatParts", exp.flatParts, t.flatParts);
+
+                       // Null element is ignored
+                       AssertNotNull ("t.flatParts2", t.flatParts2);
+                       AssertEquals ("t.flatParts2.Length", 3, t.flatParts2.Length);
+                       TA.AssertEquals ("t.flatParts2 0", exp.flatParts2[0], t.flatParts2[0]);
+                       TA.AssertEquals ("t.flatParts2 1", exp.flatParts2[1], t.flatParts2[1]);
+                       TA.AssertEquals ("t.flatParts2 2", exp.flatParts2[3], t.flatParts2[2]);
+                       
+                       AssertNotNull ("t.anot", t.anot);
+                       AssertEquals ("t.anot.lo", ((AnotherTestPart)exp.anot).lo, ((AnotherTestPart)t.anot).lo);
+
+                       TestPart.AssertEquals ("t.ob", exp.ob as TestPart, t.ob as TestPart);
+                       TestPart.AssertEquals ("t.ob2", exp.ob2 as TestPart, t.ob2 as TestPart);
+                       
+                       AssertionHelper.AssertEqualsXml ("t.oneElem", exp.oneElem, t.oneElem);
+                       AssertionHelper.AssertEqualsXml ("t.oneElem2", exp.oneElem2, t.oneElem2);
+                       
+                       // One of the elements was null and it is ignored
+                       AssertNotNull ("t.someElems", t.someElems);
+                       AssertEquals ("t.someElems.Length", 2, t.someElems.Length);
+                       AssertionHelper.AssertEqualsXml ("t.someElems[0]", exp.someElems[0], t.someElems[0]);
+                       AssertionHelper.AssertEqualsXml ("t.someElems[1]", exp.someElems[2], t.someElems[1]);
+
+                       AssertNotNull ("t.extraElems", t.extraElems);
+                       AssertEquals ("t.extraElems.Length", exp.extraElems.Length, t.extraElems.Length);
+                       for (int n=0; n<exp.extraElems.Length; n++)
+                               AssertionHelper.AssertEqualsXml ("t.extraElems[" + n + "]", exp.extraElems[n], t.extraElems[n]);
+                       
+                       AssertNotNull ("t.extraElems23", t.extraElems23);
+                       AssertEquals ("t.extraElems23.Length", exp.extraElems23.Length, t.extraElems23.Length);
+                       for (int n=0; n<t.extraElems23.Length; n++)
+                               AssertionHelper.AssertEqualsXml ("t.extraElems23[" + n + "]", exp.extraElems23[n], t.extraElems23[n]);
+                       
+                       AssertionHelper.AssertEqualsXml ("t.extraElemsRest", exp.extraElemsRest, t.extraElemsRest);
+                       
+                       UnknownAttributeTester.AssertEquals ("t.uktester", exp.uktester, t.uktester);
+
+                       AssertEquals ("t.ob3", exp.ob3, t.ob3);
+                       AssertEquals ("t.ob4", exp.ob4, t.ob4);
+                       AssertEquals ("t.op1", exp.op1, t.op1);
+                       
+                       AssertionHelper.AssertEqualsArray ("t.opArray", exp.opArray, t.opArray);
+
+                       AssertEquals ("t.ukOpt", exp.ukOpt, t.ukOpt);
+                       AssertEquals ("t.opAtt", exp.opAtt, t.opAtt);
+
+                       AssertionHelper.AssertEqualsArray ("t.byteArray", exp.byteArray, t.byteArray);
+                       AssertionHelper.AssertEqualsArray ("t.byteByteArray", exp.byteByteArray, t.byteByteArray);
+                       
+                       AssertNotNull ("t.ttList", t.ttList);
+                       AssertionHelper.AssertEqualsArray ("t.ttList", exp.ttList.ToArray(), t.ttList.ToArray());
+                       
+                       AssertNotNull ("t.RoList", t.RoList);
+                       AssertEquals ("t.RoList.Count", exp.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]);
+                       
+                       AssertEquals ("t.struc.aa", exp.struc.aa, t.struc.aa);
+                       AssertEquals ("t.struc.cc", exp.struc.cc, t.struc.cc);
+
+                       AssertNotNull ("t.multiList", t.multiList);
+                       AssertEquals ("t.multiList.Count", exp.multiList.Length, t.multiList.Length);
+                       for (int n=0; n<exp.multiList.Length; n++)
+                               AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray());
+                       
+                       AssertEquals ("t.defElem", exp.defElem, t.defElem);
+                       AssertEquals ("t.defAttr", exp.defAttr, t.defAttr);
+
+                       CustomHashtable.AssertEquals ("t.special", exp.special, t.special);
+
+                       AssertEquals ("t.attqname", exp.attqname, t.attqname);
+
+                       AssertNotNull ("t.dbscontainer", t.dbscontainer);
+                       DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer;
+                       DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer;
+                       AssertNotNull ("t.dbscontainer.at", tdbca);
+                       
+                       AssertNotNull ("t.dbscontainer.dbca", tdbca);
+                       AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring);
+                       
+                       AnotherTestPart tat = tdbca.at as AnotherTestPart;
+                       AnotherTestPart expat = expdbca.at as AnotherTestPart;
+                       AssertNotNull ("t.dbscontainer.dbca.at", tat);
+                       AssertEquals ("t.dbscontainer.dbca.at.lo", expat.lo, tat.lo);
+               }
+               
+               void CheckParts (string id, TestPart[] exp, TestPart[] parts)
+               {
+                       AssertionHelper.AssertType (id, exp, parts);
+                       AssertEquals (id + " Len", exp.Length, parts.Length);
+                       for (int n=0; n<exp.Length; n++)
+                               TestPart.AssertEquals (id + "[" + n + "]", exp[n], parts[n]);
+               }
+               
+               void CheckTaArray (string id, TA[][][] exp, TA[][][] arr)
+               {
+                       AssertionHelper.AssertType (id, exp, arr);
+                       AssertEquals (id + " Len", exp.Length, arr.Length);
+                       for (int n=0; n<exp.Length; n++)
+                       {
+                               TA[][] tar = arr[n];
+                               TA[][] expar = exp[n];
+                               
+                               AssertionHelper.AssertType (id, expar, tar);
+                               AssertEquals (expar.Length, tar.Length);
+                               
+                               for (int m=0; m<expar.Length; m++)
+                               {
+                                       TA[] tar2 = tar[m];
+                                       TA[] expar2 = expar[m];
+                                       
+                                       AssertionHelper.AssertType (id, expar2, tar2);
+                                       AssertEquals (id, expar2.Length, tar2.Length);
+                                       
+                                       for (int i=0; i<expar2.Length; i++)
+                                               TA.AssertEquals (id + "[" + n + "][" + m + "][" + i + "]", expar2[i], tar2[i]);
+                               }
+                       }
+               }
+       }
+       
+       public class AssertionHelper
+       {
+               public static bool AssertType (string id, object exp, object ob)
+               {
+                       if (exp == null) {
+                               Assertion.AssertNull (id, ob);
+                               return false;
+                       }
+                       else {
+                               Assertion.AssertNotNull (id, ob);
+                               Assertion.AssertEquals (id + " type", exp.GetType(), ob.GetType());
+                               return true;
+                       }
+               }
+               
+               public static void AssertEqualsXml (string id, XmlNode exp, XmlNode ob)
+               {
+                       if (!AssertType (id, exp, ob)) return;
+                       Assertion.AssertEquals (id, XmlSerializerTests.Infoset (exp), XmlSerializerTests.Infoset (ob));
+               }
+               
+               public static void AssertEqualsArray (string id, Array exp, Array ob)
+               {
+                       if (!AssertType (id, exp, ob)) return;
+                       Assertion.AssertEquals (id + " Length", exp.GetLength(0), ob.GetLength(0));
+                       for (int n=0; n<exp.GetLength(0); n++) {
+                               object it = exp.GetValue(n);
+                               if (it is Array) 
+                                       AssertEqualsArray (id + "[" + n + "]", it as Array, ob.GetValue(n) as Array);
+                               else
+                                       Assertion.AssertEquals (id + "[" + n + "]", it, ob.GetValue(n));
+                       }
+               }
+       }
+       
+       [XmlType(TypeName="")]
+       [XmlRoot(ElementName="aaaaaa",Namespace="")]
+       [XmlInclude(typeof(UknTestPart))]
+       [SoapInclude(typeof(UknTestPart))]
+       public class Test
+       {
+               //              public option op;elem.SchemaTypeName
+               public object anot;
+
+               [SoapElement(ElementName="suba")]
+               [XmlElement(ElementName="suba",Namespace="kk")]
+               public int a;
+
+               public string b;
+               public string bbis;
+
+               [SoapAttribute]
+               [XmlAttribute (Namespace="attribns")]
+               public byte c;
+
+               [XmlElement(Namespace="oo")]
+               public TestPart part;
+
+               public TA ta;
+
+               public TestPart[] parts;
+
+               [SoapElement(ElementName="multita")]
+               [XmlArray(ElementName="multita")]
+                       //              [XmlArrayItem(ElementName="itema",NestingLevel=1)]
+               [XmlArrayItem(ElementName="itema",Type=typeof(TA),NestingLevel=1)]
+               [XmlArrayItem(ElementName="itemb",Type=typeof(TB),NestingLevel=1)]
+               public TA[][] tam = new TA[][] { new TA[] {new TA(), new TB()}, new TA[] {new TA(), new TA()}};
+
+//             [SoapElement(ElementName="multita2")]
+               [SoapIgnore]
+               [XmlArray(ElementName="multita2")]
+               [XmlArrayItem(ElementName="data1",NestingLevel=0)]
+
+               [XmlArrayItem(ElementName="data2",NestingLevel=1,Namespace="da2")]
+               [XmlArrayItem(ElementName="data3a",Type=typeof(TA),NestingLevel=2,Namespace="da3")]
+               [XmlArrayItem(ElementName="data3b",Type=typeof(TB),NestingLevel=2,Namespace="da3")]
+               public TA[][][] tam2;
+
+               [SoapIgnore]
+               public TA[][][] tam3;
+
+               [SoapElement(IsNullable=true)]
+               [XmlElement(IsNullable=true)]
+               public string mayBeNull;
+
+               public string[] strings;
+
+               [XmlArray(Namespace="arrayNamespace")]
+               public ushort[] ushorts;
+
+               [XmlElement]
+               public TestPart[] flatParts;
+
+               [SoapElement (ElementName="flatTAs")]
+               [XmlElement (ElementName="flatTAs")]
+               public TA[] flatParts2;
+
+               public object ob;
+
+               [XmlElement (Namespace="uimp")]
+               public object ob2;
+
+               public object ob3;
+               public object ob4;
+
+               [SoapIgnore]
+               public XmlElement oneElem;
+
+               [SoapIgnore]
+               [XmlElement (ElementName="unElement", Namespace="elemns")]
+               public XmlElement oneElem2;
+
+               [SoapIgnore]
+               [XmlElement (ElementName="unsElements", Namespace="elemns")]
+               public XmlNode[] someElems;
+
+               [SoapIgnore]
+               [XmlAnyElement ("extra1")]
+               public XmlElement[] extraElems;
+
+               [SoapIgnore]
+               [XmlAnyElement ("extra2")]
+               [XmlAnyElement ("extra3")]
+               [XmlAnyElement ("extra3","nnn")]
+               public XmlElement[] extraElems23;
+
+               [SoapIgnore]
+               [XmlAnyElement]
+               public XmlElement extraElemsRest;
+
+               public UnknownAttributeTester uktester;
+
+               public option op1;
+               public option[] opArray;
+               public object ukOpt;
+
+               [XmlAttribute]
+               [SoapIgnore]
+               public option opAtt;
+
+
+               public byte[] byteArray;
+               [SoapIgnore]
+               public byte[][] byteByteArray;
+
+               [XmlElement(Type=typeof(string))]
+               [XmlElement(ElementName="kk",Type=typeof(int))]
+               public object[] tt = new object[] { "aa",22 };
+
+               public ArrayList ttList;
+
+               ArrayList roList;
+               public ArrayList RoList
+               {
+                       get { return roList; }
+                       set { roList = value; }
+               }
+
+               [SoapIgnore]
+//             [XmlIgnore]
+               public ArrayList[] multiList;
+
+               [SoapIgnore]
+               [XmlIgnore]
+               public OneStruct struc;
+
+               [DefaultValue("theDefValue")]
+               public string defElem;
+
+               [XmlAttribute]
+               [DefaultValue("theDefValue")]
+               public string defAttr;
+
+               [XmlText (Type=typeof(string))]
+               [XmlElement (Type=typeof(int))]
+               public object[] xmltext = new object[] {"aa",33,"bb",776};
+
+               [SoapIgnore]
+               public CustomHashtable special;
+
+               [XmlAttribute]
+               public XmlQualifiedName attqname;
+
+               [XmlAttribute]
+               public DateTime[] arrayAttribute;
+
+               [XmlArray (Namespace="mm")]
+               public string[][] dummyStringArray = new string[][] {null,null};
+               
+               [XmlElement (Namespace="mm")]
+               public DblStringContainerAnm dbscontainer;
+       }
+
+       public class DblStringContainerAnm
+       {
+               public object at;
+       }
+
+       [XmlType(Namespace="mm")]
+       public class DblStringContainer
+       {
+               [XmlArrayItem (NestingLevel=1, IsNullable=true)]
+               public string [][] doublestring;
+               public object at;
+       }
+
+       [SoapType(TypeName="TC")]
+       [XmlType(TypeName="TC")]
+       [XmlInclude(typeof(TB))]
+       [SoapInclude(typeof(TB))]
+       public class TA
+       {
+               public int xx = 1;
+
+               [XmlText]
+               [SoapIgnore]
+               public XmlNode[] extraTextNodes;
+               
+               public static void AssertEquals (string id, TA expected, TA ob)
+               {
+                       if (!AssertionHelper.AssertType (id, expected, ob)) return;
+                       Assertion.AssertEquals (id + " xx", expected.xx, ob.xx);
+                       // TODO: extraTextNodes
+               }
+       }
+
+       public class TB: TA
+       {
+               public int yy = 2;
+               
+               public static void AssertEquals (string id, TB expected, TB ob)
+               {
+                       if (!AssertionHelper.AssertType (id, expected, ob)) return;
+                       Assertion.AssertEquals (id + " yy", expected.yy, ob.yy);
+                       TA.AssertEquals (id + " base", expected, ob);
+               }
+       }
+
+       public class UnknownAttributeTester
+
+       {
+               [SoapAttribute]
+               [XmlAttribute]
+               public string aa;
+       
+               [SoapIgnore]
+               [XmlAnyAttribute]
+               public XmlAttribute[] extraAtts;
+
+               //              [XmlText(Type=typeof(XmlNode))]
+               //              public XmlNode extraText;
+               
+               public static void AssertEquals (string id, UnknownAttributeTester exp, UnknownAttributeTester ob)
+               {
+                       if (!AssertionHelper.AssertType (id, exp, ob)) return;
+                       Assertion.AssertEquals (id + " aa", exp.aa, ob.aa);
+                       
+                       if (!AssertionHelper.AssertType (id + " extraAtts", exp.extraAtts, ob.extraAtts)) return;
+                       
+                       int p = 0;
+                       for (int n=0; n<ob.extraAtts.Length; n++)
+                       {
+                               XmlAttribute at = ob.extraAtts [n];
+                               if (at.NamespaceURI == "http://www.w3.org/2000/xmlns/") continue;
+                               Assertion.Assert (id + " extraAtts length", p < exp.extraAtts.Length);
+                               AssertionHelper.AssertEqualsXml (id + ".extraAtts " + n, exp.extraAtts [p], ob.extraAtts[n]);
+                               p++;
+                       }
+               }
+       }
+
+       [SoapType(TypeName="UnTestPart", Namespace="mm")]
+       [XmlType(TypeName="UnTestPart", Namespace="mm")]
+       public class TestPart
+       {
+               public string name;
+               public bool bval;
+               
+               public static void AssertEquals (string id, TestPart expected, TestPart ob)
+               {
+                       if (!AssertionHelper.AssertType (id, expected, ob)) return;
+                       Assertion.AssertEquals (id + " name", expected.name, ob.name);
+                       Assertion.AssertEquals (id + " bval", expected.bval, ob.bval);
+               }
+       }
+
+       [SoapType(Namespace="mm")]
+       [XmlType(Namespace="mm")]
+       public class AnotherTestPart
+       {
+               [XmlText]
+               public long lo;
+       }
+
+       public class UknTestPart : Test
+       {
+               [XmlElement(IsNullable=true)]
+               public string uname;
+               public bool uval;
+       }
+
+       public struct OneStruct
+       {
+               public int aa;
+               public string cc;
+       }
+
+//     [XmlType(Namespace="enum_namespace")]
+       public enum option 
+       { 
+               AA, 
+               [SoapEnum(Name="xmlBB")]
+               [XmlEnum(Name="xmlBB")]
+               BB, 
+               CC, 
+               DD 
+       }
+
+       public class CustomHashtable : IXmlSerializable
+       {
+               Hashtable data = new Hashtable ();
+
+               public void Add (string key, string value)
+               {
+                       data.Add (key, value);
+               }
+               
+               public static void AssertEquals (string id, CustomHashtable exp, CustomHashtable ob)
+               {
+                       if (!AssertionHelper.AssertType (id, exp, ob)) return;
+                       if (!AssertionHelper.AssertType (id, exp.data, ob.data)) return;
+                       
+                       Assertion.AssertEquals (id + " data Count", exp.data.Count, ob.data.Count);
+                       
+                       foreach (DictionaryEntry entry in exp.data)
+                               Assertion.AssertEquals (entry.Value, ob.data[entry.Key]);
+               }
+               
+               public void ReadXml (XmlReader reader)
+               {
+                       // Read the element enclosing the object
+                       reader.ReadStartElement();
+                       reader.MoveToContent ();
+
+                       // Reads the "data" element
+                       reader.ReadStartElement();
+                       reader.MoveToContent ();
+                       while (reader.NodeType != XmlNodeType.EndElement)
+                       {
+                               if (reader.NodeType == XmlNodeType.Element)
+                               {
+                                       string key = reader.LocalName;
+                                       data [key] = reader.ReadElementString ();
+                               }
+                               else
+                                       reader.Skip ();
+                               reader.MoveToContent ();
+                       }
+
+                       reader.ReadEndElement ();
+               }
+
+               public void WriteXml (XmlWriter writer)
+               {
+                       writer.WriteStartElement ("data");
+                       foreach (DictionaryEntry entry in data) 
+                       {
+                               writer.WriteElementString ((string)entry.Key, (string)entry.Value);
+                       }
+                       writer.WriteEndElement ();
+               }
+
+               public XmlSchema GetSchema ()
+               {
+                       XmlSchema s = new XmlSchema ();
+                       s.TargetNamespace = "http://www.go-mono.org/schemas";
+                       s.Id = "monoschema";
+                       XmlSchemaElement e = new XmlSchemaElement ();
+                       e.Name = "data";
+                       s.Items.Add (e);
+                       XmlSchemaComplexType cs = new XmlSchemaComplexType ();
+                       XmlSchemaSequence seq = new XmlSchemaSequence ();
+                       XmlSchemaAny any = new XmlSchemaAny ();
+                       any.MinOccurs = 0;
+                       any.MaxOccurs = decimal.MaxValue;
+                       seq.Items.Add (any);
+                       cs.Particle = seq;
+                       e.SchemaType = cs;
+                       return s;
+               }
+       }
+}
index a863956f0952f868d63d21580f7202841dadcc35..c7205f6557ddcbf7cde6ea3f71e1b167bfcc7384 100644 (file)
-//\r
-// System.Xml.DeserializationTests\r
-//\r
-// Author:\r
-//     Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>\r
-//\r
-// (C) 2003 Atsushi Enomoto\r
-//\r
-//\r
-using System;\r
-using System.Globalization;\r
-using System.IO;\r
-using System.Xml;\r
-using System.Xml.Serialization;\r
-using NUnit.Framework;\r
-using MonoTests.System.Xml.TestClasses;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       public class Sample\r
-       {\r
-               public string Text;\r
-               public string [] ArrayText;\r
-       }\r
-\r
-       [TestFixture]\r
-       public class DeserializationTests\r
-       {\r
-               const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";\r
-               const string XmlSchemaInstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";\r
-               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";\r
-               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";\r
-               const string ANamespace = "some:urn";\r
-               const string AnotherNamespace = "another:urn";\r
-\r
-               object result;\r
-\r
-               private object Deserialize (Type t, string xml)\r
-               {\r
-                       StringReader sr = new StringReader (xml);\r
-                       XmlReader xr = new XmlTextReader (sr);\r
-                       return Deserialize (t, xr);\r
-               }\r
-\r
-               private object Deserialize (Type t, string xml, string defaultNamespace)\r
-               {\r
-                       StringReader sr = new StringReader (xml);\r
-                       XmlReader xr = new XmlTextReader (sr);\r
-                       return Deserialize (t, xr, defaultNamespace);\r
-               }\r
-\r
-               private object Deserialize (Type t, string xml, XmlAttributeOverrides ao)\r
-               {\r
-                       StringReader sr = new StringReader (xml);\r
-                       XmlReader xr = new XmlTextReader (sr);\r
-                       return Deserialize (t, xr, ao);\r
-               }\r
-\r
-               private object DeserializeEncoded (Type t, string xml)\r
-               {\r
-                       StringReader sr = new StringReader (xml);\r
-                       XmlReader xr = new XmlTextReader (sr);\r
-                       return DeserializeEncoded (t, xr);\r
-               }\r
-\r
-               private object Deserialize (Type t, XmlReader xr)\r
-               {\r
-                       XmlSerializer ser = new XmlSerializer (t);\r
-                       result = ser.Deserialize (xr);\r
-                       return result;\r
-               }\r
-\r
-               private object Deserialize (Type t, XmlReader xr, string defaultNamespace)\r
-               {\r
-                       XmlSerializer ser = new XmlSerializer (t, defaultNamespace);\r
-                       result = ser.Deserialize (xr);\r
-                       return result;\r
-               }\r
-\r
-               private object Deserialize (Type t, XmlReader xr, XmlAttributeOverrides ao)\r
-               {\r
-                       XmlSerializer ser = new XmlSerializer (t, ao);\r
-                       result = ser.Deserialize (xr);\r
-                       return result;\r
-               }\r
-\r
-               private object DeserializeEncoded (Type t, XmlReader xr)\r
-               {\r
-                       SoapReflectionImporter im = new SoapReflectionImporter ();\r
-                       XmlTypeMapping tm = im.ImportTypeMapping (t);\r
-                       XmlSerializer ser = new XmlSerializer (tm);\r
-                       result = ser.Deserialize (xr);\r
-                       return result;\r
-               }\r
-\r
-               [Test]\r
-               public void SimpleDeserialize ()\r
-               {\r
-                       Deserialize (typeof (Sample), "<Sample><Text>Test.</Text></Sample>");\r
-                       Assert.AreEqual (typeof (Sample), result.GetType ());\r
-                       Sample sample = result as Sample;\r
-                       Assert.AreEqual ("Test.", sample.Text);\r
-               }\r
-\r
-               [Test]\r
-               public void DeserializeInt ()\r
-               {\r
-                       Deserialize (typeof (int), "<int>10</int>");\r
-                       Assert.AreEqual (typeof (int), result.GetType ());\r
-                       Assert.AreEqual (10, result);\r
-               }\r
-\r
-               [Test]\r
-               public void DeserializeSimpleArray ()\r
-               {\r
-                       Deserialize (typeof (Sample), "<Sample><ArrayText><string>Test1</string><string>Test2</string></ArrayText></Sample>");\r
-                       Assert.AreEqual (typeof (Sample), result.GetType ());\r
-                       Sample sample = result as Sample;\r
-                       Assert.AreEqual ("Test1", sample.ArrayText[0]);\r
-                       Assert.AreEqual ("Test2", sample.ArrayText[1]);\r
-               }\r
-\r
-               [Test]\r
-               public void DeserializeEmptyEnum ()\r
-               {\r
-                       Field f = Deserialize (typeof (Field), "<field modifiers=\"\" />") as Field;\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers);\r
-               }\r
-               \r
-               [Test]\r
-               public void DeserializePrivateCollection ()\r
-               {\r
-                       MemoryStream ms = new MemoryStream ();\r
-                       Container c = new Container();\r
-                       c.Items.Add(1);\r
-                       \r
-                       XmlSerializer serializer = new XmlSerializer(typeof(Container));\r
-                       serializer.Serialize(ms, c);\r
-                       \r
-                       ms.Position = 0;\r
-                       c = (Container) serializer.Deserialize (ms);\r
-                       Assert.AreEqual (1, c.Items[0]);\r
-               }\r
-               \r
-               [Test]\r
-               [Category("NotDotNet")]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void DeserializeEmptyPrivateCollection ()\r
-               {\r
-                       MemoryStream ms = new MemoryStream ();\r
-                       Container2 c = new Container2(true);\r
-                       c.Items.Add(1);\r
-                       \r
-                       XmlSerializer serializer = new XmlSerializer(typeof(Container2));\r
-                       serializer.Serialize(ms, c);\r
-                       \r
-                       ms.Position = 0;\r
-                       c = (Container2) serializer.Deserialize (ms);\r
-               }\r
-               \r
-               [Test]\r
-               [Category("NotDotNet")]\r
-               public void DeserializeArrayReferences ()\r
-               {\r
-                       string s = "<Sample xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";\r
-                       s += "<ArrayText xmlns:n3=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"n3:Array\" n3:arrayType=\"xsd:string[2]\">";\r
-                       s += "<item href=\"#id-606830706\"></item>";\r
-                       s += "<item xsi:type=\"xsd:string\">Hola</item>";\r
-                       s += "</ArrayText>";\r
-                       s += "<string id=\"id-606830706\" xsi:type=\"xsd:string\">Adeu</string>";\r
-                       s += "</Sample>";\r
-                       DeserializeEncoded (typeof(Sample), s);\r
-               }\r
-               \r
-               \r
-               [Test]\r
-               public void TestDeserializeXmlNodeArray ()\r
-               {\r
-                       object ob = Deserialize (typeof(object), "<anyType at=\"1\"><elem1/><elem2/></anyType>");\r
-                       Assert.IsTrue (ob is XmlNode[], "Is node array");\r
-                       \r
-                       XmlNode[] nods = (XmlNode[]) ob;\r
-                       Assert.AreEqual (3, nods.Length, "lengh");\r
-                       Assert.IsTrue (nods[0] is XmlAttribute, "#1");\r
-                       Assert.AreEqual ("at", ((XmlAttribute) nods[0]).LocalName, "#2");\r
-                       Assert.AreEqual ("1", ((XmlAttribute) nods[0]).Value, "#3");\r
-                       Assert.IsTrue (nods[1] is XmlElement, "#4");\r
-                       Assert.AreEqual ("elem1", ((XmlElement) nods[1]).LocalName, "#5");\r
-                       Assert.IsTrue (nods[2] is XmlElement, "#6");\r
-                       Assert.AreEqual ("elem2", ((XmlElement) nods[2]).LocalName, "#7");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeXmlElement ()\r
-               {\r
-                       object ob = Deserialize (typeof(XmlElement), "<elem/>");\r
-                       Assert.IsTrue (ob is XmlElement, "#1");\r
-                       Assert.AreEqual ("elem", ((XmlElement) ob).LocalName, "#2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeXmlCDataSection ()\r
-               {\r
-                       CDataContainer c = (CDataContainer) Deserialize (typeof(CDataContainer), "<CDataContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><cdata><![CDATA[data section contents]]></cdata></CDataContainer>");\r
-                       Assert.IsNotNull (c.cdata, "#1");\r
-                       Assert.AreEqual ("data section contents", c.cdata.Value, "#2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeXmlNode ()\r
-               {\r
-                       NodeContainer c = (NodeContainer) Deserialize (typeof(NodeContainer), "<NodeContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><node>text</node></NodeContainer>");\r
-                       Assert.IsTrue (c.node is XmlText, "#1");\r
-                       Assert.AreEqual ("text", c.node.Value, "#2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeChoices ()\r
-               {\r
-                       Choices ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceZero>choice text</ChoiceZero></Choices>");\r
-                       Assert.AreEqual ("choice text", ch.MyChoice, "#A1");\r
-                       Assert.AreEqual (ItemChoiceType.ChoiceZero, ch.ItemType, "#A2");\r
-                       \r
-                       ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceOne>choice text</ChoiceOne></Choices>");\r
-                       Assert.AreEqual ("choice text", ch.MyChoice, "#B1");\r
-                       Assert.AreEqual (ItemChoiceType.StrangeOne, ch.ItemType, "#B2");\r
-                       \r
-                       ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceTwo>choice text</ChoiceTwo></Choices>");\r
-                       Assert.AreEqual ("choice text", ch.MyChoice, "#C1");\r
-                       Assert.AreEqual (ItemChoiceType.ChoiceTwo, ch.ItemType, "#C2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeNamesWithSpaces ()\r
-               {\r
-                       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>");\r
-                       Assert.AreEqual (4, ts.elem, "#1");\r
-                       Assert.AreEqual (5, ts.attr, "#2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeDefaults ()\r
-               {\r
-                       ListDefaults d2 = (ListDefaults) Deserialize (typeof(ListDefaults), "<root/>");\r
-\r
-                       Assert.IsNotNull (d2.list2, "#A1");\r
-                       Assert.IsNull (d2.list3, "#A2");\r
-                       Assert.IsNull (d2.list4, "#A3");\r
-                       Assert.IsNotNull (d2.list5, "#A4");\r
-                       Assert.IsNotNull (d2.ed, "#A5");\r
-                       Assert.IsNotNull (d2.str, "#A6");\r
-\r
-                       d2 = (ListDefaults) Deserialize (typeof(ListDefaults), "<root></root>");\r
-\r
-                       Assert.IsNotNull (d2.list2, "#B1");\r
-                       Assert.IsNull (d2.list3, "#B2");\r
-                       Assert.IsNull (d2.list4, "#B3");\r
-                       Assert.IsNotNull (d2.list5, "#B4");\r
-                       Assert.IsNotNull (d2.ed, "#B5");\r
-                       Assert.IsNotNull (d2.str, "#B6");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeChoiceArray ()\r
-               {\r
-                       CompositeValueType v = (CompositeValueType) Deserialize (typeof(CompositeValueType), "<?xml version=\"1.0\" encoding=\"utf-16\"?><CompositeValueType xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><In>1</In><Es>2</Es></CompositeValueType>");\r
-                       Assert.IsNotNull (v.Items, "#1");\r
-                       Assert.IsNotNull (v.ItemsElementName, "#2");\r
-                       Assert.AreEqual (2, v.Items.Length, "#3");\r
-                       Assert.AreEqual (2, v.ItemsElementName.Length, "#4");\r
-                       Assert.AreEqual (1, v.Items[0], "#5");\r
-                       Assert.AreEqual (2, v.Items[1], "#6");\r
-                       Assert.AreEqual (ItemsChoiceType.In, v.ItemsElementName[0], "#7");\r
-                       Assert.AreEqual (ItemsChoiceType.Es, v.ItemsElementName[1], "#8");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeCollection ()\r
-               {\r
-                       string s0 = "";\r
-                       s0+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s0+="           <Entity Name='node1'/>";\r
-                       s0+="           <Entity Name='node2'/>";\r
-                       s0+="   </ArrayOfEntity>";\r
-                       \r
-                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s0);\r
-                       Assert.IsNotNull (col, "#1");\r
-                       Assert.AreEqual (2, col.Count, "#2");\r
-                       Assert.IsNull (col[0].Parent, "#3");\r
-                       Assert.IsNull (col[1].Parent, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeEmptyCollection ()\r
-               {\r
-                       string s1 = "";\r
-                       s1+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       \r
-                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s1);\r
-                       Assert.IsNotNull (col, "#A1");\r
-                       Assert.AreEqual (0, col.Count, "#A2");\r
-                       \r
-                       string s1_1 = "";\r
-                       s1_1+=" <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s1_1+=" </ArrayOfEntity>";\r
-                       \r
-                       col = (EntityCollection) Deserialize (typeof(EntityCollection), s1_1);\r
-                       Assert.IsNotNull (col, "#B1");\r
-                       Assert.AreEqual (0, col.Count, "#B2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeNilCollectionIsNotNull ()\r
-               {\r
-                       string s2 = "";\r
-                       s2+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>";\r
-                       \r
-                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s2);\r
-                       Assert.IsNotNull (col, "#1");\r
-                       Assert.AreEqual (0, col.Count, "#2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectCollections ()\r
-               {\r
-                       string s3 = "";\r
-                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection1>";\r
-                       s3+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection2>";\r
-                       s3+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection3>";\r
-                       s3+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection4>";\r
-                       s3+="</Container>";\r
-                       \r
-                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s3);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNotNull (cont.Collection1, "#B1");\r
-                       Assert.AreEqual (2, cont.Collection1.Count, "#B2");\r
-                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");\r
-                       Assert.AreEqual ("assigned", cont.Collection1[0].Parent, "#B4");\r
-                       Assert.AreEqual ("assigned", cont.Collection1[1].Parent, "#B5");\r
-\r
-                       Assert.IsNotNull (cont.Collection2, "#C1");\r
-                       Assert.AreEqual (2, cont.Collection2.Count, "#C2");\r
-                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");\r
-                       Assert.AreEqual ("assigned", cont.Collection2[0].Parent, "#C4");\r
-                       Assert.AreEqual ("assigned", cont.Collection2[1].Parent, "#C5");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#D1");\r
-                       Assert.AreEqual (2, cont.Collection3.Count, "#D2");\r
-                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");\r
-                       Assert.AreEqual ("root", cont.Collection3[0].Parent, "#D4");\r
-                       Assert.AreEqual ("root", cont.Collection3[1].Parent, "#D5");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#E1");\r
-                       Assert.AreEqual (2, cont.Collection4.Count, "#E2");\r
-                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");\r
-                       Assert.AreEqual ("root", cont.Collection4[0].Parent, "#E4");\r
-                       Assert.AreEqual ("root", cont.Collection4[1].Parent, "#E5");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeEmptyObjectCollections ()\r
-               {\r
-                       string s4 = "";\r
-                       s4+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s4+="</Container>";\r
-                       \r
-                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s4);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNotNull (cont.Collection1, "#B1");\r
-                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");\r
-                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");\r
-\r
-                       Assert.IsNotNull (cont.Collection2, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");\r
-                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#D1");\r
-                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");\r
-                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#E1");\r
-                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");\r
-                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserializeObjectNilCollectionsAreNotNull ()\r
-               {\r
-                       string s5 = "";\r
-                       s5+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s5+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="</Container>";\r
-                       \r
-                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s5);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNotNull (cont.Collection1, "#B1");\r
-                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");\r
-                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");\r
-\r
-                       Assert.IsNotNull (cont.Collection2, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");\r
-                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#D1");\r
-                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");\r
-                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#E1");\r
-                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");\r
-                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectEmptyCollections ()\r
-               {\r
-                       string s6 = "";\r
-                       s6+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s6+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="</Container>";\r
-                       \r
-                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s6);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNotNull (cont.Collection1, "#B1");\r
-                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");\r
-                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");\r
-\r
-                       Assert.IsNotNull (cont.Collection2, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");\r
-                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#D1");\r
-                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");\r
-                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#E1");\r
-                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");\r
-                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectEmptyArrays ()\r
-               {\r
-                       string s6 = "";\r
-                       s6+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s6+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       s6+="</Container>";\r
-                       \r
-                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s6);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNotNull (cont.Collection1, "#B1");\r
-                       Assert.AreEqual (0, cont.Collection1.Length, "#B2");\r
-\r
-                       Assert.IsNotNull (cont.Collection2, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection2.Length, "#C2");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#D1");\r
-                       Assert.AreEqual (0, cont.Collection3.Length, "#D2");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#E1");\r
-                       Assert.AreEqual (0, cont.Collection4.Length, "#E2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeEmptyObjectArrays ()\r
-               {\r
-                       string s4 = "";\r
-                       s4+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s4+="</Container>";\r
-                       \r
-                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s4);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNull (cont.Collection1, "#B1");\r
-                       Assert.IsNull (cont.Collection2, "#B2");\r
-\r
-                       Assert.IsNotNull (cont.Collection3, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection3.Length, "#C2");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#D1");\r
-                       Assert.AreEqual (0, cont.Collection4.Length, "#D2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectNilArrays ()\r
-               {\r
-                       string s5 = "";\r
-                       s5+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s5+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";\r
-                       s5+="</Container>";\r
-                       \r
-                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s5);\r
-                       Assert.IsNotNull (cont, "#A1");\r
-\r
-                       Assert.IsNull (cont.Collection1, "#B1");\r
-                       Assert.IsNull (cont.Collection2, "#B2");\r
-                       Assert.IsNull (cont.Collection3, "#B3");\r
-\r
-                       Assert.IsNotNull (cont.Collection4, "#C1");\r
-                       Assert.AreEqual (0, cont.Collection4.Length, "#C2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeEmptyArray ()\r
-               {\r
-                       string s1 = "";\r
-                       s1+="<ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";\r
-                       \r
-                       Entity[] col = (Entity[]) Deserialize (typeof(Entity[]), s1);\r
-                       Assert.IsNotNull (col, "#A1");\r
-                       Assert.AreEqual (0, col.Length, "#A2");\r
-                       \r
-                       string s1_1 = "";\r
-                       s1_1+=" <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s1_1+=" </ArrayOfEntity>";\r
-                       \r
-                       col = (Entity[]) Deserialize (typeof(Entity[]), s1_1);\r
-                       Assert.IsNotNull (col, "#B1");\r
-                       Assert.AreEqual (0, col.Length, "#B2");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeNilArray ()\r
-               {\r
-                       string s2 = "";\r
-                       s2 += "<ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>";\r
-                       \r
-                       Entity[] col = (Entity[]) Deserialize (typeof(Entity[]), s2);\r
-                       Assert.IsNull (col, "#1");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectWithReadonlyCollection ()\r
-               {\r
-                       string s3 = "";\r
-                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="   <Collection1>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection1>";\r
-                       s3+="</Container>";\r
-                       \r
-                       ObjectWithReadonlyCollection cont = (ObjectWithReadonlyCollection) Deserialize (typeof(ObjectWithReadonlyCollection), s3);\r
-                       Assert.IsNotNull (cont, "#1");\r
-                       Assert.IsNotNull (cont.Collection1, "#2");\r
-                       Assert.AreEqual (2, cont.Collection1.Count, "#3");\r
-                       Assert.AreEqual ("root", cont.Collection1.Container, "#4");\r
-                       Assert.AreEqual ("root", cont.Collection1[0].Parent, "#5");\r
-                       Assert.AreEqual ("root", cont.Collection1[1].Parent, "#6");\r
-               }\r
-               \r
-               [Test]\r
-               [ExpectedException (typeof(InvalidOperationException))]\r
-               public void TestDeserializeObjectWithReadonlyNulCollection ()\r
-               {\r
-                       string s3 = "";\r
-                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="   <Collection1>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection1>";\r
-                       s3+="</Container>";\r
-                       \r
-                       Deserialize (typeof(ObjectWithReadonlyNulCollection), s3);\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDeserializeObjectWithReadonlyArray ()\r
-               {\r
-                       string s3 = "";\r
-                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       s3+="   <Collection1>";\r
-                       s3+="           <Entity Name='node1'/>";\r
-                       s3+="           <Entity Name='node2'/>";\r
-                       s3+="   </Collection1>";\r
-                       s3+="</Container>";\r
-                       \r
-                       ObjectWithReadonlyArray cont = (ObjectWithReadonlyArray) Deserialize (typeof(ObjectWithReadonlyArray), s3);\r
-                       Assert.IsNotNull (cont, "#1");\r
-                       Assert.IsNotNull (cont.Collection1, "#2");\r
-                       Assert.AreEqual (0, cont.Collection1.Length, "#3");\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_EnumDefaultValue ()\r
-               {\r
-                       EnumDefaultValue e;\r
-\r
-                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue />");\r
-                       Assert.AreEqual (0, (int) e, "#1");\r
-\r
-                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue> e3</EnumDefaultValue>");\r
-                       Assert.AreEqual (EnumDefaultValue.e3, e, "#2");\r
-\r
-                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue>e1 e2</EnumDefaultValue>");\r
-                       Assert.AreEqual (EnumDefaultValue.e3, e, "#3");\r
-\r
-                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue>  e1   e2 </EnumDefaultValue>");\r
-                       Assert.AreEqual (EnumDefaultValue.e1 | EnumDefaultValue.e2, e, "#4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_EnumDefaultValueNF ()\r
-               {\r
-                       EnumDefaultValueNF e;\r
-\r
-                       e = (EnumDefaultValueNF) Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>e3</EnumDefaultValueNF>");\r
-                       Assert.AreEqual (EnumDefaultValueNF.e3, e, "#A1");\r
-\r
-                       try {\r
-                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF />");\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.InnerException, "#B3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("''") != -1, "#B6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#B7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>e1 e3</EnumDefaultValueNF>");\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");\r
-                               Assert.IsNotNull (ex.InnerException, "#C3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#C5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'e1 e3'") != -1, "#C6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#C7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF> e3</EnumDefaultValueNF>");\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.InnerException, "#D3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("' e3'") != -1, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#D7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF> </EnumDefaultValueNF>");\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");\r
-                               Assert.IsNotNull (ex.InnerException, "#E3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#E5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("' '") != -1, "#E6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#E7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>1</EnumDefaultValueNF>");\r
-                               Assert.Fail ("#F1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");\r
-                               Assert.IsNotNull (ex.InnerException, "#F3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#F5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#F6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#F7");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // DefaultValue should not be used when deserializing\r
-               public void TestDeserialize_Field ()\r
-               {\r
-                       Field f = null;\r
-\r
-                       f = (Field) Deserialize (typeof (Field),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='' flag2='' flag4='' modifiers='public' modifiers2='public' modifiers4='public' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags1, "#A1");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags2, "#A2");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags3, "#A3");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#A4");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#A5");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#A6");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#A7");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#A8");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#A9");\r
-                       Assert.IsNull (f.Names, "#A10");\r
-                       Assert.IsNull (f.Street, "#A11");\r
-\r
-                       f = (Field) Deserialize (typeof (Field),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag3='two' flag4='' modifiers='protected' modifiers2='public' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags1, "#B1");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags2, "#B2");\r
-                       Assert.AreEqual (FlagEnum.e2, f.Flags3, "#B3");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#B4");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers, "#B5");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#B6");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#B7");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#B8");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#B9");\r
-                       Assert.IsNull (f.Names, "#B10");\r
-                       Assert.IsNull (f.Street, "#B11");\r
-\r
-                       f = (Field) Deserialize (typeof (Field),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='two' flag2='two' flag4='' modifiers='public' modifiers2='protected' modifiers3='protected' modifiers4='public' modifiers5='protected' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));\r
-                       Assert.AreEqual (FlagEnum.e2, f.Flags1, "#C1");\r
-                       Assert.AreEqual (FlagEnum.e2, f.Flags2, "#C2");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags3, "#C3");\r
-                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#C4");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#C5");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers2, "#C6");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers3, "#C7");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#C8");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers5, "#C9");\r
-                       Assert.IsNull (f.Names, "#C10");\r
-                       Assert.IsNull (f.Street, "#C11");\r
-\r
-                       try {\r
-                               f = (Field) Deserialize (typeof (Field),\r
-                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='444' />",\r
-                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace));\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.Message, "#D3");\r
-                               Assert.IsNotNull (ex.InnerException, "#D4");\r
-\r
-                               // '444' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#D8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#D9");\r
-                       }\r
-\r
-                       try {\r
-                               f = (Field) Deserialize (typeof (Field),\r
-                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='Garbage' />",\r
-                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace));\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");\r
-                               Assert.IsNotNull (ex.Message, "#E3");\r
-                               Assert.IsNotNull (ex.InnerException, "#E4");\r
-\r
-                               // 'Garbage' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#E6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Garbage'") != -1, "#E7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#E8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#E9");\r
-                       }\r
-\r
-                       try {\r
-                               f = (Field) Deserialize (typeof (Field),\r
-                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='{2}' />",\r
-                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace, ((int) FlagEnum.e2).ToString (CultureInfo.InvariantCulture)));\r
-                               Assert.Fail ("#F1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");\r
-                               Assert.IsNotNull (ex.Message, "#F3");\r
-                               Assert.IsNotNull (ex.InnerException, "#F4");\r
-\r
-                               // '2' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#F6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'2'") != -1, "#F7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#F8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#F9");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotDotNet")] // MS.NET does not allow SoapAttribute backed by enum ??\r
-               public void TestDeserialize_Field_Encoded ()\r
-               {\r
-                       Field_Encoded f = null;\r
-\r
-                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='' flag2='' flag4='' modifiers='PuBlIc' modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='{2}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));\r
-                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags1, "#A1");\r
-                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags2, "#A2");\r
-                       Assert.AreEqual (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2, f.Flags3, "#A3");\r
-                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#A4");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#A5");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#A6");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#A7");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#A8");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#A9");\r
-                       Assert.IsNull (f.Names, "#A10");\r
-                       Assert.IsNull (f.Street, "#A11");\r
-\r
-                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag3='two' flag4='' modifiers='Protected' modifiers2='PuBlIc' xmlns:q1='{2}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));\r
-                       Assert.AreEqual (FlagEnum_Encoded.e1, f.Flags1, "#B1");\r
-                       Assert.AreEqual (FlagEnum_Encoded.e1, f.Flags2, "#B2");\r
-                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags3, "#B3");\r
-                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#B4");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers, "#B5");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#B6");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#B7");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers4, "#B8");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#B9");\r
-                       Assert.IsNull (f.Names, "#B10");\r
-                       Assert.IsNull (f.Street, "#B11");\r
-\r
-                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),\r
-                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='two' flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected' modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected' xmlns:q1='{2}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));\r
-                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags1, "#C1");\r
-                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags2, "#C2");\r
-                       Assert.AreEqual (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2, f.Flags3, "#C3");\r
-                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#C4");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#C5");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers2, "#C6");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers3, "#C7");\r
-                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#C8");\r
-                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers5, "#C9");\r
-                       Assert.IsNull (f.Names, "#C10");\r
-                       Assert.IsNull (f.Street, "#C11");\r
-\r
-                       try {\r
-                               f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),\r
-                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +\r
-                                       "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag2='444' flag3='555' flag4='' modifiers='666' modifiers2='777' modifiers4='888' modifiers5='999' xmlns:q1='{2}' />",\r
-                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.Message, "#D3");\r
-                               Assert.IsNotNull (ex.InnerException, "#D4");\r
-\r
-                               // '444' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum_Encoded\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum_Encoded).FullName) != -1, "#D8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#D9");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_FlagEnum ()\r
-               {\r
-                       FlagEnum e;\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum />");\r
-                       Assert.AreEqual (0, (int) e, "#A1");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one</FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e1, e, "#A2");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one\u200atwo</FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2, e, "#A3");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one two four</FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, e, "#A4");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum> two  four </FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e2 | FlagEnum.e4, e, "#A5");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>two four two</FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e2 | FlagEnum.e4, e, "#A6");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>two four two\tone\u2002four\u200btwo one</FlagEnum>");\r
-                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, e, "#A7");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum></FlagEnum>");\r
-                       Assert.AreEqual (0, (int) e, "#A8");\r
-\r
-                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum> </FlagEnum>");\r
-                       Assert.AreEqual (0, (int) e, "#A9");\r
-\r
-                       try {\r
-                               Deserialize (typeof (FlagEnum), "<FlagEnum>1</FlagEnum>");\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.InnerException, "#B3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#B6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#B7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (FlagEnum), "<FlagEnum>one,two</FlagEnum>");\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");\r
-                               Assert.IsNotNull (ex.InnerException, "#C3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#C5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'one,two'") != -1, "#C6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#C7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (FlagEnum), "<FlagEnum>one something</FlagEnum>");\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.InnerException, "#D3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'something'") != -1, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#D7");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_Group ()\r
-               {\r
-                       string xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns:d2p1='http://www.cpandl.com' CreationDate='2002-05-02' d2p1:GroupName='.NET' GroupNumber='ZDI=' id='id1'>" +\r
-                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +\r
-                               "<Grouptype xsi:type='GroupType'>Small</Grouptype>" +\r
-                               "<MyVehicle href='#id2' />" +\r
-                               "</Group>" +\r
-                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +\r
-                               "<licenseNumber xmlns:q1='{0}' d2p1:type='q1:string'>1234566</licenseNumber>" +\r
-                               "<makeDate xmlns:q2='{0}' d2p1:type='q2:date'>0001-01-01</makeDate>" +\r
-                               "</Car>" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");\r
-\r
-                       XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       Group group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-\r
-                       Assert.AreEqual (new DateTime (2002, 5, 2), group.Today, "#A1");\r
-                       Assert.AreEqual (".NET", group.GroupName, "#A2");\r
-                       Assert.AreEqual (new byte [] { 0x64, 0x32 }, group.GroupNumber, "#A3");\r
-                       Assert.AreEqual (GroupType.A, group.Grouptype, "#A4");\r
-                       Assert.AreEqual ("10000", group.PostitiveInt, "#A5");\r
-                       Assert.IsFalse (group.IgnoreThis, "#A6");\r
-                       Assert.IsNotNull (group.MyVehicle, "#A7");\r
-                       Assert.AreEqual (typeof (Car), group.MyVehicle.GetType (), "#A8");\r
-                       Assert.AreEqual ("1234566", group.MyVehicle.licenseNumber, "#A9");\r
-                       Assert.AreEqual (new DateTime (1, 1, 1), group.MyVehicle.makeDate, "#A10");\r
-                       Assert.IsNull (group.MyVehicle.weight, "#A11");\r
-\r
-                       xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' CreationDate='2002-05-02' GroupNumber='ZDI=' id='id1'>" +\r
-                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +\r
-                               "<Grouptype xsi:type='GroupType'>Large</Grouptype>" +\r
-                               "<MyVehicle href='#id2' />" +\r
-                               "</Group>" +\r
-                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +\r
-                               "<weight xmlns:q2='{0}' d2p1:type='q2:string'>450</weight>" +\r
-                               "</Car>" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");\r
-\r
-                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-\r
-                       Assert.AreEqual (new DateTime (2002, 5, 2), group.Today, "#B1");\r
-                       Assert.IsNull (group.GroupName, "#B2");\r
-                       Assert.AreEqual (new byte [] { 0x64, 0x32 }, group.GroupNumber, "#B3");\r
-                       Assert.AreEqual (GroupType.B, group.Grouptype, "#B4");\r
-                       Assert.AreEqual ("10000", group.PostitiveInt, "#B5");\r
-                       Assert.IsFalse (group.IgnoreThis, "#B6");\r
-                       Assert.IsNotNull (group.MyVehicle, "#B7");\r
-                       Assert.AreEqual (typeof (Car), group.MyVehicle.GetType (), "#B8");\r
-                       Assert.IsNull (group.MyVehicle.licenseNumber, "#B9");\r
-                       Assert.AreEqual (DateTime.MinValue, group.MyVehicle.makeDate, "#B10");\r
-                       Assert.AreEqual ("450", group.MyVehicle.weight, "#B11");\r
-\r
-                       xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' />" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");\r
-\r
-                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-\r
-                       Assert.AreEqual (DateTime.MinValue, group.Today, "#C1");\r
-                       Assert.IsNull (group.GroupName, "#C2");\r
-                       Assert.AreEqual (null, group.GroupNumber, "#C3");\r
-                       Assert.AreEqual (GroupType.A, group.Grouptype, "#C4");\r
-                       Assert.IsNull (group.PostitiveInt, "#C5");\r
-                       Assert.IsFalse (group.IgnoreThis, "#C6");\r
-                       Assert.IsNull (group.MyVehicle, "#C7");\r
-\r
-                       xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +\r
-                               "<Grouptype xsi:type='GroupType'>666</Grouptype>" +\r
-                               "</Group>" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");\r
-\r
-                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       try {\r
-                               group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There is an error in XML document (1, 174)\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.Message, "#D3");\r
-                               Assert.IsNotNull (ex.InnerException, "#D4");\r
-\r
-                               // '666' is not a valid value for GroupType\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'666'") != -1, "#D7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#D8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#D9");\r
-                       }\r
-\r
-                       xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +\r
-                               "<Grouptype xsi:type='GroupType'>Garbage</Grouptype>" +\r
-                               "</Group>" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");\r
-\r
-                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       try {\r
-                               group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There is an error in XML document (1, 178)\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");\r
-                               Assert.IsNotNull (ex.Message, "#E3");\r
-                               Assert.IsNotNull (ex.InnerException, "#E4");\r
-\r
-                               // 'Garbage' is not a valid value for GroupType\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#E6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Garbage'") != -1, "#E7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#E8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#E9");\r
-                       }\r
-\r
-                       xml = string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +\r
-                               "<Grouptype xsi:type='GroupType'>{2}</Grouptype>" +\r
-                               "</Group>" +\r
-                               "</Wrapper>",\r
-                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance",\r
-                               ((int) GroupType.B).ToString (CultureInfo.InvariantCulture));\r
-\r
-                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);\r
-                       xtr.ReadStartElement ("Wrapper");\r
-\r
-                       try {\r
-                               group = (Group) DeserializeEncoded (typeof (Group), xtr);\r
-                               Assert.Fail ("#F1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There is an error in XML document (1, 172)\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");\r
-                               Assert.IsNotNull (ex.Message, "#F3");\r
-                               Assert.IsNotNull (ex.InnerException, "#F4");\r
-\r
-                               // '1' is not a valid value for GroupType\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#F6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#F7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#F8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#F9");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_ZeroFlagEnum ()\r
-               {\r
-                       ZeroFlagEnum e;\r
-\r
-                       e = (ZeroFlagEnum) Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum />");\r
-                       Assert.AreEqual (ZeroFlagEnum.e0, e, "#A1");\r
-                       e = (ZeroFlagEnum) Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum></ZeroFlagEnum>");\r
-                       Assert.AreEqual (ZeroFlagEnum.e0, e, "#A2");\r
-\r
-                       try {\r
-                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum>four</ZeroFlagEnum>");\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.InnerException, "#B3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#B6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#B7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum> o&lt;n&gt;e  four </ZeroFlagEnum>");\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");\r
-                               Assert.IsNotNull (ex.InnerException, "#C3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#C5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#C6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#C7");\r
-                       }\r
-\r
-                       try {\r
-                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum>four o&lt;n&gt;e</ZeroFlagEnum>");\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.InnerException, "#D3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#D7");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestDeserialize_PrimitiveTypesContainer ()\r
-               {\r
-                       Deserialize (typeof (PrimitiveTypesContainer), string.Format (CultureInfo.InvariantCulture, \r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +\r
-                               "<Number xsi:type='xsd:int'>2004</Number>" +\r
-                               "<Name xsi:type='xsd:string'>some name</Name>" +\r
-                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +\r
-                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +\r
-                               "<PathSeparatorCharacter xmlns:q1='{3}' xsi:type='q1:char'>47</PathSeparatorCharacter>" +\r
-                               "</PrimitiveTypesContainer>", XmlSchemaNamespace,\r
-                               XmlSchemaInstanceNamespace, ANamespace, WsdlTypesNamespace));\r
-                       Assert.AreEqual (typeof (PrimitiveTypesContainer), result.GetType (), "#A1");\r
-\r
-                       PrimitiveTypesContainer deserialized = (PrimitiveTypesContainer) result;\r
-                       Assert.AreEqual (2004, deserialized.Number, "#A2");\r
-                       Assert.AreEqual ("some name", deserialized.Name, "#A3");\r
-                       Assert.AreEqual ((byte) 56, deserialized.Index, "#A4");\r
-                       Assert.AreEqual (new byte[] { 243, 15 }, deserialized.Password, "#A5");\r
-                       Assert.AreEqual ('/', deserialized.PathSeparatorCharacter, "#A6");\r
-\r
-                       DeserializeEncoded (typeof (PrimitiveTypesContainer), string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<q1:PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' xmlns:q1='{2}'>" +\r
-                               "<Number xsi:type='xsd:int'>2004</Number>" +\r
-                               "<Name xsi:type='xsd:string'>some name</Name>" +\r
-                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +\r
-                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +\r
-                               "<PathSeparatorCharacter xmlns:q1='{3}' xsi:type='q1:char'>47</PathSeparatorCharacter>" +\r
-                               "</q1:PrimitiveTypesContainer>", XmlSchemaNamespace,\r
-                               XmlSchemaInstanceNamespace, AnotherNamespace, WsdlTypesNamespace));\r
-                       Assert.AreEqual (typeof (PrimitiveTypesContainer), result.GetType (), "#B1");\r
-\r
-                       deserialized = (PrimitiveTypesContainer) result;\r
-                       Assert.AreEqual (2004, deserialized.Number, "#B2");\r
-                       Assert.AreEqual ("some name", deserialized.Name, "#B3");\r
-                       Assert.AreEqual ((byte) 56, deserialized.Index, "#B4");\r
-                       Assert.AreEqual (new byte[] { 243, 15 }, deserialized.Password, "#B5");\r
-                       Assert.AreEqual ('/', deserialized.PathSeparatorCharacter, "#B6");\r
-               }\r
-       }\r
-}\r
+//
+// System.Xml.DeserializationTests
+//
+// Author:
+//     Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2003 Atsushi Enomoto
+//
+//
+using System;
+using System.Globalization;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+using NUnit.Framework;
+using MonoTests.System.Xml.TestClasses;
+
+namespace MonoTests.System.XmlSerialization
+{
+       public class Sample
+       {
+               public string Text;
+               public string [] ArrayText;
+       }
+
+       [TestFixture]
+       public class DeserializationTests
+       {
+               const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";
+               const string XmlSchemaInstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";
+               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";
+               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";
+               const string ANamespace = "some:urn";
+               const string AnotherNamespace = "another:urn";
+
+               object result;
+
+               private object Deserialize (Type t, string xml)
+               {
+                       StringReader sr = new StringReader (xml);
+                       XmlReader xr = new XmlTextReader (sr);
+                       return Deserialize (t, xr);
+               }
+
+               private object Deserialize (Type t, string xml, string defaultNamespace)
+               {
+                       StringReader sr = new StringReader (xml);
+                       XmlReader xr = new XmlTextReader (sr);
+                       return Deserialize (t, xr, defaultNamespace);
+               }
+
+               private object Deserialize (Type t, string xml, XmlAttributeOverrides ao)
+               {
+                       StringReader sr = new StringReader (xml);
+                       XmlReader xr = new XmlTextReader (sr);
+                       return Deserialize (t, xr, ao);
+               }
+
+               private object DeserializeEncoded (Type t, string xml)
+               {
+                       StringReader sr = new StringReader (xml);
+                       XmlReader xr = new XmlTextReader (sr);
+                       return DeserializeEncoded (t, xr);
+               }
+
+               private object Deserialize (Type t, XmlReader xr)
+               {
+                       XmlSerializer ser = new XmlSerializer (t);
+                       result = ser.Deserialize (xr);
+                       return result;
+               }
+
+               private object Deserialize (Type t, XmlReader xr, string defaultNamespace)
+               {
+                       XmlSerializer ser = new XmlSerializer (t, defaultNamespace);
+                       result = ser.Deserialize (xr);
+                       return result;
+               }
+
+               private object Deserialize (Type t, XmlReader xr, XmlAttributeOverrides ao)
+               {
+                       XmlSerializer ser = new XmlSerializer (t, ao);
+                       result = ser.Deserialize (xr);
+                       return result;
+               }
+
+               private object DeserializeEncoded (Type t, XmlReader xr)
+               {
+                       SoapReflectionImporter im = new SoapReflectionImporter ();
+                       XmlTypeMapping tm = im.ImportTypeMapping (t);
+                       XmlSerializer ser = new XmlSerializer (tm);
+                       result = ser.Deserialize (xr);
+                       return result;
+               }
+
+               [Test]
+               public void SimpleDeserialize ()
+               {
+                       Deserialize (typeof (Sample), "<Sample><Text>Test.</Text></Sample>");
+                       Assert.AreEqual (typeof (Sample), result.GetType ());
+                       Sample sample = result as Sample;
+                       Assert.AreEqual ("Test.", sample.Text);
+               }
+
+               [Test]
+               public void DeserializeInt ()
+               {
+                       Deserialize (typeof (int), "<int>10</int>");
+                       Assert.AreEqual (typeof (int), result.GetType ());
+                       Assert.AreEqual (10, result);
+               }
+
+               [Test]
+               public void DeserializeSimpleArray ()
+               {
+                       Deserialize (typeof (Sample), "<Sample><ArrayText><string>Test1</string><string>Test2</string></ArrayText></Sample>");
+                       Assert.AreEqual (typeof (Sample), result.GetType ());
+                       Sample sample = result as Sample;
+                       Assert.AreEqual ("Test1", sample.ArrayText[0]);
+                       Assert.AreEqual ("Test2", sample.ArrayText[1]);
+               }
+
+               [Test]
+               public void DeserializeEmptyEnum ()
+               {
+                       Field f = Deserialize (typeof (Field), "<field modifiers=\"\" />") as Field;
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers);
+               }
+               
+               [Test]
+               public void DeserializePrivateCollection ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       Container c = new Container();
+                       c.Items.Add(1);
+                       
+                       XmlSerializer serializer = new XmlSerializer(typeof(Container));
+                       serializer.Serialize(ms, c);
+                       
+                       ms.Position = 0;
+                       c = (Container) serializer.Deserialize (ms);
+                       Assert.AreEqual (1, c.Items[0]);
+               }
+               
+               [Test]
+               [Category("NotDotNet")]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void DeserializeEmptyPrivateCollection ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       Container2 c = new Container2(true);
+                       c.Items.Add(1);
+                       
+                       XmlSerializer serializer = new XmlSerializer(typeof(Container2));
+                       serializer.Serialize(ms, c);
+                       
+                       ms.Position = 0;
+                       c = (Container2) serializer.Deserialize (ms);
+               }
+               
+               [Test]
+               [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\">";
+                       s += "<ArrayText xmlns:n3=\"http://schemas.xmlsoap.org/soap/encoding/\" xsi:type=\"n3:Array\" n3:arrayType=\"xsd:string[2]\">";
+                       s += "<item href=\"#id-606830706\"></item>";
+                       s += "<item xsi:type=\"xsd:string\">Hola</item>";
+                       s += "</ArrayText>";
+                       s += "<string id=\"id-606830706\" xsi:type=\"xsd:string\">Adeu</string>";
+                       s += "</Sample>";
+                       DeserializeEncoded (typeof(Sample), s);
+               }
+               
+               
+               [Test]
+               public void TestDeserializeXmlNodeArray ()
+               {
+                       object ob = Deserialize (typeof(object), "<anyType at=\"1\"><elem1/><elem2/></anyType>");
+                       Assert.IsTrue (ob is XmlNode[], "Is node array");
+                       
+                       XmlNode[] nods = (XmlNode[]) ob;
+                       Assert.AreEqual (3, nods.Length, "lengh");
+                       Assert.IsTrue (nods[0] is XmlAttribute, "#1");
+                       Assert.AreEqual ("at", ((XmlAttribute) nods[0]).LocalName, "#2");
+                       Assert.AreEqual ("1", ((XmlAttribute) nods[0]).Value, "#3");
+                       Assert.IsTrue (nods[1] is XmlElement, "#4");
+                       Assert.AreEqual ("elem1", ((XmlElement) nods[1]).LocalName, "#5");
+                       Assert.IsTrue (nods[2] is XmlElement, "#6");
+                       Assert.AreEqual ("elem2", ((XmlElement) nods[2]).LocalName, "#7");
+               }
+               
+               [Test]
+               public void TestDeserializeXmlElement ()
+               {
+                       object ob = Deserialize (typeof(XmlElement), "<elem/>");
+                       Assert.IsTrue (ob is XmlElement, "#1");
+                       Assert.AreEqual ("elem", ((XmlElement) ob).LocalName, "#2");
+               }
+               
+               [Test]
+               public void TestDeserializeXmlCDataSection ()
+               {
+                       CDataContainer c = (CDataContainer) Deserialize (typeof(CDataContainer), "<CDataContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><cdata><![CDATA[data section contents]]></cdata></CDataContainer>");
+                       Assert.IsNotNull (c.cdata, "#1");
+                       Assert.AreEqual ("data section contents", c.cdata.Value, "#2");
+               }
+               
+               [Test]
+               public void TestDeserializeXmlNode ()
+               {
+                       NodeContainer c = (NodeContainer) Deserialize (typeof(NodeContainer), "<NodeContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><node>text</node></NodeContainer>");
+                       Assert.IsTrue (c.node is XmlText, "#1");
+                       Assert.AreEqual ("text", c.node.Value, "#2");
+               }
+               
+               [Test]
+               public void TestDeserializeChoices ()
+               {
+                       Choices ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceZero>choice text</ChoiceZero></Choices>");
+                       Assert.AreEqual ("choice text", ch.MyChoice, "#A1");
+                       Assert.AreEqual (ItemChoiceType.ChoiceZero, ch.ItemType, "#A2");
+                       
+                       ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceOne>choice text</ChoiceOne></Choices>");
+                       Assert.AreEqual ("choice text", ch.MyChoice, "#B1");
+                       Assert.AreEqual (ItemChoiceType.StrangeOne, ch.ItemType, "#B2");
+                       
+                       ch = (Choices) Deserialize (typeof(Choices), "<Choices><ChoiceTwo>choice text</ChoiceTwo></Choices>");
+                       Assert.AreEqual ("choice text", ch.MyChoice, "#C1");
+                       Assert.AreEqual (ItemChoiceType.ChoiceTwo, ch.ItemType, "#C2");
+               }
+               
+               [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>");
+                       Assert.AreEqual (4, ts.elem, "#1");
+                       Assert.AreEqual (5, ts.attr, "#2");
+               }
+               
+               [Test]
+               public void TestDeserializeDefaults ()
+               {
+                       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");
+                       Assert.IsNotNull (d2.str, "#A6");
+
+                       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");
+                       Assert.IsNotNull (d2.str, "#B6");
+               }
+               
+               [Test]
+               public void TestDeserializeChoiceArray ()
+               {
+                       CompositeValueType v = (CompositeValueType) Deserialize (typeof(CompositeValueType), "<?xml version=\"1.0\" encoding=\"utf-16\"?><CompositeValueType xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><In>1</In><Es>2</Es></CompositeValueType>");
+                       Assert.IsNotNull (v.Items, "#1");
+                       Assert.IsNotNull (v.ItemsElementName, "#2");
+                       Assert.AreEqual (2, v.Items.Length, "#3");
+                       Assert.AreEqual (2, v.ItemsElementName.Length, "#4");
+                       Assert.AreEqual (1, v.Items[0], "#5");
+                       Assert.AreEqual (2, v.Items[1], "#6");
+                       Assert.AreEqual (ItemsChoiceType.In, v.ItemsElementName[0], "#7");
+                       Assert.AreEqual (ItemsChoiceType.Es, v.ItemsElementName[1], "#8");
+               }
+               
+               [Test]
+               public void TestDeserializeCollection ()
+               {
+                       string s0 = "";
+                       s0+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s0+="           <Entity Name='node1'/>";
+                       s0+="           <Entity Name='node2'/>";
+                       s0+="   </ArrayOfEntity>";
+                       
+                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s0);
+                       Assert.IsNotNull (col, "#1");
+                       Assert.AreEqual (2, col.Count, "#2");
+                       Assert.IsNull (col[0].Parent, "#3");
+                       Assert.IsNull (col[1].Parent, "#4");
+               }
+               
+               [Test]
+               public void TestDeserializeEmptyCollection ()
+               {
+                       string s1 = "";
+                       s1+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       
+                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s1);
+                       Assert.IsNotNull (col, "#A1");
+                       Assert.AreEqual (0, col.Count, "#A2");
+                       
+                       string s1_1 = "";
+                       s1_1+=" <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s1_1+=" </ArrayOfEntity>";
+                       
+                       col = (EntityCollection) Deserialize (typeof(EntityCollection), s1_1);
+                       Assert.IsNotNull (col, "#B1");
+                       Assert.AreEqual (0, col.Count, "#B2");
+               }
+               
+               [Test]
+               public void TestDeserializeNilCollectionIsNotNull ()
+               {
+                       string s2 = "";
+                       s2+="   <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>";
+                       
+                       EntityCollection col = (EntityCollection) Deserialize (typeof(EntityCollection), s2);
+                       Assert.IsNotNull (col, "#1");
+                       Assert.AreEqual (0, col.Count, "#2");
+               }
+               
+               [Test]
+               public void TestDeserializeObjectCollections ()
+               {
+                       string s3 = "";
+                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection1>";
+                       s3+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection2>";
+                       s3+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection3>";
+                       s3+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection4>";
+                       s3+="</Container>";
+                       
+                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s3);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNotNull (cont.Collection1, "#B1");
+                       Assert.AreEqual (2, cont.Collection1.Count, "#B2");
+                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");
+                       Assert.AreEqual ("assigned", cont.Collection1[0].Parent, "#B4");
+                       Assert.AreEqual ("assigned", cont.Collection1[1].Parent, "#B5");
+
+                       Assert.IsNotNull (cont.Collection2, "#C1");
+                       Assert.AreEqual (2, cont.Collection2.Count, "#C2");
+                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");
+                       Assert.AreEqual ("assigned", cont.Collection2[0].Parent, "#C4");
+                       Assert.AreEqual ("assigned", cont.Collection2[1].Parent, "#C5");
+
+                       Assert.IsNotNull (cont.Collection3, "#D1");
+                       Assert.AreEqual (2, cont.Collection3.Count, "#D2");
+                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");
+                       Assert.AreEqual ("root", cont.Collection3[0].Parent, "#D4");
+                       Assert.AreEqual ("root", cont.Collection3[1].Parent, "#D5");
+
+                       Assert.IsNotNull (cont.Collection4, "#E1");
+                       Assert.AreEqual (2, cont.Collection4.Count, "#E2");
+                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");
+                       Assert.AreEqual ("root", cont.Collection4[0].Parent, "#E4");
+                       Assert.AreEqual ("root", cont.Collection4[1].Parent, "#E5");
+               }
+               
+               [Test]
+               public void TestDeserializeEmptyObjectCollections ()
+               {
+                       string s4 = "";
+                       s4+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s4+="</Container>";
+                       
+                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s4);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNotNull (cont.Collection1, "#B1");
+                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");
+                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");
+
+                       Assert.IsNotNull (cont.Collection2, "#C1");
+                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");
+                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");
+
+                       Assert.IsNotNull (cont.Collection3, "#D1");
+                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");
+                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");
+
+                       Assert.IsNotNull (cont.Collection4, "#E1");
+                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");
+                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");
+               }
+
+               [Test]
+               public void TestDeserializeObjectNilCollectionsAreNotNull ()
+               {
+                       string s5 = "";
+                       s5+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s5+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="</Container>";
+                       
+                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s5);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNotNull (cont.Collection1, "#B1");
+                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");
+                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");
+
+                       Assert.IsNotNull (cont.Collection2, "#C1");
+                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");
+                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");
+
+                       Assert.IsNotNull (cont.Collection3, "#D1");
+                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");
+                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");
+
+                       Assert.IsNotNull (cont.Collection4, "#E1");
+                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");
+                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");
+               }
+               
+               [Test]
+               public void TestDeserializeObjectEmptyCollections ()
+               {
+                       string s6 = "";
+                       s6+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s6+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="</Container>";
+                       
+                       EntityContainer cont = (EntityContainer) Deserialize (typeof(EntityContainer), s6);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNotNull (cont.Collection1, "#B1");
+                       Assert.AreEqual (0, cont.Collection1.Count, "#B2");
+                       Assert.AreEqual ("assigned", cont.Collection1.Container, "#B3");
+
+                       Assert.IsNotNull (cont.Collection2, "#C1");
+                       Assert.AreEqual (0, cont.Collection2.Count, "#C2");
+                       Assert.AreEqual ("assigned", cont.Collection2.Container, "#C3");
+
+                       Assert.IsNotNull (cont.Collection3, "#D1");
+                       Assert.AreEqual (0, cont.Collection3.Count, "#D2");
+                       Assert.AreEqual ("root", cont.Collection3.Container, "#D3");
+
+                       Assert.IsNotNull (cont.Collection4, "#E1");
+                       Assert.AreEqual (0, cont.Collection4.Count, "#E2");
+                       Assert.AreEqual ("root", cont.Collection4.Container, "#E3");
+               }
+               
+               [Test]
+               public void TestDeserializeObjectEmptyArrays ()
+               {
+                       string s6 = "";
+                       s6+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s6+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       s6+="</Container>";
+                       
+                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s6);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNotNull (cont.Collection1, "#B1");
+                       Assert.AreEqual (0, cont.Collection1.Length, "#B2");
+
+                       Assert.IsNotNull (cont.Collection2, "#C1");
+                       Assert.AreEqual (0, cont.Collection2.Length, "#C2");
+
+                       Assert.IsNotNull (cont.Collection3, "#D1");
+                       Assert.AreEqual (0, cont.Collection3.Length, "#D2");
+
+                       Assert.IsNotNull (cont.Collection4, "#E1");
+                       Assert.AreEqual (0, cont.Collection4.Length, "#E2");
+               }
+               
+               [Test]
+               public void TestDeserializeEmptyObjectArrays ()
+               {
+                       string s4 = "";
+                       s4+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s4+="</Container>";
+                       
+                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s4);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNull (cont.Collection1, "#B1");
+                       Assert.IsNull (cont.Collection2, "#B2");
+
+                       Assert.IsNotNull (cont.Collection3, "#C1");
+                       Assert.AreEqual (0, cont.Collection3.Length, "#C2");
+
+                       Assert.IsNotNull (cont.Collection4, "#D1");
+                       Assert.AreEqual (0, cont.Collection4.Length, "#D2");
+               }
+               
+               [Test]
+               public void TestDeserializeObjectNilArrays ()
+               {
+                       string s5 = "";
+                       s5+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s5+="   <Collection1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection2 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection3 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="   <Collection4 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true' />";
+                       s5+="</Container>";
+                       
+                       ArrayEntityContainer cont = (ArrayEntityContainer) Deserialize (typeof(ArrayEntityContainer), s5);
+                       Assert.IsNotNull (cont, "#A1");
+
+                       Assert.IsNull (cont.Collection1, "#B1");
+                       Assert.IsNull (cont.Collection2, "#B2");
+                       Assert.IsNull (cont.Collection3, "#B3");
+
+                       Assert.IsNotNull (cont.Collection4, "#C1");
+                       Assert.AreEqual (0, cont.Collection4.Length, "#C2");
+               }
+               
+               [Test]
+               public void TestDeserializeEmptyArray ()
+               {
+                       string s1 = "";
+                       s1+="<ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />";
+                       
+                       Entity[] col = (Entity[]) Deserialize (typeof(Entity[]), s1);
+                       Assert.IsNotNull (col, "#A1");
+                       Assert.AreEqual (0, col.Length, "#A2");
+                       
+                       string s1_1 = "";
+                       s1_1+=" <ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s1_1+=" </ArrayOfEntity>";
+                       
+                       col = (Entity[]) Deserialize (typeof(Entity[]), s1_1);
+                       Assert.IsNotNull (col, "#B1");
+                       Assert.AreEqual (0, col.Length, "#B2");
+               }
+               
+               [Test]
+               public void TestDeserializeNilArray ()
+               {
+                       string s2 = "";
+                       s2 += "<ArrayOfEntity xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>";
+                       
+                       Entity[] col = (Entity[]) Deserialize (typeof(Entity[]), s2);
+                       Assert.IsNull (col, "#1");
+               }
+               
+               [Test]
+               public void TestDeserializeObjectWithReadonlyCollection ()
+               {
+                       string s3 = "";
+                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="   <Collection1>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection1>";
+                       s3+="</Container>";
+                       
+                       ObjectWithReadonlyCollection cont = (ObjectWithReadonlyCollection) Deserialize (typeof(ObjectWithReadonlyCollection), s3);
+                       Assert.IsNotNull (cont, "#1");
+                       Assert.IsNotNull (cont.Collection1, "#2");
+                       Assert.AreEqual (2, cont.Collection1.Count, "#3");
+                       Assert.AreEqual ("root", cont.Collection1.Container, "#4");
+                       Assert.AreEqual ("root", cont.Collection1[0].Parent, "#5");
+                       Assert.AreEqual ("root", cont.Collection1[1].Parent, "#6");
+               }
+               
+               [Test]
+               [ExpectedException (typeof(InvalidOperationException))]
+               public void TestDeserializeObjectWithReadonlyNulCollection ()
+               {
+                       string s3 = "";
+                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="   <Collection1>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection1>";
+                       s3+="</Container>";
+                       
+                       Deserialize (typeof(ObjectWithReadonlyNulCollection), s3);
+               }
+               
+               [Test]
+               public void TestDeserializeObjectWithReadonlyArray ()
+               {
+                       string s3 = "";
+                       s3+="<Container xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       s3+="   <Collection1>";
+                       s3+="           <Entity Name='node1'/>";
+                       s3+="           <Entity Name='node2'/>";
+                       s3+="   </Collection1>";
+                       s3+="</Container>";
+                       
+                       ObjectWithReadonlyArray cont = (ObjectWithReadonlyArray) Deserialize (typeof(ObjectWithReadonlyArray), s3);
+                       Assert.IsNotNull (cont, "#1");
+                       Assert.IsNotNull (cont.Collection1, "#2");
+                       Assert.AreEqual (0, cont.Collection1.Length, "#3");
+               }
+
+               [Test]
+               public void TestDeserialize_EnumDefaultValue ()
+               {
+                       EnumDefaultValue e;
+
+                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue />");
+                       Assert.AreEqual (0, (int) e, "#1");
+
+                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue> e3</EnumDefaultValue>");
+                       Assert.AreEqual (EnumDefaultValue.e3, e, "#2");
+
+                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue>e1 e2</EnumDefaultValue>");
+                       Assert.AreEqual (EnumDefaultValue.e3, e, "#3");
+
+                       e = (EnumDefaultValue) Deserialize (typeof (EnumDefaultValue), "<EnumDefaultValue>  e1   e2 </EnumDefaultValue>");
+                       Assert.AreEqual (EnumDefaultValue.e1 | EnumDefaultValue.e2, e, "#4");
+               }
+
+               [Test]
+               public void TestDeserialize_EnumDefaultValueNF ()
+               {
+                       EnumDefaultValueNF e;
+
+                       e = (EnumDefaultValueNF) Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>e3</EnumDefaultValueNF>");
+                       Assert.AreEqual (EnumDefaultValueNF.e3, e, "#A1");
+
+                       try {
+                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF />");
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.InnerException, "#B3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#B5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("''") != -1, "#B6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#B7");
+                       }
+
+                       try {
+                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>e1 e3</EnumDefaultValueNF>");
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.InnerException, "#C3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#C5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'e1 e3'") != -1, "#C6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#C7");
+                       }
+
+                       try {
+                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF> e3</EnumDefaultValueNF>");
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.InnerException, "#D3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("' e3'") != -1, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#D7");
+                       }
+
+                       try {
+                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF> </EnumDefaultValueNF>");
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
+                               Assert.IsNotNull (ex.InnerException, "#E3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#E5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("' '") != -1, "#E6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#E7");
+                       }
+
+                       try {
+                               Deserialize (typeof (EnumDefaultValueNF), "<EnumDefaultValueNF>1</EnumDefaultValueNF>");
+                               Assert.Fail ("#F1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
+                               Assert.IsNotNull (ex.InnerException, "#F3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#F5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#F6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).Name) != -1, "#F7");
+                       }
+               }
+
+               [Test]
+               [Category ("NotWorking")] // DefaultValue should not be used when deserializing
+               public void TestDeserialize_Field ()
+               {
+                       Field f = null;
+
+                       f = (Field) Deserialize (typeof (Field),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='' flag2='' flag4='' modifiers='public' modifiers2='public' modifiers4='public' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags1, "#A1");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags2, "#A2");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags3, "#A3");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#A4");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#A5");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#A6");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#A7");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#A8");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#A9");
+                       Assert.IsNull (f.Names, "#A10");
+                       Assert.IsNull (f.Street, "#A11");
+
+                       f = (Field) Deserialize (typeof (Field),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag3='two' flag4='' modifiers='protected' modifiers2='public' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags1, "#B1");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags2, "#B2");
+                       Assert.AreEqual (FlagEnum.e2, f.Flags3, "#B3");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#B4");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers, "#B5");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#B6");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#B7");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#B8");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#B9");
+                       Assert.IsNull (f.Names, "#B10");
+                       Assert.IsNull (f.Street, "#B11");
+
+                       f = (Field) Deserialize (typeof (Field),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='two' flag2='two' flag4='' modifiers='public' modifiers2='protected' modifiers3='protected' modifiers4='public' modifiers5='protected' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace));
+                       Assert.AreEqual (FlagEnum.e2, f.Flags1, "#C1");
+                       Assert.AreEqual (FlagEnum.e2, f.Flags2, "#C2");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags3, "#C3");
+                       Assert.AreEqual ((FlagEnum) 0, f.Flags4, "#C4");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#C5");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers2, "#C6");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers3, "#C7");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#C8");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers5, "#C9");
+                       Assert.IsNull (f.Names, "#C10");
+                       Assert.IsNull (f.Street, "#C11");
+
+                       try {
+                               f = (Field) Deserialize (typeof (Field),
+                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='444' />",
+                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace));
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.Message, "#D3");
+                               Assert.IsNotNull (ex.InnerException, "#D4");
+
+                               // '444' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#D8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#D9");
+                       }
+
+                       try {
+                               f = (Field) Deserialize (typeof (Field),
+                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='Garbage' />",
+                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace));
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
+                               Assert.IsNotNull (ex.Message, "#E3");
+                               Assert.IsNotNull (ex.InnerException, "#E4");
+
+                               // 'Garbage' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#E6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Garbage'") != -1, "#E7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#E8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#E9");
+                       }
+
+                       try {
+                               f = (Field) Deserialize (typeof (Field),
+                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                                       "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag2='{2}' />",
+                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace, ((int) FlagEnum.e2).ToString (CultureInfo.InvariantCulture)));
+                               Assert.Fail ("#F1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
+                               Assert.IsNotNull (ex.Message, "#F3");
+                               Assert.IsNotNull (ex.InnerException, "#F4");
+
+                               // '2' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#F6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'2'") != -1, "#F7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#F8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#F9");
+                       }
+               }
+
+               [Test]
+               [Category ("NotDotNet")] // MS.NET does not allow SoapAttribute backed by enum ??
+               public void TestDeserialize_Field_Encoded ()
+               {
+                       Field_Encoded f = null;
+
+                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='' flag2='' flag4='' modifiers='PuBlIc' modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='{2}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));
+                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags1, "#A1");
+                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags2, "#A2");
+                       Assert.AreEqual (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2, f.Flags3, "#A3");
+                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#A4");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#A5");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#A6");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#A7");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#A8");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#A9");
+                       Assert.IsNull (f.Names, "#A10");
+                       Assert.IsNull (f.Street, "#A11");
+
+                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag3='two' flag4='' modifiers='Protected' modifiers2='PuBlIc' xmlns:q1='{2}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));
+                       Assert.AreEqual (FlagEnum_Encoded.e1, f.Flags1, "#B1");
+                       Assert.AreEqual (FlagEnum_Encoded.e1, f.Flags2, "#B2");
+                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags3, "#B3");
+                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#B4");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers, "#B5");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers2, "#B6");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers3, "#B7");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers4, "#B8");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers5, "#B9");
+                       Assert.IsNull (f.Names, "#B10");
+                       Assert.IsNull (f.Street, "#B11");
+
+                       f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),
+                               string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='two' flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected' modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected' xmlns:q1='{2}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));
+                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags1, "#C1");
+                       Assert.AreEqual (FlagEnum_Encoded.e2, f.Flags2, "#C2");
+                       Assert.AreEqual (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2, f.Flags3, "#C3");
+                       Assert.AreEqual ((FlagEnum_Encoded) 0, f.Flags4, "#C4");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers, "#C5");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers2, "#C6");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers3, "#C7");
+                       Assert.AreEqual (MapModifiers.Public, f.Modifiers4, "#C8");
+                       Assert.AreEqual (MapModifiers.Protected, f.Modifiers5, "#C9");
+                       Assert.IsNull (f.Names, "#C10");
+                       Assert.IsNull (f.Street, "#C11");
+
+                       try {
+                               f = (Field_Encoded) DeserializeEncoded (typeof (Field_Encoded),
+                                       string.Format (CultureInfo.InvariantCulture, "<?xml version='1.0' encoding='utf-16'?>" +
+                                       "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag2='444' flag3='555' flag4='' modifiers='666' modifiers2='777' modifiers4='888' modifiers5='999' xmlns:q1='{2}' />",
+                                       XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace));
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.Message, "#D3");
+                               Assert.IsNotNull (ex.InnerException, "#D4");
+
+                               // '444' is not a valid value for MonoTests.System.Xml.TestClasses.FlagEnum_Encoded
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum_Encoded).FullName) != -1, "#D8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#D9");
+                       }
+               }
+
+               [Test]
+               public void TestDeserialize_FlagEnum ()
+               {
+                       FlagEnum e;
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum />");
+                       Assert.AreEqual (0, (int) e, "#A1");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one</FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e1, e, "#A2");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one\u200atwo</FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2, e, "#A3");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>one two four</FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, e, "#A4");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum> two  four </FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e2 | FlagEnum.e4, e, "#A5");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>two four two</FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e2 | FlagEnum.e4, e, "#A6");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum>two four two\tone\u2002four\u200btwo one</FlagEnum>");
+                       Assert.AreEqual (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, e, "#A7");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum></FlagEnum>");
+                       Assert.AreEqual (0, (int) e, "#A8");
+
+                       e = (FlagEnum) Deserialize (typeof (FlagEnum), "<FlagEnum> </FlagEnum>");
+                       Assert.AreEqual (0, (int) e, "#A9");
+
+                       try {
+                               Deserialize (typeof (FlagEnum), "<FlagEnum>1</FlagEnum>");
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.InnerException, "#B3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#B5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#B6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#B7");
+                       }
+
+                       try {
+                               Deserialize (typeof (FlagEnum), "<FlagEnum>one,two</FlagEnum>");
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.InnerException, "#C3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#C5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'one,two'") != -1, "#C6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#C7");
+                       }
+
+                       try {
+                               Deserialize (typeof (FlagEnum), "<FlagEnum>one something</FlagEnum>");
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.InnerException, "#D3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'something'") != -1, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#D7");
+                       }
+               }
+
+               [Test]
+               public void TestDeserialize_Group ()
+               {
+                       string xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns:d2p1='http://www.cpandl.com' CreationDate='2002-05-02' d2p1:GroupName='.NET' GroupNumber='ZDI=' id='id1'>" +
+                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +
+                               "<Grouptype xsi:type='GroupType'>Small</Grouptype>" +
+                               "<MyVehicle href='#id2' />" +
+                               "</Group>" +
+                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +
+                               "<licenseNumber xmlns:q1='{0}' d2p1:type='q1:string'>1234566</licenseNumber>" +
+                               "<makeDate xmlns:q2='{0}' d2p1:type='q2:date'>0001-01-01</makeDate>" +
+                               "</Car>" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");
+
+                       XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       Group group = (Group) DeserializeEncoded (typeof (Group), xtr);
+
+                       Assert.AreEqual (new DateTime (2002, 5, 2), group.Today, "#A1");
+                       Assert.AreEqual (".NET", group.GroupName, "#A2");
+                       Assert.AreEqual (new byte [] { 0x64, 0x32 }, group.GroupNumber, "#A3");
+                       Assert.AreEqual (GroupType.A, group.Grouptype, "#A4");
+                       Assert.AreEqual ("10000", group.PostitiveInt, "#A5");
+                       Assert.IsFalse (group.IgnoreThis, "#A6");
+                       Assert.IsNotNull (group.MyVehicle, "#A7");
+                       Assert.AreEqual (typeof (Car), group.MyVehicle.GetType (), "#A8");
+                       Assert.AreEqual ("1234566", group.MyVehicle.licenseNumber, "#A9");
+                       Assert.AreEqual (new DateTime (1, 1, 1), group.MyVehicle.makeDate, "#A10");
+                       Assert.IsNull (group.MyVehicle.weight, "#A11");
+
+                       xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' CreationDate='2002-05-02' GroupNumber='ZDI=' id='id1'>" +
+                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +
+                               "<Grouptype xsi:type='GroupType'>Large</Grouptype>" +
+                               "<MyVehicle href='#id2' />" +
+                               "</Group>" +
+                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +
+                               "<weight xmlns:q2='{0}' d2p1:type='q2:string'>450</weight>" +
+                               "</Car>" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");
+
+                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       group = (Group) DeserializeEncoded (typeof (Group), xtr);
+
+                       Assert.AreEqual (new DateTime (2002, 5, 2), group.Today, "#B1");
+                       Assert.IsNull (group.GroupName, "#B2");
+                       Assert.AreEqual (new byte [] { 0x64, 0x32 }, group.GroupNumber, "#B3");
+                       Assert.AreEqual (GroupType.B, group.Grouptype, "#B4");
+                       Assert.AreEqual ("10000", group.PostitiveInt, "#B5");
+                       Assert.IsFalse (group.IgnoreThis, "#B6");
+                       Assert.IsNotNull (group.MyVehicle, "#B7");
+                       Assert.AreEqual (typeof (Car), group.MyVehicle.GetType (), "#B8");
+                       Assert.IsNull (group.MyVehicle.licenseNumber, "#B9");
+                       Assert.AreEqual (DateTime.MinValue, group.MyVehicle.makeDate, "#B10");
+                       Assert.AreEqual ("450", group.MyVehicle.weight, "#B11");
+
+                       xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' />" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");
+
+                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       group = (Group) DeserializeEncoded (typeof (Group), xtr);
+
+                       Assert.AreEqual (DateTime.MinValue, group.Today, "#C1");
+                       Assert.IsNull (group.GroupName, "#C2");
+                       Assert.AreEqual (null, group.GroupNumber, "#C3");
+                       Assert.AreEqual (GroupType.A, group.Grouptype, "#C4");
+                       Assert.IsNull (group.PostitiveInt, "#C5");
+                       Assert.IsFalse (group.IgnoreThis, "#C6");
+                       Assert.IsNull (group.MyVehicle, "#C7");
+
+                       xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +
+                               "<Grouptype xsi:type='GroupType'>666</Grouptype>" +
+                               "</Group>" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");
+
+                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       try {
+                               group = (Group) DeserializeEncoded (typeof (Group), xtr);
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               // There is an error in XML document (1, 174)
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.Message, "#D3");
+                               Assert.IsNotNull (ex.InnerException, "#D4");
+
+                               // '666' is not a valid value for GroupType
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'666'") != -1, "#D7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#D8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#D9");
+                       }
+
+                       xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +
+                               "<Grouptype xsi:type='GroupType'>Garbage</Grouptype>" +
+                               "</Group>" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance");
+
+                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       try {
+                               group = (Group) DeserializeEncoded (typeof (Group), xtr);
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               // There is an error in XML document (1, 178)
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
+                               Assert.IsNotNull (ex.Message, "#E3");
+                               Assert.IsNotNull (ex.InnerException, "#E4");
+
+                               // 'Garbage' is not a valid value for GroupType
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#E6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Garbage'") != -1, "#E7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#E8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#E9");
+                       }
+
+                       xml = string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1'>" +
+                               "<Grouptype xsi:type='GroupType'>{2}</Grouptype>" +
+                               "</Group>" +
+                               "</Wrapper>",
+                               "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2001/XMLSchema-instance",
+                               ((int) GroupType.B).ToString (CultureInfo.InvariantCulture));
+
+                       xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
+                       xtr.ReadStartElement ("Wrapper");
+
+                       try {
+                               group = (Group) DeserializeEncoded (typeof (Group), xtr);
+                               Assert.Fail ("#F1");
+                       } catch (InvalidOperationException ex) {
+                               // There is an error in XML document (1, 172)
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
+                               Assert.IsNotNull (ex.Message, "#F3");
+                               Assert.IsNotNull (ex.InnerException, "#F4");
+
+                               // '1' is not a valid value for GroupType
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#F5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#F6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'1'") != -1, "#F7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (GroupType).Name) != -1, "#F8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#F9");
+                       }
+               }
+
+               [Test]
+               public void TestDeserialize_ZeroFlagEnum ()
+               {
+                       ZeroFlagEnum e;
+
+                       e = (ZeroFlagEnum) Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum />");
+                       Assert.AreEqual (ZeroFlagEnum.e0, e, "#A1");
+                       e = (ZeroFlagEnum) Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum></ZeroFlagEnum>");
+                       Assert.AreEqual (ZeroFlagEnum.e0, e, "#A2");
+
+                       try {
+                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum>four</ZeroFlagEnum>");
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.InnerException, "#B3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#B5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#B6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#B7");
+                       }
+
+                       try {
+                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum> o&lt;n&gt;e  four </ZeroFlagEnum>");
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.InnerException, "#C3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#C5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#C6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#C7");
+                       }
+
+                       try {
+                               Deserialize (typeof (ZeroFlagEnum), "<ZeroFlagEnum>four o&lt;n&gt;e</ZeroFlagEnum>");
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.InnerException, "#D3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'four'") != -1, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#D7");
+                       }
+               }
+
+               [Test]
+               public void TestDeserialize_PrimitiveTypesContainer ()
+               {
+                       Deserialize (typeof (PrimitiveTypesContainer), string.Format (CultureInfo.InvariantCulture, 
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +
+                               "<Number xsi:type='xsd:int'>2004</Number>" +
+                               "<Name xsi:type='xsd:string'>some name</Name>" +
+                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +
+                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +
+                               "<PathSeparatorCharacter xmlns:q1='{3}' xsi:type='q1:char'>47</PathSeparatorCharacter>" +
+                               "</PrimitiveTypesContainer>", XmlSchemaNamespace,
+                               XmlSchemaInstanceNamespace, ANamespace, WsdlTypesNamespace));
+                       Assert.AreEqual (typeof (PrimitiveTypesContainer), result.GetType (), "#A1");
+
+                       PrimitiveTypesContainer deserialized = (PrimitiveTypesContainer) result;
+                       Assert.AreEqual (2004, deserialized.Number, "#A2");
+                       Assert.AreEqual ("some name", deserialized.Name, "#A3");
+                       Assert.AreEqual ((byte) 56, deserialized.Index, "#A4");
+                       Assert.AreEqual (new byte[] { 243, 15 }, deserialized.Password, "#A5");
+                       Assert.AreEqual ('/', deserialized.PathSeparatorCharacter, "#A6");
+
+                       DeserializeEncoded (typeof (PrimitiveTypesContainer), string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<q1:PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' xmlns:q1='{2}'>" +
+                               "<Number xsi:type='xsd:int'>2004</Number>" +
+                               "<Name xsi:type='xsd:string'>some name</Name>" +
+                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +
+                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +
+                               "<PathSeparatorCharacter xmlns:q1='{3}' xsi:type='q1:char'>47</PathSeparatorCharacter>" +
+                               "</q1:PrimitiveTypesContainer>", XmlSchemaNamespace,
+                               XmlSchemaInstanceNamespace, AnotherNamespace, WsdlTypesNamespace));
+                       Assert.AreEqual (typeof (PrimitiveTypesContainer), result.GetType (), "#B1");
+
+                       deserialized = (PrimitiveTypesContainer) result;
+                       Assert.AreEqual (2004, deserialized.Number, "#B2");
+                       Assert.AreEqual ("some name", deserialized.Name, "#B3");
+                       Assert.AreEqual ((byte) 56, deserialized.Index, "#B4");
+                       Assert.AreEqual (new byte[] { 243, 15 }, deserialized.Password, "#B5");
+                       Assert.AreEqual ('/', deserialized.PathSeparatorCharacter, "#B6");
+               }
+       }
+}
index e0cab9a2da028ecbb5ef70c354ebeca8414873f0..27b8f9d79f169e11e9e92991dc85ac2da657600c 100644 (file)
@@ -1,46 +1,46 @@
-//\r
-// Tests for System.Xml.Serialization.SoapAttributeAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapAttributeAttributeTests\r
-       {\r
-               [Test]\r
-               public void AttributeNameDefault ()\r
-               {\r
-                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.AttributeName, "#1");\r
-\r
-                       attr.AttributeName = null;\r
-                       Assert.AreEqual (string.Empty, attr.AttributeName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapAttributeAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapAttributeAttributeTests
+       {
+               [Test]
+               public void AttributeNameDefault ()
+               {
+                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();
+                       Assert.AreEqual (string.Empty, attr.AttributeName, "#1");
+
+                       attr.AttributeName = null;
+                       Assert.AreEqual (string.Empty, attr.AttributeName, "#2");
+               }
+
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       SoapAttributeAttribute attr = new SoapAttributeAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+       }
+}
index 302c48233616fe95d6b9dd4ca69ab983a3f83d0f..cb8b42b60c84a1a022a2eab10651cf283f341233 100644 (file)
@@ -1,46 +1,46 @@
-//\r
-// Tests for System.Xml.Serialization.SoapElementAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapElementAttributeTests\r
-       {\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       SoapElementAttribute attr = new SoapElementAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void ElementNameDefault ()\r
-               {\r
-                       SoapElementAttribute attr = new SoapElementAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");\r
-\r
-                       attr.ElementName = null;\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void IsNullableDefault ()\r
-               {\r
-                       SoapElementAttribute attr = new SoapElementAttribute ();\r
-                       Assert.AreEqual (false, attr.IsNullable);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapElementAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapElementAttributeTests
+       {
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       SoapElementAttribute attr = new SoapElementAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void ElementNameDefault ()
+               {
+                       SoapElementAttribute attr = new SoapElementAttribute ();
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");
+
+                       attr.ElementName = null;
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");
+               }
+
+               [Test]
+               public void IsNullableDefault ()
+               {
+                       SoapElementAttribute attr = new SoapElementAttribute ();
+                       Assert.AreEqual (false, attr.IsNullable);
+               }
+       }
+}
index baf51f917a7496a96c73e15eacaec97c4749447a..dfa8c6aa5a351252e00b7b693cf7198c6c4346b0 100644 (file)
@@ -1,29 +1,29 @@
-//\r
-// Tests for System.Xml.Serialization.SoapEnumAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapEnumAttributeTests\r
-       {\r
-               [Test]\r
-               public void NameDefault ()\r
-               {\r
-                       SoapEnumAttribute attr = new SoapEnumAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.Name, "#1");\r
-\r
-                       attr.Name = null;\r
-                       Assert.AreEqual (string.Empty, attr.Name, "#2");\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapEnumAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapEnumAttributeTests
+       {
+               [Test]
+               public void NameDefault ()
+               {
+                       SoapEnumAttribute attr = new SoapEnumAttribute ();
+                       Assert.AreEqual (string.Empty, attr.Name, "#1");
+
+                       attr.Name = null;
+                       Assert.AreEqual (string.Empty, attr.Name, "#2");
+               }
+       }
+}
index 1332bcdfd3413ad162dfb355658bfa5f09352196..9adea0aa0eeb6013e740c524d0c7239f5ec18325 100644 (file)
@@ -1,26 +1,26 @@
-//\r
-// Tests for System.Xml.Serialization.SoapIncludeAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapIncludeAttributeTests\r
-       {\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       SoapIncludeAttribute attr = new SoapIncludeAttribute (null);\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapIncludeAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapIncludeAttributeTests
+       {
+               [Test]
+               public void TypeDefault ()
+               {
+                       SoapIncludeAttribute attr = new SoapIncludeAttribute (null);
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}
index b15a1700faaf54ed5262663d7278f781995a473e..36eeb25c99d2fb211818d0289930edab78c0e6bf 100644 (file)
@@ -1,37 +1,37 @@
-//\r
-// Tests for System.Xml.Serialization.SoapSchemaMember\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapSchemaMemberTests\r
-       {\r
-               [Test]\r
-               public void MemberNameDefault ()\r
-               {\r
-                       SoapSchemaMember member = new SoapSchemaMember ();\r
-                       Assert.AreEqual (string.Empty, member.MemberName);\r
-\r
-                       member.MemberName = null;\r
-                       Assert.AreEqual (string.Empty, member.MemberName);\r
-               }\r
-\r
-               [Test]\r
-               public void MemberTypeDefault ()\r
-               {\r
-                       SoapSchemaMember member = new SoapSchemaMember ();\r
-                       Assert.AreEqual (XmlQualifiedName.Empty, member.MemberType);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapSchemaMember
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapSchemaMemberTests
+       {
+               [Test]
+               public void MemberNameDefault ()
+               {
+                       SoapSchemaMember member = new SoapSchemaMember ();
+                       Assert.AreEqual (string.Empty, member.MemberName);
+
+                       member.MemberName = null;
+                       Assert.AreEqual (string.Empty, member.MemberName);
+               }
+
+               [Test]
+               public void MemberTypeDefault ()
+               {
+                       SoapSchemaMember member = new SoapSchemaMember ();
+                       Assert.AreEqual (XmlQualifiedName.Empty, member.MemberType);
+               }
+       }
+}
index 8a590a0075a3987f4060954ae748831616a2909f..0149ae125ed81a5ad4bd28c90192ff73b96a8ea6 100644 (file)
@@ -1,43 +1,43 @@
-//\r
-// Tests for System.Xml.Serialization.SoapTypeAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class SoapTypeAttributeTests\r
-       {\r
-               [Test]\r
-               public void IncludeInSchemaDefault ()\r
-               {\r
-                       SoapTypeAttribute attr = new SoapTypeAttribute ();\r
-                       Assert.AreEqual (true, attr.IncludeInSchema);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       SoapTypeAttribute attr = new SoapTypeAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-\r
-               [Test]\r
-               public void TypeNameDefault ()\r
-               {\r
-                       SoapTypeAttribute attr = new SoapTypeAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.TypeName, "#1");\r
-\r
-                       attr.TypeName = null;\r
-                       Assert.AreEqual (string.Empty, attr.TypeName, "#2");\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.SoapTypeAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class SoapTypeAttributeTests
+       {
+               [Test]
+               public void IncludeInSchemaDefault ()
+               {
+                       SoapTypeAttribute attr = new SoapTypeAttribute ();
+                       Assert.AreEqual (true, attr.IncludeInSchema);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       SoapTypeAttribute attr = new SoapTypeAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+
+               [Test]
+               public void TypeNameDefault ()
+               {
+                       SoapTypeAttribute attr = new SoapTypeAttribute ();
+                       Assert.AreEqual (string.Empty, attr.TypeName, "#1");
+
+                       attr.TypeName = null;
+                       Assert.AreEqual (string.Empty, attr.TypeName, "#2");
+               }
+       }
+}
index ad70a14f957dd3f3753ca579258c14150b2df74d..2c41f4244d3fe9d28e035daaa4fc73b453b1db7f 100644 (file)
@@ -1,36 +1,36 @@
-//\r
-// Tests for System.Xml.Serialization.XmlAnyElementAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlAnyElementAttributeTests\r
-       {\r
-               [Test]\r
-               public void NameDefault ()\r
-               {\r
-                       XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.Name, "#1");\r
-\r
-                       attr.Name = null;\r
-                       Assert.AreEqual (string.Empty, attr.Name, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlAnyElementAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlAnyElementAttributeTests
+       {
+               [Test]
+               public void NameDefault ()
+               {
+                       XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();
+                       Assert.AreEqual (string.Empty, attr.Name, "#1");
+
+                       attr.Name = null;
+                       Assert.AreEqual (string.Empty, attr.Name, "#2");
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlAnyElementAttribute attr = new XmlAnyElementAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+       }
+}
index 3f630a454bde59ef75dbd0a4a31341a57b97ad44..244c6706bf19ac4ee3489c9fdabeefb9eb06778a 100644 (file)
@@ -1,51 +1,51 @@
-//\r
-// Tests for System.Xml.Serialization.XmlArrayAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlArrayAttributeTests\r
-       {\r
-               [Test]\r
-               public void ElementNameDefault ()\r
-               {\r
-                       XmlArrayAttribute attr = new XmlArrayAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");\r
-\r
-                       attr.ElementName = null;\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void FormDefault ()\r
-               {\r
-                       XmlArrayAttribute attr = new XmlArrayAttribute ();\r
-                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);\r
-               }\r
-\r
-               [Test]\r
-               public void IsNullableDefault ()\r
-               {\r
-                       XmlArrayAttribute attr = new XmlArrayAttribute ();\r
-                       Assert.AreEqual (false, attr.IsNullable);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlArrayAttribute attr = new XmlArrayAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlArrayAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlArrayAttributeTests
+       {
+               [Test]
+               public void ElementNameDefault ()
+               {
+                       XmlArrayAttribute attr = new XmlArrayAttribute ();
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");
+
+                       attr.ElementName = null;
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");
+               }
+
+               [Test]
+               public void FormDefault ()
+               {
+                       XmlArrayAttribute attr = new XmlArrayAttribute ();
+                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);
+               }
+
+               [Test]
+               public void IsNullableDefault ()
+               {
+                       XmlArrayAttribute attr = new XmlArrayAttribute ();
+                       Assert.AreEqual (false, attr.IsNullable);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlArrayAttribute attr = new XmlArrayAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+       }
+}
index f48170c0ad24413063e8ed2a62d35124fdfdf8b1..820520917f30f4c533db5539a1f4e72b56293422 100644 (file)
@@ -1,75 +1,75 @@
-//\r
-// Tests for System.Xml.Serialization.XmlArrayItemAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlArrayItemAttributeTests\r
-       {\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void ElementNameDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");\r
-\r
-                       attr.ElementName = null;\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void FormDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);\r
-               }\r
-\r
-               [Test]\r
-               public void IsNullableDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.AreEqual (false, attr.IsNullable);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-\r
-               [Test]\r
-               public void NestingLevelDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.AreEqual (0, attr.NestingLevel);\r
-               }\r
-\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlArrayItemAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlArrayItemAttributeTests
+       {
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void ElementNameDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");
+
+                       attr.ElementName = null;
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");
+               }
+
+               [Test]
+               public void FormDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);
+               }
+
+               [Test]
+               public void IsNullableDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.AreEqual (false, attr.IsNullable);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+
+               [Test]
+               public void NestingLevelDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.AreEqual (0, attr.NestingLevel);
+               }
+
+               [Test]
+               public void TypeDefault ()
+               {
+                       XmlArrayItemAttribute attr = new XmlArrayItemAttribute ();
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}
index 9732c3807a23d4f3d5546fd0a919794b1bb84368..fed9f9d64542565a68706beb609eb8d0fb550c82 100644 (file)
@@ -1,61 +1,61 @@
-//\r
-// Tests for System.Xml.Serialization.XmlAttributeAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlAttributeAttributeTests\r
-       {\r
-               [Test]\r
-               public void AttributeNameDefault ()\r
-               {\r
-                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.AttributeName, "#1");\r
-\r
-                       attr.AttributeName = null;\r
-                       Assert.AreEqual (string.Empty, attr.AttributeName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void FormDefault ()\r
-               {\r
-                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();\r
-                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlAttributeAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlAttributeAttributeTests
+       {
+               [Test]
+               public void AttributeNameDefault ()
+               {
+                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();
+                       Assert.AreEqual (string.Empty, attr.AttributeName, "#1");
+
+                       attr.AttributeName = null;
+                       Assert.AreEqual (string.Empty, attr.AttributeName, "#2");
+               }
+
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void FormDefault ()
+               {
+                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();
+                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+
+               [Test]
+               public void TypeDefault ()
+               {
+                       XmlAttributeAttribute attr = new XmlAttributeAttribute ();
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}
index cf0e58c6283ab310f4af7705812cd84854c15cde..893f354d48f2a75eeefb19703996014d13d2c8dd 100644 (file)
-//\r
-// System.Xml.XmlAttributesTests\r
-//\r
-// Author:\r
-//   Atsushi Enomoto\r
-//\r
-// (C) 2003 Atsushi Enomoto\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Text;\r
-using System.Xml;\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlAttributesTests\r
-       {\r
-               StringWriter sw;\r
-               XmlTextWriter xtw;\r
-               XmlSerializer xs;\r
-\r
-               private void SetUpWriter ()\r
-               {\r
-                       sw = new StringWriter ();\r
-                       xtw = new XmlTextWriter (sw);\r
-                       xtw.QuoteChar = '\'';\r
-                       xtw.Formatting = Formatting.None;\r
-               }\r
-               \r
-               private string WriterText \r
-               {\r
-                       get\r
-                       {\r
-                               string val = sw.GetStringBuilder ().ToString();\r
-                               int offset = val.IndexOf ('>') + 1;\r
-                               val = val.Substring (offset);\r
-                               return val;\r
-                       }\r
-               }\r
-\r
-               private void Serialize (object o, XmlAttributeOverrides ao)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType (), ao);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-               \r
-               private void Serialize (object o, XmlRootAttribute root)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType(), root);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               // Testcases.\r
-\r
-               [Test]\r
-               public void NewXmlAttributes ()\r
-               {\r
-                       // seems not different from Type specified ctor().\r
-                       XmlAttributes atts = new XmlAttributes ();\r
-                       Assert.IsNull (atts.XmlAnyAttribute, "#1");\r
-                       Assert.IsNotNull (atts.XmlAnyElements, "#2");\r
-                       Assert.AreEqual (0, atts.XmlAnyElements.Count, "#3");\r
-                       Assert.IsNull (atts.XmlArray, "#4");\r
-                       Assert.IsNotNull (atts.XmlArrayItems, "#5");\r
-                       Assert.AreEqual (0, atts.XmlArrayItems.Count, "#6");\r
-                       Assert.IsNull (atts.XmlAttribute, "#7");\r
-                       Assert.IsNull (atts.XmlChoiceIdentifier, "#8");\r
-                       Assert.IsNotNull (atts.XmlDefaultValue, "#9");\r
-                       // DBNull??\r
-                       Assert.AreEqual (DBNull.Value, atts.XmlDefaultValue, "#10");\r
-                       Assert.IsNotNull (atts.XmlElements, "#11");\r
-                       Assert.AreEqual (0, atts.XmlElements.Count, "#12");\r
-                       Assert.IsNull (atts.XmlEnum, "#13");\r
-                       Assert.IsNotNull (atts.XmlIgnore, "#14");\r
-                       Assert.AreEqual (TypeCode.Boolean, atts.XmlIgnore.GetTypeCode (), "#15");\r
-                       Assert.AreEqual (false, atts.Xmlns, "#16");\r
-                       Assert.IsNull (atts.XmlRoot, "#17");\r
-                       Assert.IsNull (atts.XmlText, "#18");\r
-                       Assert.IsNull (atts.XmlType, "#19");\r
-               }\r
-\r
-               [Test]\r
-               public void XmlTextAttribute ()\r
-               {\r
-                       // based on default ctor.\r
-                       XmlTextAttribute attr = new XmlTextAttribute ();\r
-                       Assert.AreEqual ("", attr.DataType, "#1");\r
-                       Assert.IsNull (attr.Type, "#2");\r
-                       // based on a type.\r
-                       XmlTextAttribute attr2 = new XmlTextAttribute (typeof (XmlNode));\r
-                       Assert.AreEqual ("", attr.DataType, "#3");\r
-                       Assert.IsNull (attr.Type, "#4");\r
-               }\r
-\r
-               [Test]\r
-               public void XmlInvalidElementAttribute ()\r
-               {\r
-                       XmlAttributeOverrides ao = new XmlAttributeOverrides ();\r
-                       XmlAttributes atts = new XmlAttributes ();\r
-                       atts.XmlElements.Add (new XmlElementAttribute ("xInt"));\r
-                       ao.Add (typeof (int), atts);\r
-                       try {\r
-                               Serialize (10, ao);\r
-                               Assert.Fail ("Should be invalid.");\r
-                       } catch (InvalidOperationException ex) {\r
-                       }\r
-               }\r
-       }\r
-}\r
+//
+// System.Xml.XmlAttributesTests
+//
+// Author:
+//   Atsushi Enomoto
+//
+// (C) 2003 Atsushi Enomoto
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlAttributesTests
+       {
+               StringWriter sw;
+               XmlTextWriter xtw;
+               XmlSerializer xs;
+
+               private void SetUpWriter ()
+               {
+                       sw = new StringWriter ();
+                       xtw = new XmlTextWriter (sw);
+                       xtw.QuoteChar = '\'';
+                       xtw.Formatting = Formatting.None;
+               }
+               
+               private string WriterText 
+               {
+                       get
+                       {
+                               string val = sw.GetStringBuilder ().ToString();
+                               int offset = val.IndexOf ('>') + 1;
+                               val = val.Substring (offset);
+                               return val;
+                       }
+               }
+
+               private void Serialize (object o, XmlAttributeOverrides ao)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType (), ao);
+                       xs.Serialize (xtw, o);
+               }
+               
+               private void Serialize (object o, XmlRootAttribute root)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType(), root);
+                       xs.Serialize (xtw, o);
+               }
+
+               // Testcases.
+
+               [Test]
+               public void NewXmlAttributes ()
+               {
+                       // seems not different from Type specified ctor().
+                       XmlAttributes atts = new XmlAttributes ();
+                       Assert.IsNull (atts.XmlAnyAttribute, "#1");
+                       Assert.IsNotNull (atts.XmlAnyElements, "#2");
+                       Assert.AreEqual (0, atts.XmlAnyElements.Count, "#3");
+                       Assert.IsNull (atts.XmlArray, "#4");
+                       Assert.IsNotNull (atts.XmlArrayItems, "#5");
+                       Assert.AreEqual (0, atts.XmlArrayItems.Count, "#6");
+                       Assert.IsNull (atts.XmlAttribute, "#7");
+                       Assert.IsNull (atts.XmlChoiceIdentifier, "#8");
+                       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");
+                       Assert.IsNotNull (atts.XmlIgnore, "#14");
+                       Assert.AreEqual (TypeCode.Boolean, atts.XmlIgnore.GetTypeCode (), "#15");
+                       Assert.AreEqual (false, atts.Xmlns, "#16");
+                       Assert.IsNull (atts.XmlRoot, "#17");
+                       Assert.IsNull (atts.XmlText, "#18");
+                       Assert.IsNull (atts.XmlType, "#19");
+               }
+
+               [Test]
+               public void XmlTextAttribute ()
+               {
+                       // based on default ctor.
+                       XmlTextAttribute attr = new XmlTextAttribute ();
+                       Assert.AreEqual ("", attr.DataType, "#1");
+                       Assert.IsNull (attr.Type, "#2");
+                       // based on a type.
+                       XmlTextAttribute attr2 = new XmlTextAttribute (typeof (XmlNode));
+                       Assert.AreEqual ("", attr.DataType, "#3");
+                       Assert.IsNull (attr.Type, "#4");
+               }
+
+               [Test]
+               public void XmlInvalidElementAttribute ()
+               {
+                       XmlAttributeOverrides ao = new XmlAttributeOverrides ();
+                       XmlAttributes atts = new XmlAttributes ();
+                       atts.XmlElements.Add (new XmlElementAttribute ("xInt"));
+                       ao.Add (typeof (int), atts);
+                       try {
+                               Serialize (10, ao);
+                               Assert.Fail ("Should be invalid.");
+                       } catch (InvalidOperationException ex) {
+                       }
+               }
+       }
+}
index e0504a873079d08195029717eeccb2f866e9c981..c9120f2ad7ee1cc1c1fec2a843162e9fb5a273bf 100644 (file)
@@ -1,29 +1,29 @@
-//\r
-// Tests for System.Xml.Serialization.XmlChoiceIdentifierAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlChoiceIdentifierAttributeTests\r
-       {\r
-               [Test]\r
-               public void MemerNameDefault ()\r
-               {\r
-                       XmlChoiceIdentifierAttribute attr = new XmlChoiceIdentifierAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.MemberName, "#1");\r
-\r
-                       attr.MemberName = null;\r
-                       Assert.AreEqual (string.Empty, attr.MemberName, "#2");\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlChoiceIdentifierAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlChoiceIdentifierAttributeTests
+       {
+               [Test]
+               public void MemerNameDefault ()
+               {
+                       XmlChoiceIdentifierAttribute attr = new XmlChoiceIdentifierAttribute ();
+                       Assert.AreEqual (string.Empty, attr.MemberName, "#1");
+
+                       attr.MemberName = null;
+                       Assert.AreEqual (string.Empty, attr.MemberName, "#2");
+               }
+       }
+}
index cc197e704ba0fdc756de66cbde3f0afe249c2344..95af754a3d3bba7fe8a81f542bb73a70038d7cd8 100644 (file)
@@ -1,68 +1,68 @@
-//\r
-// Tests for System.Xml.Serialization.XmlElementAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlElementAttributeTests\r
-       {\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void ElementNameDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");\r
-\r
-                       attr.ElementName = null;\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void FormDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);\r
-               }\r
-\r
-               [Test]\r
-               public void IsNullableDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.AreEqual (false, attr.IsNullable);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       XmlElementAttribute attr = new XmlElementAttribute ();\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlElementAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlElementAttributeTests
+       {
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void ElementNameDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");
+
+                       attr.ElementName = null;
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");
+               }
+
+               [Test]
+               public void FormDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.AreEqual (XmlSchemaForm.None, attr.Form);
+               }
+
+               [Test]
+               public void IsNullableDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.AreEqual (false, attr.IsNullable);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+
+               [Test]
+               public void TypeDefault ()
+               {
+                       XmlElementAttribute attr = new XmlElementAttribute ();
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}
index 9c430cabea639da81acf64730903328243e58cfb..427f9dffb0f27434fa276d9c7bcbfa6df75a944c 100644 (file)
@@ -1,26 +1,26 @@
-//\r
-// Tests for System.Xml.Serialization.XmlEnumAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlEnumAttributeTests\r
-       {\r
-               [Test]\r
-               public void NameDefault ()\r
-               {\r
-                       XmlEnumAttribute attr = new XmlEnumAttribute ();\r
-                       Assert.IsNull (attr.Name);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlEnumAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlEnumAttributeTests
+       {
+               [Test]
+               public void NameDefault ()
+               {
+                       XmlEnumAttribute attr = new XmlEnumAttribute ();
+                       Assert.IsNull (attr.Name);
+               }
+       }
+}
index 671bbdf9f0cfcfabbc5897ef97227f36943cb49a..81a915a79800da172cbe9297b7d1a2c0a2900e04 100644 (file)
@@ -1,26 +1,26 @@
-//\r
-// Tests for System.Xml.Serialization.XmlIncludeAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlIncludeAttributeTests\r
-       {\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       XmlIncludeAttribute attr = new XmlIncludeAttribute (null);\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlIncludeAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlIncludeAttributeTests
+       {
+               [Test]
+               public void TypeDefault ()
+               {
+                       XmlIncludeAttribute attr = new XmlIncludeAttribute (null);
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}
index bb2955e2daf7f30d6577c0d9414879d2bb89bf4e..98f1e5053e44a20732f1bcdbf6cc72463b8b513b 100644 (file)
-//\r
-// System.Xml.Serialization.XmlReflectionImporterTests\r
-//\r
-// Author:\r
-//   Erik LeBel (eriklebel@yahoo.ca)\r
-//\r
-// (C) 2003 Erik LeBel\r
-// \r
-// FIXME test some of these with Xml Attributes attached to some members: \r
-// do the names get carried over to Element for XmlAttributeAttribute and XmlElementAttribute?\r
-// \r
-\r
-using System;\r
-using System.Collections;\r
-using System.Xml;\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-using MonoTests.System.Xml.TestClasses;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       // debugging class\r
-       internal class Debug\r
-       {\r
-               public static void Print(XmlTypeMapping tm)\r
-               {\r
-                       Console.WriteLine("/XmlTypeMapping:");\r
-                       Console.WriteLine("ElementName: {0} ", tm.ElementName);\r
-                       Console.WriteLine("Namespace: {0} ", tm.Namespace);\r
-                       Console.WriteLine("TypeName: {0} ", tm.TypeName);\r
-                       Console.WriteLine("FullTypeName: {0} ", tm.TypeFullName);\r
-               }\r
-\r
-               public static void Print(XmlMemberMapping mm)\r
-               {\r
-                       Console.WriteLine("/XmlMemberMapping:");\r
-                       Console.WriteLine("Any: {0} ", mm.Any);\r
-                       Console.WriteLine("ElementName: {0} ", mm.ElementName);\r
-                       Console.WriteLine("MemberName: {0} ", mm.MemberName);\r
-                       Console.WriteLine("Namespace: {0} ", mm.Namespace);\r
-                       Console.WriteLine("TypeFullName: {0} ", mm.TypeFullName);\r
-                       Console.WriteLine("TypeName: {0} ", mm.TypeName);\r
-                       Console.WriteLine("TypeNamespace: {0} ", mm.TypeNamespace);\r
-               }\r
-       }\r
-\r
-       [TestFixture]\r
-       public class XmlReflectionImporterTests\r
-       {\r
-               private const string SomeNamespace = "some:urn";\r
-               private const string AnotherNamespace = "another:urn";\r
-               private const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";\r
-\r
-               // these Map methods re-create the XmlReflectionImporter at every call.\r
-\r
-               private XmlTypeMapping Map(Type t)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter();\r
-                       XmlTypeMapping tm = ri.ImportTypeMapping(t);\r
-                       //Debug.Print(tm);\r
-\r
-                       return tm;\r
-               }\r
-\r
-               private XmlTypeMapping Map(Type t, XmlRootAttribute root)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter();\r
-                       XmlTypeMapping tm = ri.ImportTypeMapping(t, root);\r
-\r
-                       return tm;\r
-               }\r
-\r
-               private XmlTypeMapping Map(Type t, string ns)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter(ns);\r
-                       XmlTypeMapping tm = ri.ImportTypeMapping(t);\r
-                       //Debug.Print(tm);\r
-\r
-                       return tm;\r
-               }\r
-\r
-               private XmlTypeMapping Map (Type t, string ns, XmlRootAttribute root)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter (ns);\r
-                       XmlTypeMapping tm = ri.ImportTypeMapping (t, root);\r
-\r
-                       return tm;\r
-               }\r
-\r
-               private XmlTypeMapping Map(Type t, XmlAttributeOverrides overrides)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter(overrides);\r
-                       XmlTypeMapping tm = ri.ImportTypeMapping(t);\r
-                       //Debug.Print(tm);\r
-\r
-                       return tm;\r
-               }\r
-\r
-               private XmlMembersMapping MembersMap(Type t, XmlAttributeOverrides overrides, \r
-                       XmlReflectionMember [] members, bool inContainer)\r
-               {\r
-                       XmlReflectionImporter ri = new XmlReflectionImporter(overrides);\r
-                       XmlMembersMapping mm = ri.ImportMembersMapping(null, null, members, inContainer);\r
-                       \r
-                       return mm;\r
-               }\r
-               \r
-               [Test]\r
-               public void TestIntTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(int));\r
-                       Assert.AreEqual ("int", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Int32", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestIntTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(int[]));\r
-                       Assert.AreEqual ("ArrayOfInt", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfInt32", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("Int32[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.Int32[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (int[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfInt", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfInt32", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Int32[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.Int32[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (int[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfInt", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfInt32", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Int32[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.Int32[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestStringTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(string));\r
-                       Assert.AreEqual ("string", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("String", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.String", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestStringTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (string[]));\r
-                       Assert.AreEqual ("ArrayOfString", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfString", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("String[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.String[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (string[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfString", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfString", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("String[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.String[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (string[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfString", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfString", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("String[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.String[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestObjectTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(object));\r
-                       Assert.AreEqual ("anyType", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Object", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Object", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestObjectTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (object[]));\r
-                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfObject", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("Object[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.Object[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (object[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfObject", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Object[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.Object[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (object[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObject", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Object[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.Object[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestByteTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(byte));\r
-                       Assert.AreEqual ("unsignedByte", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Byte", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Byte", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestByteTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(byte[]));\r
-                       Assert.AreEqual ("base64Binary", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-                       Assert.AreEqual ("Byte[]", tm.TypeName, "#A3");\r
-                       Assert.AreEqual ("System.Byte[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (byte[][]));\r
-                       Assert.AreEqual ("ArrayOfBase64Binary", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfByte", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Byte[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.Byte[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (byte[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfBase64Binary", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfByte", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Byte[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.Byte[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestBoolTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(bool));\r
-                       Assert.AreEqual ("boolean", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Boolean", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Boolean", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestShortTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(short));\r
-                       Assert.AreEqual ("short", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Int16", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Int16", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestUnsignedShortTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(ushort));\r
-                       Assert.AreEqual ("unsignedShort", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("UInt16", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.UInt16", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestUIntTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(uint));\r
-                       Assert.AreEqual ("unsignedInt", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("UInt32", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.UInt32", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestLongTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(long));\r
-                       Assert.AreEqual ("long", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Int64", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Int64", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestULongTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(ulong));\r
-                       Assert.AreEqual ("unsignedLong", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("UInt64", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.UInt64", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestFloatTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(float));\r
-                       Assert.AreEqual ("float", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Single", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Single", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDoubleTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(double));\r
-                       Assert.AreEqual ("double", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Double", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Double", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestDateTimeTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(DateTime));\r
-                       Assert.AreEqual ("dateTime", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("DateTime", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.DateTime", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestDateTimeTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (DateTime[]));\r
-                       Assert.AreEqual ("ArrayOfDateTime", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfDateTime", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("DateTime[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.DateTime[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (DateTime[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfDateTime", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfDateTime", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("DateTime[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.DateTime[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (DateTime[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfDateTime", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfDateTime", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("DateTime[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.DateTime[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestGuidTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(Guid));\r
-                       Assert.AreEqual ("guid", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Guid", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Guid", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestGuidTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (Guid[]));\r
-                       Assert.AreEqual ("ArrayOfGuid", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfGuid", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("Guid[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.Guid[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (Guid[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfGuid", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfGuid", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Guid[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.Guid[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (Guid[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfGuid", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfGuid", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Guid[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.Guid[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestDecimalTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(decimal));\r
-                       Assert.AreEqual ("decimal", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Decimal", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Decimal", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestXmlQualifiedNameTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(XmlQualifiedName));\r
-                       Assert.AreEqual ("QName", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("XmlQualifiedName", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Xml.XmlQualifiedName", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               public void TestSByteTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(sbyte));\r
-                       Assert.AreEqual ("byte", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SByte", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.SByte", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-\r
-               [Test]\r
-               public void TestCharTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(char));\r
-                       Assert.AreEqual ("char", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Char", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Char", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestCharTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (char[]));\r
-                       Assert.AreEqual ("ArrayOfChar", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfChar", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("Char[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.Char[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (char[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfChar", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfChar", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Char[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.Char[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (char[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfChar", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfChar", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Char[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.Char[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestXmlNodeTypeMapping ()\r
-               {\r
-                       Type type = typeof (XmlNode);\r
-\r
-                       XmlTypeMapping tm = Map (type);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#A1");\r
-                       Assert.IsNull (tm.Namespace, "#A2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#A3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (type, AnotherNamespace);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");\r
-                       Assert.IsNull (tm.Namespace, "#B2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#B3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#B4");\r
-\r
-                       XmlRootAttribute root = new XmlRootAttribute ("somename");\r
-                       root.Namespace = SomeNamespace;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#C1");\r
-                       Assert.IsNull (tm.Namespace, "#C2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#C3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#C4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#D1");\r
-                       Assert.IsNull (tm.Namespace, "#D2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#D3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#D4");\r
-\r
-                       root.Namespace = null;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#E1");\r
-                       Assert.IsNull (tm.Namespace, "#E2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#E3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#E4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#F1");\r
-                       Assert.IsNull (tm.Namespace, "#F2");\r
-                       Assert.AreEqual ("XmlNode", tm.TypeName, "#F3");\r
-                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#F4");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestXmlElementTypeMapping ()\r
-               {\r
-                       Type type = typeof (XmlElement);\r
-\r
-                       XmlTypeMapping tm = Map (type);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#1");\r
-                       Assert.IsNull (tm.Namespace, "#2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (type, AnotherNamespace);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");\r
-                       Assert.IsNull (tm.Namespace, "#B2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#B3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#B4");\r
-\r
-                       XmlRootAttribute root = new XmlRootAttribute ("somename");\r
-                       root.Namespace = SomeNamespace;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#C1");\r
-                       Assert.IsNull (tm.Namespace, "#C2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#C3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#C4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#D1");\r
-                       Assert.IsNull (tm.Namespace, "#D2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#D3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#D4");\r
-\r
-                       root.Namespace = null;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#E1");\r
-                       Assert.IsNull (tm.Namespace, "#E2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#E3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#E4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#F1");\r
-                       Assert.IsNull (tm.Namespace, "#F2");\r
-                       Assert.AreEqual ("XmlElement", tm.TypeName, "#F3");\r
-                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#F4");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestXmlNotationTypeMapping ()\r
-               {\r
-                       Type type = typeof (XmlNotation);\r
-\r
-                       XmlTypeMapping tm = Map (type);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#1");\r
-                       Assert.IsNull (tm.Namespace, "#2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (type, AnotherNamespace);\r
-                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");\r
-                       Assert.IsNull (tm.Namespace, "#B2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#B3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#B4");\r
-\r
-                       XmlRootAttribute root = new XmlRootAttribute ("somename");\r
-                       root.Namespace = SomeNamespace;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#C1");\r
-                       Assert.IsNull (tm.Namespace, "#C2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#C3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#C4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#D1");\r
-                       Assert.IsNull (tm.Namespace, "#D2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#D3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#D4");\r
-\r
-                       root.Namespace = null;\r
-                       tm = Map (type, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#E1");\r
-                       Assert.IsNull (tm.Namespace, "#E2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#E3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#E4");\r
-\r
-                       tm = Map (type, AnotherNamespace, root);\r
-                       Assert.AreEqual ("somename", tm.ElementName, "#F1");\r
-                       Assert.IsNull (tm.Namespace, "#F2");\r
-                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#F3");\r
-                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#F4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestXmlSerializableTypeMapping ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (Employee));\r
-                       Assert.AreEqual ("Employee", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Employee", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestXmlSerializableTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (Employee[]));\r
-                       Assert.AreEqual ("ArrayOfEmployee", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfEmployee", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("Employee[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (Employee[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfEmployee", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfEmployee", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("Employee[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (Employee[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfEmployee", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfEmployee", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("Employee[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestClassTypeMapping_NestedStruct ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (NestedStruct));\r
-                       Assert.AreEqual ("NestedStruct", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("NestedStruct", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.NestedStruct", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (ArgumentNullException))]\r
-               public void TestNullTypeMapping()\r
-               {\r
-                       Map(null);\r
-               }\r
-\r
-               [Test]\r
-               public void TestIntTypeMappingWithDefaultNamespaces()\r
-               {\r
-                       XmlTypeMapping tm = Map(typeof(int), SomeNamespace);\r
-                       Assert.AreEqual ("int", tm.ElementName, "#1");\r
-                       Assert.AreEqual (SomeNamespace, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Int32", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestStructTypeMapping ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (TimeSpan));\r
-                       Assert.AreEqual ("TimeSpan", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("TimeSpan", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.TimeSpan", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestStructTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (TimeSpan[]));\r
-                       Assert.AreEqual ("ArrayOfTimeSpan", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfTimeSpan", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("TimeSpan[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.TimeSpan[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (TimeSpan[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfTimeSpan", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfTimeSpan", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("TimeSpan[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.TimeSpan[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (TimeSpan[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfTimeSpan", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfTimeSpan", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("TimeSpan[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.TimeSpan[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestEnumTypeMapping ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (AttributeTargets));\r
-                       Assert.AreEqual ("AttributeTargets", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("AttributeTargets", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.AttributeTargets", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestEnumTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (AttributeTargets[]));\r
-                       Assert.AreEqual ("ArrayOfAttributeTargets", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfAttributeTargets", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("AttributeTargets[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("System.AttributeTargets[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (AttributeTargets[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAttributeTargets", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfAttributeTargets", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("AttributeTargets[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("System.AttributeTargets[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (AttributeTargets[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAttributeTargets", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAttributeTargets", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("AttributeTargets[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("System.AttributeTargets[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               public void TestClassTypeMapping()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClass));\r
-                       Assert.AreEqual ("SimpleClass", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SimpleClass", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass", tm.TypeFullName, "#4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TestClassTypeMapping_Array ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClass[]));\r
-                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfSimpleClass", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClass[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (SimpleClass[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClass[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (SimpleClass[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClass[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (NotSupportedException))]\r
-               public void TypeMapping_IDictionary ()\r
-               {\r
-                       // The type MonoTests.System.Xml.TestClasses.DictionaryWithIndexer \r
-                       // is not supported because it implements IDictionary.\r
-                       Map (typeof (DictionaryWithIndexer));\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TypeMapping_IEnumerable_SimpleClass ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerable));\r
-                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SimpleClassEnumerable", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerable[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfSimpleClassEnumerable", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerable[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerable[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerable", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerable[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerable[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerable", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerable[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TypeMapping_IEnumerable_Object ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (ObjectEnumerable));\r
-                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("ObjectEnumerable", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (ObjectEnumerable[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfObjectEnumerable", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("ObjectEnumerable[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (ObjectEnumerable[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfObjectEnumerable", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("ObjectEnumerable[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (ObjectEnumerable[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObjectEnumerable", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("ObjectEnumerable[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_IEnumerable_Object_NoMatchingAddMethod ()\r
-               {\r
-                       Map (typeof (ObjectEnumerableNoMatchingAddMethod));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_IEnumerable_Object_NoMatchingAddMethod_Array ()\r
-               {\r
-                       Map (typeof (ObjectEnumerableNoMatchingAddMethod[]));\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TypeMapping_IEnumerable_SimpleClass_PrivateCurrent ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerablePrivateCurrent));\r
-                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-#if ONLY_1_1\r
-               [Category ("NotDotNet")] // results in NullReferenceException in .NET 1.1 (SP1)\r
-#endif\r
-               public void TypeMapping_IEnumerable_SimpleClass_PrivateGetEnumerator ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator));\r
-                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_Object_NoMatchingAddMethod ()\r
-               {\r
-                       Map (typeof (ObjectCollectionNoMatchingAddMethod));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_Object_NoMatchingAddMethod_Array ()\r
-               {\r
-                       Map (typeof (ObjectCollectionNoMatchingAddMethod[]));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_SimpleClass_NoMatchingAddMethod ()\r
-               {\r
-                       Map (typeof (SimpleClassCollectionNoMatchingAddMethod));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_SimpleClass_NoMatchingAddMethod_Array ()\r
-               {\r
-                       Map (typeof (SimpleClassCollectionNoMatchingAddMethod[]));\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TypeMapping_ICollection_SimpleClass ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (SimpleClassCollection));\r
-                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("SimpleClassCollection", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (SimpleClassCollection[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfSimpleClassCollection", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassCollection[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (SimpleClassCollection[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassCollection", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassCollection[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (SimpleClassCollection[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassCollection", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("SimpleClassCollection[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-#if NET_2_0\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-#endif\r
-               public void TypeMapping_ICollection_Object ()\r
-               {\r
-                       XmlTypeMapping tm = Map (typeof (ObjectCollection));\r
-                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("ObjectCollection", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection", tm.TypeFullName, "#4");\r
-\r
-                       tm = Map (typeof (ObjectCollection[]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfObjectCollection", tm.TypeName, "#A3");\r
-#else\r
-                       Assert.AreEqual ("ObjectCollection[]", tm.TypeName, "#A3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[]", tm.TypeFullName, "#A4");\r
-\r
-                       tm = Map (typeof (ObjectCollection[][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfObjectCollection", tm.TypeName, "#B3");\r
-#else\r
-                       Assert.AreEqual ("ObjectCollection[][]", tm.TypeName, "#B3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[][]", tm.TypeFullName, "#B4");\r
-\r
-                       tm = Map (typeof (ObjectCollection[][][]));\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");\r
-                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");\r
-#if NET_2_0\r
-                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObjectCollection", tm.TypeName, "#C3");\r
-#else\r
-                       Assert.AreEqual ("ObjectCollection[][][]", tm.TypeName, "#C3");\r
-#endif\r
-                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[][][]", tm.TypeFullName, "#C4");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_Object_NoIntIndexer ()\r
-               {\r
-                       Map (typeof (ObjectCollectionNoIntIndexer));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_Object_NoIntIndexer_Array ()\r
-               {\r
-                       Map (typeof (ObjectCollectionNoIntIndexer[]));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_SimpleClass_NoIntIndexer ()\r
-               {\r
-                       Map (typeof (SimpleClassCollectionNoIntIndexer));\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TypeMapping_ICollection_SimpleClass_NoIntIndexer_Array ()\r
-               {\r
-                       Map (typeof (SimpleClassCollectionNoIntIndexer[]));\r
-               }\r
-\r
-               [Test]\r
-               public void TypeMapping_InvalidDefault ()\r
-               {\r
-                       XmlAttributes attrs = new XmlAttributes (typeof (Field).GetMember ("Modifiers") [0]);\r
-                       attrs.XmlDefaultValue = 2; // not a defined enum value\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       overrides.Add (typeof (Field), "Modifiers", attrs);\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#A1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");\r
-                               Assert.IsNotNull (ex.Message, "#A3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#A4");\r
-                               Assert.IsNotNull (ex.InnerException, "#A5");\r
-\r
-                               // There was an error reflecting field 'Modifiers'\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#A6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#A7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#A8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#A9");\r
-\r
-                               // Value '2' cannot be converted to System.Int32\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#A10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A11");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'2'") != -1, "#A12");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (int).FullName) != -1, "#A13");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#A14");\r
-                       }\r
-\r
-                       attrs.XmlDefaultValue = "2"; // not of the same type as the underlying enum type (System.Int32)\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.Message, "#B3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#B4");\r
-                               Assert.IsNotNull (ex.InnerException, "#B5");\r
-\r
-                               // There was an error reflecting field 'Modifiers'\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#B8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#B9");\r
-\r
-                               // Enum underlying type and the object must be same type or object.\r
-                               // Type passed in was 'System.String'; the enum underlying type was\r
-                               // 'System.Int32'.\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.InnerException.InnerException.GetType (), "#B10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B11");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (string).FullName) != -1, "#B12");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (int).FullName) != -1, "#B13");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#B14");\r
-                       }\r
-\r
-                       attrs.XmlDefaultValue = EnumDefaultValueNF.e2; // other enum type\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");\r
-                               Assert.IsNotNull (ex.Message, "#C3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#C4");\r
-                               Assert.IsNotNull (ex.InnerException, "#C5");\r
-\r
-                               // There was an error reflecting field 'Modifiers'\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#C7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#C8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#C9");\r
-\r
-                               // Object must be the same type as the enum. The type passed in\r
-                               // was MonoTests.System.Xml.TestClasses.EnumDefaultValueNF; the\r
-                               // enum type was MonoTests.System.Xml.TestClasses.MapModifiers\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.InnerException.InnerException.GetType (), "#C10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#C11");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#C12");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (MapModifiers).FullName) != -1, "#C13");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#C14");\r
-                       }\r
-\r
-                       attrs.XmlDefaultValue = (MapModifiers) 20; // non-existing enum value\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.Message, "#D3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#D4");\r
-                               Assert.IsNotNull (ex.InnerException, "#D5");\r
-\r
-                               // There was an error reflecting field 'Modifiers'\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#D8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#D9");\r
-\r
-                               // Value '20' cannot be converted to MonoTests.System.Xml.TestClasses.MapModifiers\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#D10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#D11");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'20'") != -1, "#D12");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (MapModifiers).FullName) != -1, "#D13");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#D14");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (ArgumentNullException))]\r
-               public void TypeMapping_Null ()\r
-               {\r
-                       Map ((Type) null);\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (NotSupportedException))]\r
-               public void TypeMapping_Void ()\r
-               {\r
-                       Map (typeof (void));\r
-               }\r
-\r
-               [Test]\r
-               public void TypeMapping_WrongChoices ()\r
-               {\r
-                       try {\r
-                               Map (typeof (WrongChoices));\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.WrongChoices'\r
-                               Assert.IsNotNull (ex.Message, "#2");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (WrongChoices).FullName + "'") != -1, "#3");\r
-                               Assert.IsNotNull (ex.InnerException, "#4");\r
-\r
-                               // There was an error reflecting field 'MyChoice'\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'MyChoice'") != -1, "#6");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#7");\r
-\r
-                               // Type MonoTests.System.Xml.TestClasses.ItemChoiceType is missing \r
-                               // enumeration value 'StrangeOne' for element 'StrangeOne' from\r
-                               // namespace ''.\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#8");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (ItemChoiceType).FullName) != -1, "#9");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'StrangeOne'") != -1, "#10");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("''") != -1, "#11");\r
-                       }\r
-               }\r
-\r
-               [Test] // bug #77591\r
-               public void TypeMapping_XmlText_PrimitiveTypes ()\r
-               {\r
-                       XmlAttributeOverrides overrides = null;\r
-                       XmlAttributes attrs = null;\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attrs = new  XmlAttributes ();\r
-                       attrs.XmlText = new XmlTextAttribute (typeof (int));\r
-                       overrides.Add (typeof (Field), "Modifiers", attrs);\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#A1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.Field'\r
-                               Assert.IsNotNull (ex.Message, "#A2");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (Field).FullName + "'") != -1, "#A3");\r
-                               Assert.IsNotNull (ex.InnerException, "#A4");\r
-\r
-                               // There was an error reflecting field 'Modifiers'\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#A5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#A6");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#A7");\r
-\r
-                               // The type for XmlText may not be specified for primitive types\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A8");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("XmlText") != -1, "#A9");\r
-                       }\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attrs = new XmlAttributes ();\r
-                       attrs.XmlText = new XmlTextAttribute (typeof (int));\r
-                       overrides.Add (typeof (Field), "Street", attrs);\r
-\r
-                       try {\r
-                               Map (typeof (Field), overrides);\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.Field'\r
-                               Assert.IsNotNull (ex.Message, "#B2");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (Field).FullName + "'") != -1, "#B3");\r
-                               Assert.IsNotNull (ex.InnerException, "#B4");\r
-\r
-                               // There was an error reflecting field 'Street'\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Street'") != -1, "#B6");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#B7");\r
-\r
-                               // The type for XmlText may not be specified for primitive types\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B8");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("XmlText") != -1, "#B9");\r
-                       }\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attrs = new XmlAttributes ();\r
-                       attrs.XmlText = new XmlTextAttribute (typeof (MapModifiers));\r
-                       overrides.Add (typeof (Field), "Modifiers", attrs);\r
-                       Map (typeof (Field), overrides);\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attrs = new XmlAttributes ();\r
-                       attrs.XmlText = new XmlTextAttribute (typeof (string));\r
-                       overrides.Add (typeof (Field), "Street", attrs);\r
-                       Map (typeof (Field), overrides);\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn\r
-               public void TestImportMembersMapping()\r
-               {\r
-                       Type type = typeof(SimpleClass);\r
-                       XmlAttributes attrs = new  XmlAttributes();\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides();\r
-                       overrides.Add(typeof(SimpleClass), attrs);\r
-\r
-                       XmlReflectionMember[] members = new XmlReflectionMember[0];\r
-                       XmlMembersMapping mm;\r
-                       try\r
-                       {\r
-                               mm = MembersMap(type, overrides, members, true);\r
-                               Assert.Fail("Should not be able to fetch an empty XmlMembersMapping");\r
-                       }\r
-                       catch (Exception)\r
-                       {\r
-                       }\r
-                       \r
-                       XmlReflectionMember rm = new XmlReflectionMember();\r
-                       rm.IsReturnValue = false;\r
-                       rm.MemberName = "something";\r
-                       rm.MemberType = typeof(string);\r
-                       members = new XmlReflectionMember[1];\r
-                       members[0] = rm;\r
-\r
-                       mm = MembersMap(type, overrides, members, false);\r
-\r
-                       Equals(mm.Count, 1);\r
-\r
-                       XmlMemberMapping smm = mm[0];\r
-                       Assert.IsFalse (smm.Any, "#1");\r
-                       Assert.AreEqual ("something", smm.ElementName, "#2");\r
-                       Assert.AreEqual ("something", smm.MemberName, "#3");\r
-                       Assert.IsNull (smm.Namespace, "#4");\r
-                       Assert.AreEqual ("System.String", smm.TypeFullName, "#5");\r
-                       Assert.AreEqual ("string", smm.TypeName, "#6");\r
-#if NET_2_0\r
-                       Assert.AreEqual (XmlSchemaNamespace, smm.TypeNamespace, "#7");\r
-#else\r
-                       Assert.IsNull (smm.TypeNamespace, "#7");\r
-#endif\r
-\r
-                       rm = new XmlReflectionMember();\r
-                       rm.IsReturnValue = false;\r
-                       rm.MemberName = "nothing";\r
-                       rm.MemberType = typeof(string);\r
-                       members = new XmlReflectionMember[1];\r
-                       members[0] = rm;\r
-\r
-                       mm = MembersMap(type, overrides, members, false);\r
-                       Assert.AreEqual (1, mm.Count, "#8");\r
-               }\r
-\r
-               [Test]\r
-               public void TestIntTypeMappingWithXmlRootAttribute()\r
-               {\r
-                       const string TheNamespace = "another:urn";\r
-                       XmlRootAttribute root = new XmlRootAttribute("price");\r
-                       root.Namespace = TheNamespace;\r
-                       \r
-                       XmlTypeMapping tm = Map(typeof(int), root);\r
-                       Assert.AreEqual ("price", tm.ElementName, "#1");\r
-                       Assert.AreEqual (TheNamespace, tm.Namespace, "#2");\r
-                       Assert.AreEqual ("Int32", tm.TypeName, "#3");\r
-                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");\r
-               }\r
-               \r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TestSerializeWrongChoice ()\r
-               {\r
-                       new XmlSerializer (typeof(WrongChoices));\r
-               }\r
-\r
-               public class Employee : IXmlSerializable\r
-               {\r
-                       private string _firstName;\r
-                       private string _lastName;\r
-                       private string _address;\r
-\r
-                       public XmlSchema GetSchema ()\r
-                       {\r
-                               return null;\r
-                       }\r
-\r
-                       public void WriteXml (XmlWriter writer)\r
-                       {\r
-                               writer.WriteStartElement ("employee", "urn:devx-com");\r
-                               writer.WriteAttributeString ("firstName", _firstName);\r
-                               writer.WriteAttributeString ("lastName", _lastName);\r
-                               writer.WriteAttributeString ("address", _address);\r
-                               writer.WriteEndElement ();\r
-                       }\r
-\r
-                       public void ReadXml (XmlReader reader)\r
-                       {\r
-                               XmlNodeType type = reader.MoveToContent ();\r
-                               if (type == XmlNodeType.Element && reader.LocalName == "employee") {\r
-                                       _firstName = reader["firstName"];\r
-                                       _lastName = reader["lastName"];\r
-                                       _address = reader["address"];\r
-                               }\r
-                       }\r
-               }\r
-\r
-               public class NestedStruct\r
-               {\r
-                       public TimeSpan Period = TimeSpan.MaxValue;\r
-               }\r
-\r
-               public class ObjectEnumerable : IEnumerable\r
-               {\r
-                       public void Add (int value)\r
-                       {\r
-                       }\r
-\r
-                       public void Add (object value)\r
-                       {\r
-                       }\r
-\r
-                       public IEnumerator GetEnumerator ()\r
-                       {\r
-                               return new ArrayList ().GetEnumerator ();\r
-                       }\r
-               }\r
-\r
-               public class SimpleClassEnumerable : IEnumerable\r
-               {\r
-                       public void Add (int value)\r
-                       {\r
-                       }\r
-\r
-                       public void Add (object value)\r
-                       {\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public SimpleClassEnumerator GetEnumerator ()\r
-                       {\r
-                               return new SimpleClassEnumerator (new ArrayList ());\r
-                       }\r
-               }\r
-\r
-               public class SimpleClassEnumerablePrivateGetEnumerator : IEnumerable\r
-               {\r
-                       public void Add (object value)\r
-                       {\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return new ArrayList ().GetEnumerator ();\r
-                       }\r
-               }\r
-\r
-               public class SimpleClassEnumerablePrivateCurrent : IEnumerable\r
-               {\r
-                       public void Add (object value)\r
-                       {\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public NoCurrentEnumerator GetEnumerator ()\r
-                       {\r
-                               return new NoCurrentEnumerator (new ArrayList ());\r
-                       }\r
-               }\r
-\r
-               // GetEnumerator().Current returns object, but there's no corresponding\r
-               // Add (System.Object) method\r
-               public class ObjectEnumerableNoMatchingAddMethod : IEnumerable\r
-               {\r
-                       public void Add (int value)\r
-                       {\r
-                       }\r
-\r
-                       public IEnumerator GetEnumerator ()\r
-                       {\r
-                               return new ArrayList ().GetEnumerator ();\r
-                       }\r
-               }\r
-\r
-               // GetEnumerator().Current returns SimpleClass, but there's no \r
-               // corresponding Add (SimpleClass) method\r
-               public class SimpleClassCollectionNoMatchingAddMethod : ICollection\r
-               {\r
-                       public SimpleClass this[int index]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return (SimpleClass) _list[index];\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public SimpleClassEnumerator GetEnumerator ()\r
-                       {\r
-                               return new SimpleClassEnumerator (_list);\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               // GetEnumerator().Current returns object, but there's no corresponding\r
-               // Add (System.Object) method\r
-               public class ObjectCollectionNoMatchingAddMethod : ICollection\r
-               {\r
-                       public object this[int index]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return _list[index];\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public IEnumerator GetEnumerator ()\r
-                       {\r
-                               return _list.GetEnumerator ();\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               // Does not have int indexer.\r
-               public class SimpleClassCollectionNoIntIndexer : ICollection\r
-               {\r
-                       public SimpleClass this[string name]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return new SimpleClass ();\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public SimpleClassEnumerator GetEnumerator ()\r
-                       {\r
-                               return new SimpleClassEnumerator (_list);\r
-                       }\r
-\r
-                       public void Add (SimpleClass value)\r
-                       {\r
-                               _list.Add (value);\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               // Does not have int indexer.\r
-               public class ObjectCollectionNoIntIndexer : ICollection\r
-               {\r
-                       public object this[string name]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return new SimpleClass ();\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       public IEnumerator GetEnumerator ()\r
-                       {\r
-                               return _list.GetEnumerator ();\r
-                       }\r
-\r
-                       public void Add (object value)\r
-                       {\r
-                               _list.Add (value);\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               public class SimpleClassCollection : ICollection\r
-               {\r
-                       public SimpleClass this[int index]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return (SimpleClass) _list[index];\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       IEnumerator IEnumerable.GetEnumerator ()\r
-                       {\r
-                               return GetEnumerator ();\r
-                       }\r
-\r
-                       public SimpleClassEnumerator GetEnumerator ()\r
-                       {\r
-                               return new SimpleClassEnumerator (_list);\r
-                       }\r
-\r
-                       public void Add (SimpleClass value)\r
-                       {\r
-                               _list.Add (value);\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               public class ObjectCollection : ICollection\r
-               {\r
-                       public object this[int name]\r
-                       {\r
-                               get\r
-                               {\r
-                                       return new SimpleClass ();\r
-                               }\r
-                       }\r
-\r
-                       public int Count\r
-                       {\r
-                               get { return _list.Count; }\r
-                       }\r
-\r
-                       public bool IsSynchronized\r
-                       {\r
-                               get { return _list.IsSynchronized; }\r
-                       }\r
-\r
-                       public object SyncRoot\r
-                       {\r
-                               get { return _list.SyncRoot; }\r
-                       }\r
-\r
-                       public void CopyTo (Array array, int index)\r
-                       {\r
-                               _list.CopyTo (array, index);\r
-                       }\r
-\r
-                       public IEnumerator GetEnumerator ()\r
-                       {\r
-                               return _list.GetEnumerator ();\r
-                       }\r
-\r
-                       public void Add (object value)\r
-                       {\r
-                               _list.Add (value);\r
-                       }\r
-\r
-                       private ArrayList _list = new ArrayList ();\r
-               }\r
-\r
-               public class SimpleClassEnumerator : IEnumerator\r
-               {\r
-                       internal SimpleClassEnumerator (ArrayList arguments)\r
-                       {\r
-                               IEnumerable temp = (IEnumerable) (arguments);\r
-                               _baseEnumerator = temp.GetEnumerator ();\r
-                       }\r
-                       public SimpleClass Current\r
-                       {\r
-                               get { return (SimpleClass) _baseEnumerator.Current; }\r
-                       }\r
-\r
-                       object IEnumerator.Current\r
-                       {\r
-                               get { return _baseEnumerator.Current; }\r
-                       }\r
-\r
-                       public bool MoveNext ()\r
-                       {\r
-                               return _baseEnumerator.MoveNext ();\r
-                       }\r
-\r
-                       bool IEnumerator.MoveNext ()\r
-                       {\r
-                               return _baseEnumerator.MoveNext ();\r
-                       }\r
-\r
-                       public void Reset ()\r
-                       {\r
-                               _baseEnumerator.Reset ();\r
-                       }\r
-\r
-                       void IEnumerator.Reset ()\r
-                       {\r
-                               _baseEnumerator.Reset ();\r
-                       }\r
-\r
-                       private IEnumerator _baseEnumerator;\r
-               }\r
-\r
-               public class NoCurrentEnumerator : IEnumerator\r
-               {\r
-                       internal NoCurrentEnumerator (ArrayList arguments)\r
-                       {\r
-                               IEnumerable temp = (IEnumerable) (arguments);\r
-                               _baseEnumerator = temp.GetEnumerator ();\r
-                       }\r
-\r
-                       object IEnumerator.Current\r
-                       {\r
-                               get { return _baseEnumerator.Current; }\r
-                       }\r
-\r
-                       public bool MoveNext ()\r
-                       {\r
-                               return _baseEnumerator.MoveNext ();\r
-                       }\r
-\r
-                       bool IEnumerator.MoveNext ()\r
-                       {\r
-                               return _baseEnumerator.MoveNext ();\r
-                       }\r
-\r
-                       public void Reset ()\r
-                       {\r
-                               _baseEnumerator.Reset ();\r
-                       }\r
-\r
-                       void IEnumerator.Reset ()\r
-                       {\r
-                               _baseEnumerator.Reset ();\r
-                       }\r
-\r
-                       private IEnumerator _baseEnumerator;\r
-               }\r
-       }\r
-}\r
-\r
+//
+// System.Xml.Serialization.XmlReflectionImporterTests
+//
+// Author:
+//   Erik LeBel (eriklebel@yahoo.ca)
+//
+// (C) 2003 Erik LeBel
+// 
+// FIXME test some of these with Xml Attributes attached to some members: 
+// do the names get carried over to Element for XmlAttributeAttribute and XmlElementAttribute?
+// 
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+using MonoTests.System.Xml.TestClasses;
+
+namespace MonoTests.System.XmlSerialization
+{
+       // debugging class
+       internal class Debug
+       {
+               public static void Print(XmlTypeMapping tm)
+               {
+                       Console.WriteLine("/XmlTypeMapping:");
+                       Console.WriteLine("ElementName: {0} ", tm.ElementName);
+                       Console.WriteLine("Namespace: {0} ", tm.Namespace);
+                       Console.WriteLine("TypeName: {0} ", tm.TypeName);
+                       Console.WriteLine("FullTypeName: {0} ", tm.TypeFullName);
+               }
+
+               public static void Print(XmlMemberMapping mm)
+               {
+                       Console.WriteLine("/XmlMemberMapping:");
+                       Console.WriteLine("Any: {0} ", mm.Any);
+                       Console.WriteLine("ElementName: {0} ", mm.ElementName);
+                       Console.WriteLine("MemberName: {0} ", mm.MemberName);
+                       Console.WriteLine("Namespace: {0} ", mm.Namespace);
+                       Console.WriteLine("TypeFullName: {0} ", mm.TypeFullName);
+                       Console.WriteLine("TypeName: {0} ", mm.TypeName);
+                       Console.WriteLine("TypeNamespace: {0} ", mm.TypeNamespace);
+               }
+       }
+
+       [TestFixture]
+       public class XmlReflectionImporterTests
+       {
+               private const string SomeNamespace = "some:urn";
+               private const string AnotherNamespace = "another:urn";
+               private const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";
+
+               // these Map methods re-create the XmlReflectionImporter at every call.
+
+               private XmlTypeMapping Map(Type t)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter();
+                       XmlTypeMapping tm = ri.ImportTypeMapping(t);
+                       //Debug.Print(tm);
+
+                       return tm;
+               }
+
+               private XmlTypeMapping Map(Type t, XmlRootAttribute root)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter();
+                       XmlTypeMapping tm = ri.ImportTypeMapping(t, root);
+
+                       return tm;
+               }
+
+               private XmlTypeMapping Map(Type t, string ns)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter(ns);
+                       XmlTypeMapping tm = ri.ImportTypeMapping(t);
+                       //Debug.Print(tm);
+
+                       return tm;
+               }
+
+               private XmlTypeMapping Map (Type t, string ns, XmlRootAttribute root)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter (ns);
+                       XmlTypeMapping tm = ri.ImportTypeMapping (t, root);
+
+                       return tm;
+               }
+
+               private XmlTypeMapping Map(Type t, XmlAttributeOverrides overrides)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter(overrides);
+                       XmlTypeMapping tm = ri.ImportTypeMapping(t);
+                       //Debug.Print(tm);
+
+                       return tm;
+               }
+
+               private XmlMembersMapping MembersMap(Type t, XmlAttributeOverrides overrides, 
+                       XmlReflectionMember [] members, bool inContainer)
+               {
+                       XmlReflectionImporter ri = new XmlReflectionImporter(overrides);
+                       XmlMembersMapping mm = ri.ImportMembersMapping(null, null, members, inContainer);
+                       
+                       return mm;
+               }
+               
+               [Test]
+               public void TestIntTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(int));
+                       Assert.AreEqual ("int", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Int32", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestIntTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map(typeof(int[]));
+                       Assert.AreEqual ("ArrayOfInt", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfInt32", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("Int32[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.Int32[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (int[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfInt", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfInt32", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Int32[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.Int32[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (int[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfInt", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfInt32", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Int32[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.Int32[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestStringTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(string));
+                       Assert.AreEqual ("string", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("String", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.String", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestStringTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (string[]));
+                       Assert.AreEqual ("ArrayOfString", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfString", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("String[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.String[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (string[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfString", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfString", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("String[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.String[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (string[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfString", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfString", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("String[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.String[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestObjectTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(object));
+                       Assert.AreEqual ("anyType", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Object", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Object", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestObjectTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (object[]));
+                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfObject", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("Object[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.Object[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (object[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfObject", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Object[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.Object[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (object[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObject", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Object[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.Object[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestByteTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(byte));
+                       Assert.AreEqual ("unsignedByte", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Byte", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Byte", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestByteTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map(typeof(byte[]));
+                       Assert.AreEqual ("base64Binary", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+                       Assert.AreEqual ("Byte[]", tm.TypeName, "#A3");
+                       Assert.AreEqual ("System.Byte[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (byte[][]));
+                       Assert.AreEqual ("ArrayOfBase64Binary", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfByte", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Byte[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.Byte[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (byte[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfBase64Binary", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfByte", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Byte[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.Byte[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestBoolTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(bool));
+                       Assert.AreEqual ("boolean", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Boolean", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Boolean", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+               public void TestShortTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(short));
+                       Assert.AreEqual ("short", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Int16", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Int16", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+               public void TestUnsignedShortTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(ushort));
+                       Assert.AreEqual ("unsignedShort", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("UInt16", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.UInt16", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestUIntTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(uint));
+                       Assert.AreEqual ("unsignedInt", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("UInt32", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.UInt32", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestLongTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(long));
+                       Assert.AreEqual ("long", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Int64", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Int64", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestULongTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(ulong));
+                       Assert.AreEqual ("unsignedLong", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("UInt64", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.UInt64", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestFloatTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(float));
+                       Assert.AreEqual ("float", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Single", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Single", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestDoubleTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(double));
+                       Assert.AreEqual ("double", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Double", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Double", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestDateTimeTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(DateTime));
+                       Assert.AreEqual ("dateTime", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("DateTime", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.DateTime", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestDateTimeTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (DateTime[]));
+                       Assert.AreEqual ("ArrayOfDateTime", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfDateTime", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("DateTime[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.DateTime[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (DateTime[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfDateTime", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfDateTime", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("DateTime[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.DateTime[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (DateTime[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfDateTime", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfDateTime", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("DateTime[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.DateTime[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestGuidTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(Guid));
+                       Assert.AreEqual ("guid", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Guid", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Guid", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestGuidTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (Guid[]));
+                       Assert.AreEqual ("ArrayOfGuid", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfGuid", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("Guid[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.Guid[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (Guid[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfGuid", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfGuid", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Guid[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.Guid[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (Guid[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfGuid", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfGuid", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Guid[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.Guid[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestDecimalTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(decimal));
+                       Assert.AreEqual ("decimal", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Decimal", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Decimal", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestXmlQualifiedNameTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(XmlQualifiedName));
+                       Assert.AreEqual ("QName", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("XmlQualifiedName", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Xml.XmlQualifiedName", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               public void TestSByteTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(sbyte));
+                       Assert.AreEqual ("byte", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SByte", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.SByte", tm.TypeFullName, "#4");
+               }
+               
+
+               [Test]
+               public void TestCharTypeMapping()
+               {
+                       XmlTypeMapping tm = Map(typeof(char));
+                       Assert.AreEqual ("char", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Char", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Char", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestCharTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (char[]));
+                       Assert.AreEqual ("ArrayOfChar", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfChar", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("Char[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.Char[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (char[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfChar", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfChar", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Char[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.Char[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (char[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfChar", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfChar", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Char[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.Char[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestXmlNodeTypeMapping ()
+               {
+                       Type type = typeof (XmlNode);
+
+                       XmlTypeMapping tm = Map (type);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#A1");
+                       Assert.IsNull (tm.Namespace, "#A2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#A3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#A4");
+
+                       tm = Map (type, AnotherNamespace);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");
+                       Assert.IsNull (tm.Namespace, "#B2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#B3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#B4");
+
+                       XmlRootAttribute root = new XmlRootAttribute ("somename");
+                       root.Namespace = SomeNamespace;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#C1");
+                       Assert.IsNull (tm.Namespace, "#C2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#C3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#C4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#D1");
+                       Assert.IsNull (tm.Namespace, "#D2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#D3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#D4");
+
+                       root.Namespace = null;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#E1");
+                       Assert.IsNull (tm.Namespace, "#E2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#E3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#E4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#F1");
+                       Assert.IsNull (tm.Namespace, "#F2");
+                       Assert.AreEqual ("XmlNode", tm.TypeName, "#F3");
+                       Assert.AreEqual ("System.Xml.XmlNode", tm.TypeFullName, "#F4");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestXmlElementTypeMapping ()
+               {
+                       Type type = typeof (XmlElement);
+
+                       XmlTypeMapping tm = Map (type);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#1");
+                       Assert.IsNull (tm.Namespace, "#2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#4");
+
+                       tm = Map (type, AnotherNamespace);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");
+                       Assert.IsNull (tm.Namespace, "#B2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#B3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#B4");
+
+                       XmlRootAttribute root = new XmlRootAttribute ("somename");
+                       root.Namespace = SomeNamespace;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#C1");
+                       Assert.IsNull (tm.Namespace, "#C2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#C3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#C4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#D1");
+                       Assert.IsNull (tm.Namespace, "#D2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#D3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#D4");
+
+                       root.Namespace = null;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#E1");
+                       Assert.IsNull (tm.Namespace, "#E2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#E3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#E4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#F1");
+                       Assert.IsNull (tm.Namespace, "#F2");
+                       Assert.AreEqual ("XmlElement", tm.TypeName, "#F3");
+                       Assert.AreEqual ("System.Xml.XmlElement", tm.TypeFullName, "#F4");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestXmlNotationTypeMapping ()
+               {
+                       Type type = typeof (XmlNotation);
+
+                       XmlTypeMapping tm = Map (type);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#1");
+                       Assert.IsNull (tm.Namespace, "#2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#4");
+
+                       tm = Map (type, AnotherNamespace);
+                       Assert.AreEqual (string.Empty, tm.ElementName, "#B1");
+                       Assert.IsNull (tm.Namespace, "#B2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#B3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#B4");
+
+                       XmlRootAttribute root = new XmlRootAttribute ("somename");
+                       root.Namespace = SomeNamespace;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#C1");
+                       Assert.IsNull (tm.Namespace, "#C2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#C3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#C4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#D1");
+                       Assert.IsNull (tm.Namespace, "#D2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#D3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#D4");
+
+                       root.Namespace = null;
+                       tm = Map (type, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#E1");
+                       Assert.IsNull (tm.Namespace, "#E2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#E3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#E4");
+
+                       tm = Map (type, AnotherNamespace, root);
+                       Assert.AreEqual ("somename", tm.ElementName, "#F1");
+                       Assert.IsNull (tm.Namespace, "#F2");
+                       Assert.AreEqual ("XmlNotation", tm.TypeName, "#F3");
+                       Assert.AreEqual ("System.Xml.XmlNotation", tm.TypeFullName, "#F4");
+               }
+
+               [Test]
+               public void TestXmlSerializableTypeMapping ()
+               {
+                       XmlTypeMapping tm = Map (typeof (Employee));
+                       Assert.AreEqual ("Employee", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("Employee", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestXmlSerializableTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (Employee[]));
+                       Assert.AreEqual ("ArrayOfEmployee", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfEmployee", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("Employee[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (Employee[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfEmployee", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfEmployee", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("Employee[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (Employee[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfEmployee", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfEmployee", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("Employee[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.Employee[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestClassTypeMapping_NestedStruct ()
+               {
+                       XmlTypeMapping tm = Map (typeof (NestedStruct));
+                       Assert.AreEqual ("NestedStruct", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("NestedStruct", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.NestedStruct", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestNullTypeMapping()
+               {
+                       Map(null);
+               }
+
+               [Test]
+               public void TestIntTypeMappingWithDefaultNamespaces()
+               {
+                       XmlTypeMapping tm = Map(typeof(int), SomeNamespace);
+                       Assert.AreEqual ("int", tm.ElementName, "#1");
+                       Assert.AreEqual (SomeNamespace, tm.Namespace, "#2");
+                       Assert.AreEqual ("Int32", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestStructTypeMapping ()
+               {
+                       XmlTypeMapping tm = Map (typeof (TimeSpan));
+                       Assert.AreEqual ("TimeSpan", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("TimeSpan", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.TimeSpan", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestStructTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (TimeSpan[]));
+                       Assert.AreEqual ("ArrayOfTimeSpan", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfTimeSpan", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("TimeSpan[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.TimeSpan[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (TimeSpan[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfTimeSpan", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfTimeSpan", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("TimeSpan[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.TimeSpan[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (TimeSpan[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfTimeSpan", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfTimeSpan", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("TimeSpan[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.TimeSpan[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestEnumTypeMapping ()
+               {
+                       XmlTypeMapping tm = Map (typeof (AttributeTargets));
+                       Assert.AreEqual ("AttributeTargets", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("AttributeTargets", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.AttributeTargets", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestEnumTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (AttributeTargets[]));
+                       Assert.AreEqual ("ArrayOfAttributeTargets", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfAttributeTargets", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("AttributeTargets[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("System.AttributeTargets[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (AttributeTargets[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfAttributeTargets", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfAttributeTargets", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("AttributeTargets[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("System.AttributeTargets[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (AttributeTargets[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAttributeTargets", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAttributeTargets", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("AttributeTargets[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("System.AttributeTargets[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               public void TestClassTypeMapping()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClass));
+                       Assert.AreEqual ("SimpleClass", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SimpleClass", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass", tm.TypeFullName, "#4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TestClassTypeMapping_Array ()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClass[]));
+                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfSimpleClass", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("SimpleClass[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (SimpleClass[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("SimpleClass[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (SimpleClass[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("SimpleClass[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.Xml.TestClasses.SimpleClass[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void TypeMapping_IDictionary ()
+               {
+                       // The type MonoTests.System.Xml.TestClasses.DictionaryWithIndexer 
+                       // is not supported because it implements IDictionary.
+                       Map (typeof (DictionaryWithIndexer));
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TypeMapping_IEnumerable_SimpleClass ()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerable));
+                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SimpleClassEnumerable", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (SimpleClassEnumerable[]));
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfSimpleClassEnumerable", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerable[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (SimpleClassEnumerable[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerable", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerable[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (SimpleClassEnumerable[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerable", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerable[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerable[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TypeMapping_IEnumerable_Object ()
+               {
+                       XmlTypeMapping tm = Map (typeof (ObjectEnumerable));
+                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("ObjectEnumerable", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (ObjectEnumerable[]));
+                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfObjectEnumerable", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("ObjectEnumerable[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (ObjectEnumerable[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfObjectEnumerable", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("ObjectEnumerable[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (ObjectEnumerable[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObjectEnumerable", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("ObjectEnumerable[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectEnumerable[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_IEnumerable_Object_NoMatchingAddMethod ()
+               {
+                       Map (typeof (ObjectEnumerableNoMatchingAddMethod));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_IEnumerable_Object_NoMatchingAddMethod_Array ()
+               {
+                       Map (typeof (ObjectEnumerableNoMatchingAddMethod[]));
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TypeMapping_IEnumerable_SimpleClass_PrivateCurrent ()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerablePrivateCurrent));
+                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[]));
+                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateCurrent[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerablePrivateCurrent", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateCurrent[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateCurrent[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+#if ONLY_1_1
+               [Category ("NotDotNet")] // results in NullReferenceException in .NET 1.1 (SP1)
+#endif
+               public void TypeMapping_IEnumerable_SimpleClass_PrivateGetEnumerator ()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator));
+                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[]));
+                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (SimpleClassEnumerablePrivateGetEnumerator[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassEnumerablePrivateGetEnumerator", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("SimpleClassEnumerablePrivateGetEnumerator[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassEnumerablePrivateGetEnumerator[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_Object_NoMatchingAddMethod ()
+               {
+                       Map (typeof (ObjectCollectionNoMatchingAddMethod));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_Object_NoMatchingAddMethod_Array ()
+               {
+                       Map (typeof (ObjectCollectionNoMatchingAddMethod[]));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_SimpleClass_NoMatchingAddMethod ()
+               {
+                       Map (typeof (SimpleClassCollectionNoMatchingAddMethod));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_SimpleClass_NoMatchingAddMethod_Array ()
+               {
+                       Map (typeof (SimpleClassCollectionNoMatchingAddMethod[]));
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TypeMapping_ICollection_SimpleClass ()
+               {
+                       XmlTypeMapping tm = Map (typeof (SimpleClassCollection));
+                       Assert.AreEqual ("ArrayOfSimpleClass", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("SimpleClassCollection", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (SimpleClassCollection[]));
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClass", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfSimpleClassCollection", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("SimpleClassCollection[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (SimpleClassCollection[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfSimpleClassCollection", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("SimpleClassCollection[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (SimpleClassCollection[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfSimpleClass", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfSimpleClassCollection", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("SimpleClassCollection[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.SimpleClassCollection[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+#if NET_2_0
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+#endif
+               public void TypeMapping_ICollection_Object ()
+               {
+                       XmlTypeMapping tm = Map (typeof (ObjectCollection));
+                       Assert.AreEqual ("ArrayOfAnyType", tm.ElementName, "#1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#2");
+                       Assert.AreEqual ("ObjectCollection", tm.TypeName, "#3");
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection", tm.TypeFullName, "#4");
+
+                       tm = Map (typeof (ObjectCollection[]));
+                       Assert.AreEqual ("ArrayOfArrayOfAnyType", tm.ElementName, "#A1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#A2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfObjectCollection", tm.TypeName, "#A3");
+#else
+                       Assert.AreEqual ("ObjectCollection[]", tm.TypeName, "#A3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[]", tm.TypeFullName, "#A4");
+
+                       tm = Map (typeof (ObjectCollection[][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#B1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#B2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfObjectCollection", tm.TypeName, "#B3");
+#else
+                       Assert.AreEqual ("ObjectCollection[][]", tm.TypeName, "#B3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[][]", tm.TypeFullName, "#B4");
+
+                       tm = Map (typeof (ObjectCollection[][][]));
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfArrayOfAnyType", tm.ElementName, "#C1");
+                       Assert.AreEqual (string.Empty, tm.Namespace, "#C2");
+#if NET_2_0
+                       Assert.AreEqual ("ArrayOfArrayOfArrayOfObjectCollection", tm.TypeName, "#C3");
+#else
+                       Assert.AreEqual ("ObjectCollection[][][]", tm.TypeName, "#C3");
+#endif
+                       Assert.AreEqual ("MonoTests.System.XmlSerialization.XmlReflectionImporterTests.ObjectCollection[][][]", tm.TypeFullName, "#C4");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_Object_NoIntIndexer ()
+               {
+                       Map (typeof (ObjectCollectionNoIntIndexer));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_Object_NoIntIndexer_Array ()
+               {
+                       Map (typeof (ObjectCollectionNoIntIndexer[]));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_SimpleClass_NoIntIndexer ()
+               {
+                       Map (typeof (SimpleClassCollectionNoIntIndexer));
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TypeMapping_ICollection_SimpleClass_NoIntIndexer_Array ()
+               {
+                       Map (typeof (SimpleClassCollectionNoIntIndexer[]));
+               }
+
+               [Test]
+               public void TypeMapping_InvalidDefault ()
+               {
+                       XmlAttributes attrs = new XmlAttributes (typeof (Field).GetMember ("Modifiers") [0]);
+                       attrs.XmlDefaultValue = 2; // not a defined enum value
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       overrides.Add (typeof (Field), "Modifiers", attrs);
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
+                               Assert.IsNotNull (ex.Message, "#A3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#A4");
+                               Assert.IsNotNull (ex.InnerException, "#A5");
+
+                               // There was an error reflecting field 'Modifiers'
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#A6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#A7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#A8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#A9");
+
+                               // Value '2' cannot be converted to System.Int32
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#A10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A11");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'2'") != -1, "#A12");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (int).FullName) != -1, "#A13");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#A14");
+                       }
+
+                       attrs.XmlDefaultValue = "2"; // not of the same type as the underlying enum type (System.Int32)
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#B4");
+                               Assert.IsNotNull (ex.InnerException, "#B5");
+
+                               // There was an error reflecting field 'Modifiers'
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#B7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#B8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#B9");
+
+                               // Enum underlying type and the object must be same type or object.
+                               // Type passed in was 'System.String'; the enum underlying type was
+                               // 'System.Int32'.
+                               Assert.AreEqual (typeof (ArgumentException), ex.InnerException.InnerException.GetType (), "#B10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B11");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (string).FullName) != -1, "#B12");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (int).FullName) != -1, "#B13");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#B14");
+                       }
+
+                       attrs.XmlDefaultValue = EnumDefaultValueNF.e2; // other enum type
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.Message, "#C3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#C4");
+                               Assert.IsNotNull (ex.InnerException, "#C5");
+
+                               // There was an error reflecting field 'Modifiers'
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#C6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#C7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#C8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#C9");
+
+                               // Object must be the same type as the enum. The type passed in
+                               // was MonoTests.System.Xml.TestClasses.EnumDefaultValueNF; the
+                               // enum type was MonoTests.System.Xml.TestClasses.MapModifiers
+                               Assert.AreEqual (typeof (ArgumentException), ex.InnerException.InnerException.GetType (), "#C10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#C11");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#C12");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (MapModifiers).FullName) != -1, "#C13");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#C14");
+                       }
+
+                       attrs.XmlDefaultValue = (MapModifiers) 20; // non-existing enum value
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type MonoTests.System.Xml.TestClasses.Field
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.Message, "#D3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (Field).FullName) != -1, "#D4");
+                               Assert.IsNotNull (ex.InnerException, "#D5");
+
+                               // There was an error reflecting field 'Modifiers'
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#D8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#D9");
+
+                               // Value '20' cannot be converted to MonoTests.System.Xml.TestClasses.MapModifiers
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#D10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#D11");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'20'") != -1, "#D12");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (MapModifiers).FullName) != -1, "#D13");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#D14");
+                       }
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TypeMapping_Null ()
+               {
+                       Map ((Type) null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void TypeMapping_Void ()
+               {
+                       Map (typeof (void));
+               }
+
+               [Test]
+               public void TypeMapping_WrongChoices ()
+               {
+                       try {
+                               Map (typeof (WrongChoices));
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.WrongChoices'
+                               Assert.IsNotNull (ex.Message, "#2");
+                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (WrongChoices).FullName + "'") != -1, "#3");
+                               Assert.IsNotNull (ex.InnerException, "#4");
+
+                               // There was an error reflecting field 'MyChoice'
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'MyChoice'") != -1, "#6");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#7");
+
+                               // Type MonoTests.System.Xml.TestClasses.ItemChoiceType is missing 
+                               // enumeration value 'StrangeOne' for element 'StrangeOne' from
+                               // namespace ''.
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#8");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (ItemChoiceType).FullName) != -1, "#9");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("'StrangeOne'") != -1, "#10");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("''") != -1, "#11");
+                       }
+               }
+
+               [Test] // bug #77591
+               public void TypeMapping_XmlText_PrimitiveTypes ()
+               {
+                       XmlAttributeOverrides overrides = null;
+                       XmlAttributes attrs = null;
+
+                       overrides = new XmlAttributeOverrides ();
+                       attrs = new  XmlAttributes ();
+                       attrs.XmlText = new XmlTextAttribute (typeof (int));
+                       overrides.Add (typeof (Field), "Modifiers", attrs);
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.Field'
+                               Assert.IsNotNull (ex.Message, "#A2");
+                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (Field).FullName + "'") != -1, "#A3");
+                               Assert.IsNotNull (ex.InnerException, "#A4");
+
+                               // There was an error reflecting field 'Modifiers'
+                               Assert.IsNotNull (ex.InnerException.Message, "#A5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Modifiers'") != -1, "#A6");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#A7");
+
+                               // The type for XmlText may not be specified for primitive types
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A8");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("XmlText") != -1, "#A9");
+                       }
+
+                       overrides = new XmlAttributeOverrides ();
+                       attrs = new XmlAttributes ();
+                       attrs.XmlText = new XmlTextAttribute (typeof (int));
+                       overrides.Add (typeof (Field), "Street", attrs);
+
+                       try {
+                               Map (typeof (Field), overrides);
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.Field'
+                               Assert.IsNotNull (ex.Message, "#B2");
+                               Assert.IsTrue (ex.Message.IndexOf ("'" + typeof (Field).FullName + "'") != -1, "#B3");
+                               Assert.IsNotNull (ex.InnerException, "#B4");
+
+                               // There was an error reflecting field 'Street'
+                               Assert.IsNotNull (ex.InnerException.Message, "#B5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'Street'") != -1, "#B6");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#B7");
+
+                               // The type for XmlText may not be specified for primitive types
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B8");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf ("XmlText") != -1, "#B9");
+                       }
+
+                       overrides = new XmlAttributeOverrides ();
+                       attrs = new XmlAttributes ();
+                       attrs.XmlText = new XmlTextAttribute (typeof (MapModifiers));
+                       overrides.Add (typeof (Field), "Modifiers", attrs);
+                       Map (typeof (Field), overrides);
+
+                       overrides = new XmlAttributeOverrides ();
+                       attrs = new XmlAttributes ();
+                       attrs.XmlText = new XmlTextAttribute (typeof (string));
+                       overrides.Add (typeof (Field), "Street", attrs);
+                       Map (typeof (Field), overrides);
+               }
+
+               [Test]
+               [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
+               public void TestImportMembersMapping()
+               {
+                       Type type = typeof(SimpleClass);
+                       XmlAttributes attrs = new  XmlAttributes();
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides();
+                       overrides.Add(typeof(SimpleClass), attrs);
+
+                       XmlReflectionMember[] members = new XmlReflectionMember[0];
+                       XmlMembersMapping mm;
+                       try
+                       {
+                               mm = MembersMap(type, overrides, members, true);
+                               Assert.Fail("Should not be able to fetch an empty XmlMembersMapping");
+                       }
+                       catch (Exception)
+                       {
+                       }
+                       
+                       XmlReflectionMember rm = new XmlReflectionMember();
+                       rm.IsReturnValue = false;
+                       rm.MemberName = "something";
+                       rm.MemberType = typeof(string);
+                       members = new XmlReflectionMember[1];
+                       members[0] = rm;
+
+                       mm = MembersMap(type, overrides, members, false);
+
+                       Equals(mm.Count, 1);
+
+                       XmlMemberMapping smm = mm[0];
+                       Assert.IsFalse (smm.Any, "#1");
+                       Assert.AreEqual ("something", smm.ElementName, "#2");
+                       Assert.AreEqual ("something", smm.MemberName, "#3");
+                       Assert.IsNull (smm.Namespace, "#4");
+                       Assert.AreEqual ("System.String", smm.TypeFullName, "#5");
+                       Assert.AreEqual ("string", smm.TypeName, "#6");
+#if NET_2_0
+                       Assert.AreEqual (XmlSchemaNamespace, smm.TypeNamespace, "#7");
+#else
+                       Assert.IsNull (smm.TypeNamespace, "#7");
+#endif
+
+                       rm = new XmlReflectionMember();
+                       rm.IsReturnValue = false;
+                       rm.MemberName = "nothing";
+                       rm.MemberType = typeof(string);
+                       members = new XmlReflectionMember[1];
+                       members[0] = rm;
+
+                       mm = MembersMap(type, overrides, members, false);
+                       Assert.AreEqual (1, mm.Count, "#8");
+               }
+
+               [Test]
+               public void TestIntTypeMappingWithXmlRootAttribute()
+               {
+                       const string TheNamespace = "another:urn";
+                       XmlRootAttribute root = new XmlRootAttribute("price");
+                       root.Namespace = TheNamespace;
+                       
+                       XmlTypeMapping tm = Map(typeof(int), root);
+                       Assert.AreEqual ("price", tm.ElementName, "#1");
+                       Assert.AreEqual (TheNamespace, tm.Namespace, "#2");
+                       Assert.AreEqual ("Int32", tm.TypeName, "#3");
+                       Assert.AreEqual ("System.Int32", tm.TypeFullName, "#4");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TestSerializeWrongChoice ()
+               {
+                       new XmlSerializer (typeof(WrongChoices));
+               }
+
+               public class Employee : IXmlSerializable
+               {
+                       private string _firstName;
+                       private string _lastName;
+                       private string _address;
+
+                       public XmlSchema GetSchema ()
+                       {
+                               return null;
+                       }
+
+                       public void WriteXml (XmlWriter writer)
+                       {
+                               writer.WriteStartElement ("employee", "urn:devx-com");
+                               writer.WriteAttributeString ("firstName", _firstName);
+                               writer.WriteAttributeString ("lastName", _lastName);
+                               writer.WriteAttributeString ("address", _address);
+                               writer.WriteEndElement ();
+                       }
+
+                       public void ReadXml (XmlReader reader)
+                       {
+                               XmlNodeType type = reader.MoveToContent ();
+                               if (type == XmlNodeType.Element && reader.LocalName == "employee") {
+                                       _firstName = reader["firstName"];
+                                       _lastName = reader["lastName"];
+                                       _address = reader["address"];
+                               }
+                       }
+               }
+
+               public class NestedStruct
+               {
+                       public TimeSpan Period = TimeSpan.MaxValue;
+               }
+
+               public class ObjectEnumerable : IEnumerable
+               {
+                       public void Add (int value)
+                       {
+                       }
+
+                       public void Add (object value)
+                       {
+                       }
+
+                       public IEnumerator GetEnumerator ()
+                       {
+                               return new ArrayList ().GetEnumerator ();
+                       }
+               }
+
+               public class SimpleClassEnumerable : IEnumerable
+               {
+                       public void Add (int value)
+                       {
+                       }
+
+                       public void Add (object value)
+                       {
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public SimpleClassEnumerator GetEnumerator ()
+                       {
+                               return new SimpleClassEnumerator (new ArrayList ());
+                       }
+               }
+
+               public class SimpleClassEnumerablePrivateGetEnumerator : IEnumerable
+               {
+                       public void Add (object value)
+                       {
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return new ArrayList ().GetEnumerator ();
+                       }
+               }
+
+               public class SimpleClassEnumerablePrivateCurrent : IEnumerable
+               {
+                       public void Add (object value)
+                       {
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public NoCurrentEnumerator GetEnumerator ()
+                       {
+                               return new NoCurrentEnumerator (new ArrayList ());
+                       }
+               }
+
+               // GetEnumerator().Current returns object, but there's no corresponding
+               // Add (System.Object) method
+               public class ObjectEnumerableNoMatchingAddMethod : IEnumerable
+               {
+                       public void Add (int value)
+                       {
+                       }
+
+                       public IEnumerator GetEnumerator ()
+                       {
+                               return new ArrayList ().GetEnumerator ();
+                       }
+               }
+
+               // GetEnumerator().Current returns SimpleClass, but there's no 
+               // corresponding Add (SimpleClass) method
+               public class SimpleClassCollectionNoMatchingAddMethod : ICollection
+               {
+                       public SimpleClass this[int index]
+                       {
+                               get
+                               {
+                                       return (SimpleClass) _list[index];
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public SimpleClassEnumerator GetEnumerator ()
+                       {
+                               return new SimpleClassEnumerator (_list);
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               // GetEnumerator().Current returns object, but there's no corresponding
+               // Add (System.Object) method
+               public class ObjectCollectionNoMatchingAddMethod : ICollection
+               {
+                       public object this[int index]
+                       {
+                               get
+                               {
+                                       return _list[index];
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public IEnumerator GetEnumerator ()
+                       {
+                               return _list.GetEnumerator ();
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               // Does not have int indexer.
+               public class SimpleClassCollectionNoIntIndexer : ICollection
+               {
+                       public SimpleClass this[string name]
+                       {
+                               get
+                               {
+                                       return new SimpleClass ();
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public SimpleClassEnumerator GetEnumerator ()
+                       {
+                               return new SimpleClassEnumerator (_list);
+                       }
+
+                       public void Add (SimpleClass value)
+                       {
+                               _list.Add (value);
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               // Does not have int indexer.
+               public class ObjectCollectionNoIntIndexer : ICollection
+               {
+                       public object this[string name]
+                       {
+                               get
+                               {
+                                       return new SimpleClass ();
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       public IEnumerator GetEnumerator ()
+                       {
+                               return _list.GetEnumerator ();
+                       }
+
+                       public void Add (object value)
+                       {
+                               _list.Add (value);
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               public class SimpleClassCollection : ICollection
+               {
+                       public SimpleClass this[int index]
+                       {
+                               get
+                               {
+                                       return (SimpleClass) _list[index];
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       IEnumerator IEnumerable.GetEnumerator ()
+                       {
+                               return GetEnumerator ();
+                       }
+
+                       public SimpleClassEnumerator GetEnumerator ()
+                       {
+                               return new SimpleClassEnumerator (_list);
+                       }
+
+                       public void Add (SimpleClass value)
+                       {
+                               _list.Add (value);
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               public class ObjectCollection : ICollection
+               {
+                       public object this[int name]
+                       {
+                               get
+                               {
+                                       return new SimpleClass ();
+                               }
+                       }
+
+                       public int Count
+                       {
+                               get { return _list.Count; }
+                       }
+
+                       public bool IsSynchronized
+                       {
+                               get { return _list.IsSynchronized; }
+                       }
+
+                       public object SyncRoot
+                       {
+                               get { return _list.SyncRoot; }
+                       }
+
+                       public void CopyTo (Array array, int index)
+                       {
+                               _list.CopyTo (array, index);
+                       }
+
+                       public IEnumerator GetEnumerator ()
+                       {
+                               return _list.GetEnumerator ();
+                       }
+
+                       public void Add (object value)
+                       {
+                               _list.Add (value);
+                       }
+
+                       private ArrayList _list = new ArrayList ();
+               }
+
+               public class SimpleClassEnumerator : IEnumerator
+               {
+                       internal SimpleClassEnumerator (ArrayList arguments)
+                       {
+                               IEnumerable temp = (IEnumerable) (arguments);
+                               _baseEnumerator = temp.GetEnumerator ();
+                       }
+                       public SimpleClass Current
+                       {
+                               get { return (SimpleClass) _baseEnumerator.Current; }
+                       }
+
+                       object IEnumerator.Current
+                       {
+                               get { return _baseEnumerator.Current; }
+                       }
+
+                       public bool MoveNext ()
+                       {
+                               return _baseEnumerator.MoveNext ();
+                       }
+
+                       bool IEnumerator.MoveNext ()
+                       {
+                               return _baseEnumerator.MoveNext ();
+                       }
+
+                       public void Reset ()
+                       {
+                               _baseEnumerator.Reset ();
+                       }
+
+                       void IEnumerator.Reset ()
+                       {
+                               _baseEnumerator.Reset ();
+                       }
+
+                       private IEnumerator _baseEnumerator;
+               }
+
+               public class NoCurrentEnumerator : IEnumerator
+               {
+                       internal NoCurrentEnumerator (ArrayList arguments)
+                       {
+                               IEnumerable temp = (IEnumerable) (arguments);
+                               _baseEnumerator = temp.GetEnumerator ();
+                       }
+
+                       object IEnumerator.Current
+                       {
+                               get { return _baseEnumerator.Current; }
+                       }
+
+                       public bool MoveNext ()
+                       {
+                               return _baseEnumerator.MoveNext ();
+                       }
+
+                       bool IEnumerator.MoveNext ()
+                       {
+                               return _baseEnumerator.MoveNext ();
+                       }
+
+                       public void Reset ()
+                       {
+                               _baseEnumerator.Reset ();
+                       }
+
+                       void IEnumerator.Reset ()
+                       {
+                               _baseEnumerator.Reset ();
+                       }
+
+                       private IEnumerator _baseEnumerator;
+               }
+       }
+}
+
index f31708b48aaa15c1b531affe1fdd3b278b9118a4..29ef965d28d615021866fe27eecdf6bd820ed161 100644 (file)
@@ -1,53 +1,53 @@
-//\r
-// Tests for System.Xml.Serialization.XmlRootAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlRootAttributeTests\r
-       {\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       XmlRootAttribute attr = new XmlRootAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void ElementNameDefault ()\r
-               {\r
-                       XmlRootAttribute attr = new XmlRootAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");\r
-\r
-                       attr.ElementName = null;\r
-                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void IsNullableDefault ()\r
-               {\r
-                       XmlRootAttribute attr = new XmlRootAttribute ();\r
-                       Assert.AreEqual (true, attr.IsNullable);\r
-               }\r
-\r
-               [Test]\r
-               public void NamespaceDefault ()\r
-               {\r
-                       XmlRootAttribute attr = new XmlRootAttribute ();\r
-                       Assert.IsNull (attr.Namespace);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlRootAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlRootAttributeTests
+       {
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       XmlRootAttribute attr = new XmlRootAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void ElementNameDefault ()
+               {
+                       XmlRootAttribute attr = new XmlRootAttribute ();
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#1");
+
+                       attr.ElementName = null;
+                       Assert.AreEqual (string.Empty, attr.ElementName, "#2");
+               }
+
+               [Test]
+               public void IsNullableDefault ()
+               {
+                       XmlRootAttribute attr = new XmlRootAttribute ();
+                       Assert.AreEqual (true, attr.IsNullable);
+               }
+
+               [Test]
+               public void NamespaceDefault ()
+               {
+                       XmlRootAttribute attr = new XmlRootAttribute ();
+                       Assert.IsNull (attr.Namespace);
+               }
+       }
+}
index 13679d506584db7fa68d196594dd3bce89e55ae1..5b43e5aa93e2956204b57757cda3c566c7b09d0d 100644 (file)
-//\r
-// MonoTests.System.Xml.Serialization.XmlSerializationWriterTests\r
-//\r
-// Author: Erik LeBel <eriklebel@yahoo.ca>\r
-//\r
-//  (C) Erik LeBel 2003\r
-//  \r
-// FIXME add tests for callbacks\r
-// FIXME add tests for writes that generate namespaces\r
-// FIXME add test that write XmlNode objects\r
-// \r
-\r
-using System;\r
-using System.Globalization;\r
-using System.IO;\r
-using System.Xml;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-using MonoTests.System.Xml.TestClasses;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       // base, common implementation of XmlSerializationWriter test harness.\r
-       // the reason for this is that all auto generated namespace prefixes \r
-       // of the form q# are modified by any Write* that defines a new namespace.\r
-       // The result of this is that even though we redefine the string results\r
-       // to exclude previous tests, the q#s will change depending on number of\r
-       // namespace declarations were made prior to the perticual test. This \r
-       // means that if the [Test] methods are called out of sequence, they \r
-       // all start to fail. For this reason, tests that define and verify \r
-       // temporary namespaces should be stored in a seperate class which protects\r
-       // itself from accidental pre-definitions.\r
-       public class XmlSerializarionWriterTester : XmlSerializationWriter\r
-       {\r
-               // appease the compiler\r
-               protected override void InitCallbacks ()\r
-               {\r
-               }\r
-\r
-               StringWriter sw;\r
-               XmlTextWriter writer;\r
-               \r
-               [SetUp]\r
-               public void Reset()\r
-               {\r
-                       sw = new StringWriter ();\r
-                       writer = new XmlTextWriter (sw);\r
-                       writer.QuoteChar = '\'';\r
-                       writer.Formatting = Formatting.None;\r
-                       Writer = writer;\r
-               }\r
-\r
-               public string Content\r
-               {\r
-                       get\r
-                       { \r
-                               string val = sw.GetStringBuilder().ToString();\r
-                               return val;\r
-                       }\r
-               }\r
-\r
-               public void ExecuteWritePotentiallyReferencingElement (string name, string ns, object o, Type ambientType, bool suppressReference, bool isNullable)\r
-               {\r
-                       WritePotentiallyReferencingElement (name, ns, o, ambientType, suppressReference, isNullable);\r
-               }\r
-\r
-               public void ExecuteWriteTypedPrimitive (string name, string ns, object o, bool xsiType)\r
-               {\r
-                       WriteTypedPrimitive (name, ns, o, xsiType);\r
-               }\r
-       }\r
-       \r
-       // this class tests the methods of the XmlSerializationWriter that\r
-       // can be executed out of order.\r
-       [TestFixture]\r
-       public class XmlSerializationWriterSimpleTests : XmlSerializarionWriterTester\r
-       {\r
-               const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";\r
-               const string XmlSchemaInstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";\r
-               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";\r
-               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";\r
-               const string ANamespace = "some:urn";\r
-               const string AnotherNamespace = "another:urn";\r
-\r
-               // These TestFrom* methods indirectly test the functionality of XmlCustomFormatter\r
-\r
-               [Test]\r
-               public void TestFromByteArrayBase64()\r
-               {\r
-                       // FIXME\r
-                       // This should work according to Mono's API, but .NET's FromByteArrayBase64 \r
-                       // returns a byte array.\r
-                       // \r
-                       //string val = this.FromByteArrayBase64(new byte [] {143, 144, 1, 0});\r
-                       //Assert.AreEqual (FromByteArrayBase64(null), "");\r
-                       \r
-                       //val = FromByteArrayBase64(null);\r
-                       //try/catch or AssertEruals?\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromByteArrayHex()\r
-               {\r
-                       byte [] vals = {143, 144, 1, 0};\r
-                       Assert.AreEqual ("8F900100", FromByteArrayHex(vals));\r
-                       Assert.IsNull (FromByteArrayHex (null));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromChar()\r
-               {\r
-                       Assert.AreEqual ("97", FromChar ('a'));\r
-                       Assert.AreEqual ("0", FromChar ('\0'));\r
-                       Assert.AreEqual ("10", FromChar ('\n'));\r
-                       Assert.AreEqual ("65281", FromChar ('\uFF01'));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromDate()\r
-               {\r
-                       DateTime d = new DateTime();\r
-                       Assert.AreEqual ("0001-01-01", FromDate (d));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromDateTime()\r
-               {\r
-                       DateTime d = new DateTime();\r
-                       Assert.AreEqual ("0001-01-01T00:00:00.0000000", FromDateTime (d).Substring (0, 27));\r
-               }\r
-\r
-               [Test] // bug #77500\r
-               public void TestFromEnum()\r
-               {\r
-                       long[] ids = {1, 2, 3, 4};\r
-                       string[] values = {"one", "two", "three"};\r
-\r
-                       Assert.AreEqual ("one", FromEnum (1, values, ids), "#1");\r
-                       Assert.AreEqual (string.Empty, FromEnum (0, values, ids), "#2");\r
-                       Assert.AreEqual ("one two", FromEnum (3, values, ids), "#3");\r
-\r
-                       try {\r
-                               string dummy = FromEnum(4, values, ids);\r
-                               Assert.Fail("#4");\r
-                       } catch (IndexOutOfRangeException) {\r
-                       }\r
-\r
-                       string[] correctValues = {"one", "two", "three", "four"};\r
-                       Assert.AreEqual ("four", FromEnum (4, correctValues, ids), "#5");\r
-                       Assert.AreEqual ("one four", FromEnum (5, correctValues, ids), "#6");\r
-                       Assert.AreEqual ("two four", FromEnum (6, correctValues, ids), "#7");\r
-                       Assert.AreEqual ("one two three four", FromEnum (7, correctValues, ids), "#8");\r
-\r
-                       string[] flagValues = {"one", "two", "four", "eight"};\r
-                       long[] flagIDs = {1, 2, 4, 8};\r
-                       Assert.AreEqual (string.Empty, FromEnum (0, flagValues, flagIDs), "#9");\r
-                       Assert.AreEqual ("two", FromEnum (2, flagValues, flagIDs), "#10");\r
-                       Assert.AreEqual ("four", FromEnum (4, flagValues, flagIDs), "#1");\r
-                       Assert.AreEqual ("one four", FromEnum (5, flagValues, flagIDs), "#12");\r
-                       Assert.AreEqual ("two four", FromEnum (6, flagValues, flagIDs), "#13");\r
-                       Assert.AreEqual ("one two four", FromEnum (7, flagValues, flagIDs), "#14");\r
-                       Assert.AreEqual ("eight", FromEnum (8, flagValues, flagIDs), "#15");\r
-                       Assert.AreEqual ("one four eight", FromEnum (13, flagValues, flagIDs), "#16");\r
-\r
-                       string[] unorderedValues = {"one", "four", "two", "zero"};\r
-                       long[] unorderedIDs = {1, 4, 2, 0};\r
-\r
-                       Assert.AreEqual (string.Empty, FromEnum (0, unorderedValues, unorderedIDs), "#17");\r
-                       Assert.AreEqual ("two", FromEnum (2, unorderedValues, unorderedIDs), "#18");\r
-                       Assert.AreEqual ("four", FromEnum (4, unorderedValues, unorderedIDs), "#19");\r
-                       Assert.AreEqual ("one four", FromEnum (5, unorderedValues, unorderedIDs), "#20");\r
-                       Assert.AreEqual ("four two", FromEnum (6, unorderedValues, unorderedIDs), "#21");\r
-                       Assert.AreEqual ("one four two", FromEnum (7, unorderedValues, unorderedIDs), "#22");\r
-\r
-                       string[] zeroValues = {"zero", "ten"};\r
-                       long[] zeroIDs = {0, 10};\r
-\r
-                       Assert.AreEqual ("zero", FromEnum (0, zeroValues, zeroIDs), "#9");\r
-                       Assert.AreEqual ("ten", FromEnum (10, zeroValues, zeroIDs), "#9");\r
-\r
-                       string[] reverseZeroValues = {"", "zero"};\r
-                       long[] reverseZeroIDs = {4, 0};\r
-                       Assert.AreEqual (string.Empty, FromEnum (0, reverseZeroValues, reverseZeroIDs), "#9");\r
-                       Assert.AreEqual ("zero", FromEnum (4, reverseZeroValues, reverseZeroIDs), "#9");\r
-\r
-                       string[] emptyValues = { "zero" };\r
-                       long[] emptyIDs = {0};\r
-                       Assert.AreEqual ("zero", FromEnum (0, emptyValues, emptyIDs), "#9");\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromEnum_InvalidValue ()\r
-               {\r
-                       long[] ids = {1, 2, 3, 4};\r
-                       string[] values = {"one", "two", "three", "four"};\r
-\r
-#if NET_2_0\r
-                       try {\r
-                               FromEnum (8, values, ids);\r
-                               Assert.Fail ("#A1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");\r
-                               Assert.IsNotNull (ex.Message, "#A3");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("'8'") != -1, "#A4");\r
-                               Assert.IsNull (ex.InnerException, "#A5");\r
-                       }\r
-#else\r
-                       Assert.AreEqual ("8", FromEnum (8, values, ids), "#A6");\r
-#endif\r
-\r
-#if NET_2_0\r
-                       try {\r
-                               FromEnum (8, values, ids, "Some.Type.Name");\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.Message, "#B3");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("'8'") != -1, "#B4");\r
-                               Assert.IsTrue (ex.Message.IndexOf ("Some.Type.Name") != -1, "#B5");\r
-                               Assert.IsNull (ex.InnerException, "#B6");\r
-                       }\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (NullReferenceException))]\r
-               public void TestFromEnum_Null_Values ()\r
-               {\r
-                       long[] ids = { 1, 2, 3, 4 };\r
-                       string[] values = { "one", "two", "three", "four" };\r
-\r
-                       FromEnum (1, (string[]) null, ids);\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (NullReferenceException))]\r
-               public void TestFromEnum_Null_IDs ()\r
-               {\r
-                       string[] values = { "one", "two", "three", "four" };\r
-\r
-                       FromEnum (1, values, (long[]) null);\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromTime()\r
-               {\r
-                       DateTime d = new DateTime();\r
-                       // Don't include time zone.\r
-                       Assert.AreEqual ("00:00:00.0000000", FromTime (d).Substring (0, 16));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromXmlName()\r
-               {\r
-                       Assert.AreEqual ("Hello", FromXmlName ("Hello"));\r
-                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlName ("go dogs go"));\r
-                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlName ("what's up"));\r
-                       Assert.AreEqual ("_x0031_23go", FromXmlName ("123go"));\r
-                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlName ("Hello what's.up"));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromXmlNCName()\r
-               {\r
-                       Assert.AreEqual ("Hello", FromXmlNCName ("Hello"));\r
-                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlNCName ("go dogs go"));\r
-                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlNCName ("what's up"));\r
-                       Assert.AreEqual ("_x0031_23go", FromXmlNCName ("123go"));\r
-                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlNCName ("Hello what's.up"));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromXmlNmToken()\r
-               {\r
-                       Assert.AreEqual ("Hello", FromXmlNmToken ("Hello"));\r
-                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlNmToken ("go dogs go"));\r
-                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlNmToken ("what's up"));\r
-                       Assert.AreEqual ("123go", FromXmlNmToken ("123go"));\r
-                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlNmToken ("Hello what's.up"));\r
-               }\r
-\r
-               [Test]\r
-               public void TestFromXmlNmTokens()\r
-               {\r
-                       Assert.AreEqual ("Hello go dogs_go 123go what_x0027_s.up", FromXmlNmTokens ("Hello go dogs_go 123go what's.up"));\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteAttribute()\r
-               {\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", "b");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x a='b' />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", new byte[] {1, 2, 3});\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x a='AQID' />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", "<b");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x a='&lt;b' />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       string typedPlaceholder = null;\r
-                       WriteAttribute("a", typedPlaceholder);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", "\"");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x a='\"' />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", "b\nc");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x a='b&#xA;c' />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteAttribute("a", ANamespace, "b");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x d1p1:a='b' xmlns:d1p1='some:urn' />", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteElementEncoded()\r
-               {\r
-                       // FIXME\r
-                       // XmlNode related\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteElementLiteral()\r
-               {\r
-                       // FIXME\r
-                       // XmlNode related\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteElementString()\r
-               {\r
-                       WriteElementString("x", "a");\r
-                       Assert.AreEqual ("<x>a</x>", Content);\r
-\r
-                       Reset();\r
-                       WriteElementString("x", "<a");\r
-                       Assert.AreEqual ("<x>&lt;a</x>", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteElementStringRaw()\r
-               {\r
-                       byte [] placeHolderArray = null;\r
-                       WriteElementStringRaw("x", placeHolderArray);\r
-                       Assert.AreEqual ("", Content);\r
-\r
-                       Reset();\r
-                       WriteElementStringRaw("x", new byte[] {0, 2, 4});\r
-                       Assert.AreEqual ("<x>AAIE</x>", Content);\r
-\r
-                       Reset();\r
-                       WriteElementStringRaw("x", new byte[] {});\r
-                       Assert.AreEqual ("<x />", Content);\r
-\r
-                       // Note to reader, the output is not valid xml\r
-                       Reset();\r
-                       WriteElementStringRaw("x", "a > 13 && a < 19");\r
-                       Assert.AreEqual ("<x>a > 13 && a < 19</x>", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteEmptyTag()\r
-               {\r
-                       WriteEmptyTag("x");\r
-                       Assert.AreEqual ("<x />", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteNamespaceDeclarations()\r
-               {\r
-                       XmlSerializerNamespaces ns = new XmlSerializerNamespaces();\r
-\r
-                       WriteStartElement("x");\r
-                       WriteNamespaceDeclarations(ns);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x />", Content);\r
-\r
-                       Reset();\r
-                       ns.Add("mypref", ANamespace);\r
-                       WriteStartElement("x");\r
-                       WriteNamespaceDeclarations(ns);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));\r
-\r
-                       Reset();\r
-                       ns.Add("ns2", "another:urn");\r
-                       WriteStartElement("x");\r
-                       WriteNamespaceDeclarations(ns);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:ns2='another:urn' xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));\r
-\r
-                       Reset();\r
-                       ns.Add("ns3", "ya:urn");\r
-                       WriteStartElement("x");\r
-                       WriteNamespaceDeclarations(ns);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:ns3='ya:urn' xmlns:ns2='another:urn' xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteNullableStringLiteral()\r
-               {\r
-                       WriteNullableStringLiteral("x", null, null);\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));\r
-\r
-                       Reset();\r
-                       WriteNullableStringLiteral("x", null, "");\r
-                       Assert.AreEqual ("<x />", Content);\r
-                       \r
-                       Reset();\r
-                       WriteNullableStringLiteral("x", null, "a<b\'c");\r
-                       Assert.AreEqual ("<x>a&lt;b\'c</x>", Content);\r
-\r
-                       Reset();\r
-                       WriteNullableStringLiteral("x", ANamespace, "b");\r
-                       Assert.AreEqual ("<x xmlns='some:urn'>b</x>", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteNullableStringLiteralRaw()\r
-               {\r
-                       WriteNullableStringLiteralRaw("x", null, new byte[] {1, 2, 244});\r
-                       Assert.AreEqual ("<x>AQL0</x>", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteNullTagEncoded()\r
-               {\r
-                       WriteNullTagEncoded("x");\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteNullTagLiteral()\r
-               {\r
-                       WriteNullTagLiteral("x");\r
-                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")]\r
-               public void TestWritePotentiallyReferencingElement ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, EnumDefaultValue.e1, typeof (EnumDefaultValue), true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>1</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, (int) 1, typeof (EnumDefaultValue), true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}' xmlns='{2}'>1</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", typeof (string), true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>something</x>", ANamespace), xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", null, true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}' xmlns='{2}'>something</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, new string[] { "A", "B" }, typeof (string[]), true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q3:Array id='id1' xmlns:q4='{0}' q3:arrayType='q4:string[2]' xmlns:q3='{1}'>" +\r
-                               "<Item>A</Item>" +\r
-                               "<Item>B</Item>" +\r
-                               "</q3:Array>", XmlSchemaNamespace, SoapEncodingNamespace), xsw.Content, "#5");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteSerializable()\r
-               {\r
-                       // FIXME\r
-                       //Assert.AreEqual (, "");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteStartDocument()\r
-               {\r
-                       Assert.AreEqual ("", Content);\r
-                       \r
-                       WriteStartDocument();\r
-                       Assert.AreEqual ("<?xml version='1.0' encoding='utf-16'?>", Content);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteStartElement()\r
-               {\r
-                       WriteStartElement("x");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x />", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteValue("a");\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x>a</x>", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteStartElement("y", "z");\r
-                       WriteEndElement();\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x><y xmlns='z' /></x>", Content);\r
-\r
-                       Reset();\r
-                       WriteStartElement("x");\r
-                       WriteStartElement("y", "z", true);\r
-                       WriteEndElement();\r
-                       WriteEndElement();\r
-                       Assert.AreEqual ("<x><q1:y xmlns:q1='z' /></x>", Content);\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_Base64Binary ()\r
-               {\r
-                       byte[] byteArray = new byte[] { 255, 20, 10, 5, 0, 7 };\r
-                       string expected = "/xQKBQAH";\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", ANamespace, expected),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", expected), xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", expected), xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, expected),\r
-                               xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace, expected),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>{1}</>", ANamespace, expected), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, byteArray, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<base64Binary xmlns='{0}'>{1}</base64Binary>",\r
-                               XmlSchemaNamespace, expected), xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_Base64Binary_XsiType ()\r
-               {\r
-                       byte[] byteArray = new byte[] { 255, 20, 10, 5, 0, 7 };\r
-                       string expected = "/xQKBQAH";\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, byteArray, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:base64Binary' xmlns:d1p1='{1}'>{2}</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, expected), \r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, byteArray, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:base64Binary' xmlns:d1p1='{1}'>{2}</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, expected),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_Boolean ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>true</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, false, false);\r
-                       Assert.AreEqual ("<x>false</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, true, false);\r
-                       Assert.AreEqual ("<x>true</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, false, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>false</x>", XmlSchemaNamespace), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>true</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, false, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>false</>", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, true, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<boolean xmlns='{0}'>true</boolean>", XmlSchemaNamespace),\r
-                               xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_Boolean_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, true, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:boolean' xmlns:d1p1='{1}'>true</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, false, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:boolean' xmlns:d1p1='{1}'>false</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_Char ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, 'c', false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>99</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, 'a', false);\r
-                       Assert.AreEqual ("<x>97</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, 'b', false);\r
-                       Assert.AreEqual ("<x>98</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, 'd', false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>100</x>", XmlSchemaNamespace), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, 'e', false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>101</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, ' ', false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>32</>", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, '0', false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<char xmlns='{0}'>48</char>", WsdlTypesNamespace),\r
-                               xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // namespace should be wsdl types ns\r
-               public void TestWriteTypedPrimitive_Char_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, 'c', true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:char' xmlns:d1p1='{1}'>99</x>",\r
-                               WsdlTypesNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, 'a', true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:char' xmlns:d1p1='{1}'>97</x>",\r
-                               WsdlTypesNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_DateTime ()\r
-               {\r
-                       DateTime dateTime = new DateTime (1973, 08, 13);\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", ANamespace, FromDateTime (dateTime)),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", FromDateTime (dateTime)), xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", FromDateTime (dateTime)), xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, \r
-                               FromDateTime (dateTime)), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace,\r
-                               FromDateTime (dateTime)), xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>{1}</>", ANamespace, FromDateTime (dateTime)),\r
-                               xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, dateTime, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<dateTime xmlns='{0}'>{1}</dateTime>", XmlSchemaNamespace,\r
-                               FromDateTime (dateTime)), xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_DateTime_XsiType ()\r
-               {\r
-                       DateTime dateTime = new DateTime (1973, 08, 13);\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, dateTime, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:dateTime' xmlns:d1p1='{1}'>{2}</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, \r
-                               FromDateTime (dateTime)), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, dateTime, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:dateTime' xmlns:d1p1='{1}'>{2}</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace,\r
-                               FromDateTime (dateTime)), xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // enum name is output instead of integral value\r
-               public void TestWriteTypedPrimitive_Enum ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, EnumDefaultValue.e1, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>1</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, EnumDefaultValue.e2, false);\r
-                       Assert.AreEqual ("<x>2</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, EnumDefaultValue.e3, false);\r
-                       Assert.AreEqual ("<x>3</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, EnumDefaultValue.e1, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>1</x>", XmlSchemaNamespace), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, EnumDefaultValue.e2, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>2</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, EnumDefaultValue.e3, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>3</>", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, EnumDefaultValue.e2, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<int xmlns='{0}'>2</int>", XmlSchemaNamespace),\r
-                               xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // InvalidOperationException is thrown\r
-               public void TestWriteTypedPrimitive_Enum_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, EnumDefaultValue.e1, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}'>1</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, EnumDefaultValue.e2, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}'>2</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_Guid ()\r
-               {\r
-                       Guid guid = new Guid ("CA761232-ED42-11CE-BACD-00AA0057B223");\r
-                       string expectedGuid = "ca761232-ed42-11ce-bacd-00aa0057b223";\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", ANamespace, expectedGuid), \r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", expectedGuid), xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x>{0}</x>", expectedGuid), xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, expectedGuid),\r
-                               xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace, expectedGuid),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>{1}</>", ANamespace, expectedGuid), \r
-                               xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, guid, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<guid xmlns='{0}'>{1}</guid>", WsdlTypesNamespace, \r
-                               expectedGuid), xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // namespace should be wsdl types ns\r
-               public void TestWriteTypedPrimitive_Guid_XsiType ()\r
-               {\r
-                       Guid guid = new Guid ("CA761232-ED42-11CE-BACD-00AA0057B223");\r
-                       string expectedGuid = "ca761232-ed42-11ce-bacd-00aa0057b223";\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, guid, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:guid' xmlns:d1p1='{1}'>{2}</x>",\r
-                               WsdlTypesNamespace, XmlSchemaInstanceNamespace, expectedGuid),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, guid, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:guid' xmlns:d1p1='{1}'>{2}</x>",\r
-                               WsdlTypesNamespace, XmlSchemaInstanceNamespace, expectedGuid),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_Int ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, 76665, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>76665</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, -5656, false);\r
-                       Assert.AreEqual ("<x>-5656</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, 0, false);\r
-                       Assert.AreEqual ("<x>0</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, 534, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>534</x>", XmlSchemaNamespace), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, -6756, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>-6756</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, 434, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>434</>", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, 434, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<int xmlns='{0}'>434</int>", XmlSchemaNamespace),\r
-                               xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_Int_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, -6756, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}'>-6756</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, 434, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}'>434</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #8 fails\r
-               public void TestWriteTypedPrimitive_String ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, "hello", false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>hello</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, "hello", false);\r
-                       Assert.AreEqual ("<x>hello</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, "hello", false);\r
-                       Assert.AreEqual ("<x>hello</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, "hello", false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>hello</x>", XmlSchemaNamespace),\r
-                               xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, "hello", false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>hello</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, string.Empty, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}' />", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, "<\"te'st\">", false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>&lt;\"te'st\"&gt;</>", ANamespace),\r
-                               xsw.Content, "#7");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, "hello", false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<string xmlns='{0}'>hello</string>", XmlSchemaNamespace),\r
-                               xsw.Content, "#8");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_String_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:string' xmlns:d1p1='{1}'>hello</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace), \r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}'>hello</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // order of namespace declaration differs from that of MSFT\r
-               public void TestWriteTypedPrimitive_String_XsiType_Namespace ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:string' xmlns:d1p1='{1}' xmlns='{2}'>hello</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='string' xmlns:d1p1='{0}' xmlns='{1}'>hello</x>",\r
-                               XmlSchemaInstanceNamespace, XmlSchemaNamespace),\r
-                               xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}' xmlns='{1}'>hello</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace), xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, string.Empty, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q3='{0}' d1p1:type='q3:string' xmlns:d1p1='{1}' xmlns='{2}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, "<\"te'st\">", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns:q4='{0}' d1p1:type='q4:string' xmlns:d1p1='{1}' xmlns='{2}'>&lt;\"te'st\"&gt;</>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, "hello", true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<string d1p1:type='string' xmlns:d1p1='{0}' xmlns='{1}'>hello</string>",\r
-                               XmlSchemaInstanceNamespace, XmlSchemaNamespace), \r
-                               xsw.Content, "#6");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #7 fails\r
-               public void TestWriteTypedPrimitive_UnsignedByte ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, (byte) 5, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>5</x>", ANamespace), xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, (byte) 125, false);\r
-                       Assert.AreEqual ("<x>125</x>", xsw.Content, "#2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, (byte) 0, false);\r
-                       Assert.AreEqual ("<x>0</x>", xsw.Content, "#3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, (byte) 255, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>255</x>", XmlSchemaNamespace), xsw.Content, "#4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, (byte) 128, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>128</x>", XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, (byte) 1, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>1</>", ANamespace), xsw.Content, "#6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, (byte) 99, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<unsignedByte xmlns='{0}'>99</unsignedByte>",\r
-                               XmlSchemaNamespace), xsw.Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteTypedPrimitive_UnsignedByte_XsiType ()\r
-               {\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, (byte) 5, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' d1p1:type='q1:unsignedByte' xmlns:d1p1='{1}'>5</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, (byte) 99, true);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:unsignedByte' xmlns:d1p1='{1}'>99</x>",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               xsw.Content, "#2");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // #A7 fails\r
-               public void TestWriteTypedPrimitive_XmlQualifiedName ()\r
-               {\r
-                       XmlQualifiedName qname = new XmlQualifiedName ("something", AnotherNamespace);\r
-\r
-                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q1='{0}' xmlns='{1}'>q1:something</x>", \r
-                               AnotherNamespace, ANamespace), xsw.Content, "#A1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}'>q2:something</x>",\r
-                               AnotherNamespace), xsw.Content, "#A2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q3='{0}'>q3:something</x>", AnotherNamespace), \r
-                               xsw.Content, "#A3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q4='{0}' xmlns='{1}'>q4:something</x>", AnotherNamespace, \r
-                               XmlSchemaNamespace), xsw.Content, "#A4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q5='{0}' xmlns='{1}'>q5:something</x>", AnotherNamespace, \r
-                               XmlSchemaInstanceNamespace), xsw.Content, "#A5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns:q6='{0}' xmlns='{1}'>q6:something</>", AnotherNamespace,\r
-                               ANamespace), xsw.Content, "#A6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<QName xmlns:q7='{0}' xmlns='{1}'>q7:something</QName>",\r
-                               AnotherNamespace, XmlSchemaNamespace), xsw.Content, "#A7");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       qname = new XmlQualifiedName ("else");\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>else</x>", ANamespace), xsw.Content, "#B1");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, qname, false);\r
-                       Assert.AreEqual ("<x>else</x>", xsw.Content, "#B2");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", null, qname, false);\r
-                       Assert.AreEqual ("<x>else</x>", xsw.Content, "#B3");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>else</x>", XmlSchemaNamespace), xsw.Content, "#B4");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}'>else</x>", XmlSchemaInstanceNamespace), \r
-                               xsw.Content, "#B5");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "< xmlns='{0}'>else</>", ANamespace), xsw.Content, "#B6");\r
-\r
-                       xsw.Reset ();\r
-\r
-                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, qname, false);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<QName xmlns='{0}'>else</QName>", XmlSchemaNamespace), \r
-                               xsw.Content, "#B7");\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (NullReferenceException))]\r
-               public void TestWriteTypedPrimitive_Null_Value()\r
-               {\r
-                       WriteTypedPrimitive("x", ANamespace, null, false);\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // InvalidOperatinException is not thrown\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TestWriteTypedPrimitive_NonPrimitive ()\r
-               {\r
-                       // The type System.Version was not expected. Use the XmlInclude\r
-                       // or SoapInclude attribute to specify types that are not known\r
-                       // statically.\r
-                       WriteTypedPrimitive ("x", ANamespace, new Version (), false);\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteValue()\r
-               {\r
-                       WriteValue("");\r
-                       Assert.AreEqual ("", Content);\r
-\r
-                       Reset();\r
-                       WriteValue("hello");\r
-                       Assert.AreEqual ("hello", Content);\r
-\r
-                       Reset();\r
-                       string v = null;\r
-                       WriteValue(v);\r
-                       Assert.AreEqual ("", Content);\r
-\r
-                       Reset();\r
-                       WriteValue(new byte[] {13, 8, 99});\r
-                       Assert.AreEqual ("DQhj", Content);\r
-               }\r
-\r
-               public void TestWriteXmlAttribute()\r
-               {\r
-                       // FIXME\r
-                       // XmlNode related\r
-               }\r
-\r
-               [Test]\r
-               public void TestWriteXsiType()\r
-               {\r
-                       WriteStartElement("x");\r
-                       WriteXsiType("pref", null);\r
-                       WriteEndElement();\r
-                       Assert.AreEqual (string.Format(CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='pref' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),\r
-                               Content, "#1");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType ("int", XmlSchemaNamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format(CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),\r
-                               Content, "#2");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType ("int", ANamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q3='{0}' d1p1:type='q3:int' xmlns:d1p1='{1}' />",\r
-                               ANamespace, XmlSchemaInstanceNamespace), Content, "#3");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType ("int", XmlSchemaInstanceNamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q4='{0}' q4:type='q4:int' />",\r
-                               XmlSchemaInstanceNamespace), Content, "#4");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType ("int", string.Empty);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='int' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),\r
-                               Content, "#5");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType (string.Empty, null);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),\r
-                               Content, "#6");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x");\r
-                       WriteXsiType (null, null);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual ("<x />", Content, "#7");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // order of namespace declaration differs from that of MSFT\r
-               public void TestWriteXsiType_Namespace ()\r
-               {\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType ("pref", null);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='pref' xmlns:d1p1='{0}' xmlns='{1}' />", \r
-                               XmlSchemaInstanceNamespace, ANamespace), Content, "#1");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType ("int", XmlSchemaNamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q5='{0}' d1p1:type='q5:int' xmlns:d1p1='{1}' xmlns='{2}' />",\r
-                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),\r
-                               Content, "#2");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType ("int", ANamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='int' xmlns:d1p1='{1}' xmlns='{2}' />",\r
-                               ANamespace, XmlSchemaInstanceNamespace, ANamespace), \r
-                               Content, "#3");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType ("int", XmlSchemaInstanceNamespace);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns:q6='{0}' q6:type='q6:int' xmlns='{1}' />",\r
-                               XmlSchemaInstanceNamespace, ANamespace), Content, "#4");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType ("int", string.Empty);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='int' xmlns:d1p1='{0}' xmlns='{1}' />",\r
-                               XmlSchemaInstanceNamespace, ANamespace), Content, "#5");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType (string.Empty, null);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x d1p1:type='' xmlns:d1p1='{0}' xmlns='{1}' />",\r
-                               XmlSchemaInstanceNamespace, ANamespace), Content, "#6");\r
-\r
-                       Reset ();\r
-\r
-                       WriteStartElement ("x", ANamespace);\r
-                       WriteXsiType (null, null);\r
-                       WriteEndElement ();\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<x xmlns='{0}' />", ANamespace), Content, "#7");\r
-               }\r
-\r
-\r
-#if NET_2_0\r
-               [Test]\r
-               public void TestFromEnum_Null_TypeName ()\r
-               {\r
-                       string[] values = { "one", "two", "three", "four" };\r
-                       long[] ids = { 1, 2, 3, 4 };\r
-\r
-                       Assert.AreEqual ("one", FromEnum (1, values, ids, (string) null));\r
-               }\r
-\r
-               [Test]\r
-               public void TestCreateInvalidEnumValueException ()\r
-               {\r
-                       Exception ex = CreateInvalidEnumValueException("AnInvalidValue", "SomeType");\r
-                       Assert.IsNotNull (ex, "#1");\r
-                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                       Assert.IsNotNull (ex.Message, "#3");\r
-                       Assert.IsTrue (ex.Message.IndexOf ("AnInvalidValue") != -1, "#4");\r
-                       Assert.IsTrue (ex.Message.IndexOf ("SomeType") != -1, "#5");\r
-               }\r
-#endif\r
-       }\r
-}\r
+//
+// MonoTests.System.Xml.Serialization.XmlSerializationWriterTests
+//
+// Author: Erik LeBel <eriklebel@yahoo.ca>
+//
+//  (C) Erik LeBel 2003
+//  
+// FIXME add tests for callbacks
+// FIXME add tests for writes that generate namespaces
+// FIXME add test that write XmlNode objects
+// 
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+using MonoTests.System.Xml.TestClasses;
+
+namespace MonoTests.System.XmlSerialization
+{
+       // base, common implementation of XmlSerializationWriter test harness.
+       // the reason for this is that all auto generated namespace prefixes 
+       // of the form q# are modified by any Write* that defines a new namespace.
+       // The result of this is that even though we redefine the string results
+       // to exclude previous tests, the q#s will change depending on number of
+       // namespace declarations were made prior to the perticual test. This 
+       // means that if the [Test] methods are called out of sequence, they 
+       // all start to fail. For this reason, tests that define and verify 
+       // temporary namespaces should be stored in a seperate class which protects
+       // itself from accidental pre-definitions.
+       public class XmlSerializarionWriterTester : XmlSerializationWriter
+       {
+               // appease the compiler
+               protected override void InitCallbacks ()
+               {
+               }
+
+               StringWriter sw;
+               XmlTextWriter writer;
+               
+               [SetUp]
+               public void Reset()
+               {
+                       sw = new StringWriter ();
+                       writer = new XmlTextWriter (sw);
+                       writer.QuoteChar = '\'';
+                       writer.Formatting = Formatting.None;
+                       Writer = writer;
+               }
+
+               public string Content
+               {
+                       get
+                       { 
+                               string val = sw.GetStringBuilder().ToString();
+                               return val;
+                       }
+               }
+
+               public void ExecuteWritePotentiallyReferencingElement (string name, string ns, object o, Type ambientType, bool suppressReference, bool isNullable)
+               {
+                       WritePotentiallyReferencingElement (name, ns, o, ambientType, suppressReference, isNullable);
+               }
+
+               public void ExecuteWriteTypedPrimitive (string name, string ns, object o, bool xsiType)
+               {
+                       WriteTypedPrimitive (name, ns, o, xsiType);
+               }
+       }
+       
+       // this class tests the methods of the XmlSerializationWriter that
+       // can be executed out of order.
+       [TestFixture]
+       public class XmlSerializationWriterSimpleTests : XmlSerializarionWriterTester
+       {
+               const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";
+               const string XmlSchemaInstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";
+               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";
+               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";
+               const string ANamespace = "some:urn";
+               const string AnotherNamespace = "another:urn";
+
+               // These TestFrom* methods indirectly test the functionality of XmlCustomFormatter
+
+               [Test]
+               public void TestFromByteArrayBase64()
+               {
+                       // FIXME
+                       // This should work according to Mono's API, but .NET's FromByteArrayBase64 
+                       // returns a byte array.
+                       // 
+                       //string val = this.FromByteArrayBase64(new byte [] {143, 144, 1, 0});
+                       //Assert.AreEqual (FromByteArrayBase64(null), "");
+                       
+                       //val = FromByteArrayBase64(null);
+                       //try/catch or AssertEruals?
+               }
+
+               [Test]
+               public void TestFromByteArrayHex()
+               {
+                       byte [] vals = {143, 144, 1, 0};
+                       Assert.AreEqual ("8F900100", FromByteArrayHex(vals));
+                       Assert.IsNull (FromByteArrayHex (null));
+               }
+
+               [Test]
+               public void TestFromChar()
+               {
+                       Assert.AreEqual ("97", FromChar ('a'));
+                       Assert.AreEqual ("0", FromChar ('\0'));
+                       Assert.AreEqual ("10", FromChar ('\n'));
+                       Assert.AreEqual ("65281", FromChar ('\uFF01'));
+               }
+
+               [Test]
+               public void TestFromDate()
+               {
+                       DateTime d = new DateTime();
+                       Assert.AreEqual ("0001-01-01", FromDate (d));
+               }
+
+               [Test]
+               public void TestFromDateTime()
+               {
+                       DateTime d = new DateTime();
+                       Assert.AreEqual ("0001-01-01T00:00:00.0000000", FromDateTime (d).Substring (0, 27));
+               }
+
+               [Test] // bug #77500
+               public void TestFromEnum()
+               {
+                       long[] ids = {1, 2, 3, 4};
+                       string[] values = {"one", "two", "three"};
+
+                       Assert.AreEqual ("one", FromEnum (1, values, ids), "#1");
+                       Assert.AreEqual (string.Empty, FromEnum (0, values, ids), "#2");
+                       Assert.AreEqual ("one two", FromEnum (3, values, ids), "#3");
+
+                       try {
+                               string dummy = FromEnum(4, values, ids);
+                               Assert.Fail("#4");
+                       } catch (IndexOutOfRangeException) {
+                       }
+
+                       string[] correctValues = {"one", "two", "three", "four"};
+                       Assert.AreEqual ("four", FromEnum (4, correctValues, ids), "#5");
+                       Assert.AreEqual ("one four", FromEnum (5, correctValues, ids), "#6");
+                       Assert.AreEqual ("two four", FromEnum (6, correctValues, ids), "#7");
+                       Assert.AreEqual ("one two three four", FromEnum (7, correctValues, ids), "#8");
+
+                       string[] flagValues = {"one", "two", "four", "eight"};
+                       long[] flagIDs = {1, 2, 4, 8};
+                       Assert.AreEqual (string.Empty, FromEnum (0, flagValues, flagIDs), "#9");
+                       Assert.AreEqual ("two", FromEnum (2, flagValues, flagIDs), "#10");
+                       Assert.AreEqual ("four", FromEnum (4, flagValues, flagIDs), "#1");
+                       Assert.AreEqual ("one four", FromEnum (5, flagValues, flagIDs), "#12");
+                       Assert.AreEqual ("two four", FromEnum (6, flagValues, flagIDs), "#13");
+                       Assert.AreEqual ("one two four", FromEnum (7, flagValues, flagIDs), "#14");
+                       Assert.AreEqual ("eight", FromEnum (8, flagValues, flagIDs), "#15");
+                       Assert.AreEqual ("one four eight", FromEnum (13, flagValues, flagIDs), "#16");
+
+                       string[] unorderedValues = {"one", "four", "two", "zero"};
+                       long[] unorderedIDs = {1, 4, 2, 0};
+
+                       Assert.AreEqual (string.Empty, FromEnum (0, unorderedValues, unorderedIDs), "#17");
+                       Assert.AreEqual ("two", FromEnum (2, unorderedValues, unorderedIDs), "#18");
+                       Assert.AreEqual ("four", FromEnum (4, unorderedValues, unorderedIDs), "#19");
+                       Assert.AreEqual ("one four", FromEnum (5, unorderedValues, unorderedIDs), "#20");
+                       Assert.AreEqual ("four two", FromEnum (6, unorderedValues, unorderedIDs), "#21");
+                       Assert.AreEqual ("one four two", FromEnum (7, unorderedValues, unorderedIDs), "#22");
+
+                       string[] zeroValues = {"zero", "ten"};
+                       long[] zeroIDs = {0, 10};
+
+                       Assert.AreEqual ("zero", FromEnum (0, zeroValues, zeroIDs), "#9");
+                       Assert.AreEqual ("ten", FromEnum (10, zeroValues, zeroIDs), "#9");
+
+                       string[] reverseZeroValues = {"", "zero"};
+                       long[] reverseZeroIDs = {4, 0};
+                       Assert.AreEqual (string.Empty, FromEnum (0, reverseZeroValues, reverseZeroIDs), "#9");
+                       Assert.AreEqual ("zero", FromEnum (4, reverseZeroValues, reverseZeroIDs), "#9");
+
+                       string[] emptyValues = { "zero" };
+                       long[] emptyIDs = {0};
+                       Assert.AreEqual ("zero", FromEnum (0, emptyValues, emptyIDs), "#9");
+               }
+
+               [Test]
+               public void TestFromEnum_InvalidValue ()
+               {
+                       long[] ids = {1, 2, 3, 4};
+                       string[] values = {"one", "two", "three", "four"};
+
+#if NET_2_0
+                       try {
+                               FromEnum (8, values, ids);
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
+                               Assert.IsNotNull (ex.Message, "#A3");
+                               Assert.IsTrue (ex.Message.IndexOf ("'8'") != -1, "#A4");
+                               Assert.IsNull (ex.InnerException, "#A5");
+                       }
+#else
+                       Assert.AreEqual ("8", FromEnum (8, values, ids), "#A6");
+#endif
+
+#if NET_2_0
+                       try {
+                               FromEnum (8, values, ids, "Some.Type.Name");
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsTrue (ex.Message.IndexOf ("'8'") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Some.Type.Name") != -1, "#B5");
+                               Assert.IsNull (ex.InnerException, "#B6");
+                       }
+#endif
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TestFromEnum_Null_Values ()
+               {
+                       long[] ids = { 1, 2, 3, 4 };
+                       string[] values = { "one", "two", "three", "four" };
+
+                       FromEnum (1, (string[]) null, ids);
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TestFromEnum_Null_IDs ()
+               {
+                       string[] values = { "one", "two", "three", "four" };
+
+                       FromEnum (1, values, (long[]) null);
+               }
+
+               [Test]
+               public void TestFromTime()
+               {
+                       DateTime d = new DateTime();
+                       // Don't include time zone.
+                       Assert.AreEqual ("00:00:00.0000000", FromTime (d).Substring (0, 16));
+               }
+
+               [Test]
+               public void TestFromXmlName()
+               {
+                       Assert.AreEqual ("Hello", FromXmlName ("Hello"));
+                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlName ("go dogs go"));
+                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlName ("what's up"));
+                       Assert.AreEqual ("_x0031_23go", FromXmlName ("123go"));
+                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlName ("Hello what's.up"));
+               }
+
+               [Test]
+               public void TestFromXmlNCName()
+               {
+                       Assert.AreEqual ("Hello", FromXmlNCName ("Hello"));
+                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlNCName ("go dogs go"));
+                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlNCName ("what's up"));
+                       Assert.AreEqual ("_x0031_23go", FromXmlNCName ("123go"));
+                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlNCName ("Hello what's.up"));
+               }
+
+               [Test]
+               public void TestFromXmlNmToken()
+               {
+                       Assert.AreEqual ("Hello", FromXmlNmToken ("Hello"));
+                       Assert.AreEqual ("go_x0020_dogs_x0020_go", FromXmlNmToken ("go dogs go"));
+                       Assert.AreEqual ("what_x0027_s_x0020_up", FromXmlNmToken ("what's up"));
+                       Assert.AreEqual ("123go", FromXmlNmToken ("123go"));
+                       Assert.AreEqual ("Hello_x0020_what_x0027_s.up", FromXmlNmToken ("Hello what's.up"));
+               }
+
+               [Test]
+               public void TestFromXmlNmTokens()
+               {
+                       Assert.AreEqual ("Hello go dogs_go 123go what_x0027_s.up", FromXmlNmTokens ("Hello go dogs_go 123go what's.up"));
+               }
+
+               [Test]
+               public void TestWriteAttribute()
+               {
+                       WriteStartElement("x");
+                       WriteAttribute("a", "b");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x a='b' />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteAttribute("a", new byte[] {1, 2, 3});
+                       WriteEndElement();
+                       Assert.AreEqual ("<x a='AQID' />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteAttribute("a", "<b");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x a='&lt;b' />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       string typedPlaceholder = null;
+                       WriteAttribute("a", typedPlaceholder);
+                       WriteEndElement();
+                       Assert.AreEqual ("<x />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteAttribute("a", "\"");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x a='\"' />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteAttribute("a", "b\nc");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x a='b&#xA;c' />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteAttribute("a", ANamespace, "b");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x d1p1:a='b' xmlns:d1p1='some:urn' />", Content);
+               }
+
+               [Test]
+               public void TestWriteElementEncoded()
+               {
+                       // FIXME
+                       // XmlNode related
+               }
+
+               [Test]
+               public void TestWriteElementLiteral()
+               {
+                       // FIXME
+                       // XmlNode related
+               }
+
+               [Test]
+               public void TestWriteElementString()
+               {
+                       WriteElementString("x", "a");
+                       Assert.AreEqual ("<x>a</x>", Content);
+
+                       Reset();
+                       WriteElementString("x", "<a");
+                       Assert.AreEqual ("<x>&lt;a</x>", Content);
+               }
+
+               [Test]
+               public void TestWriteElementStringRaw()
+               {
+                       byte [] placeHolderArray = null;
+                       WriteElementStringRaw("x", placeHolderArray);
+                       Assert.AreEqual ("", Content);
+
+                       Reset();
+                       WriteElementStringRaw("x", new byte[] {0, 2, 4});
+                       Assert.AreEqual ("<x>AAIE</x>", Content);
+
+                       Reset();
+                       WriteElementStringRaw("x", new byte[] {});
+                       Assert.AreEqual ("<x />", Content);
+
+                       // Note to reader, the output is not valid xml
+                       Reset();
+                       WriteElementStringRaw("x", "a > 13 && a < 19");
+                       Assert.AreEqual ("<x>a > 13 && a < 19</x>", Content);
+               }
+
+               [Test]
+               public void TestWriteEmptyTag()
+               {
+                       WriteEmptyTag("x");
+                       Assert.AreEqual ("<x />", Content);
+               }
+
+               [Test]
+               public void TestWriteNamespaceDeclarations()
+               {
+                       XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
+
+                       WriteStartElement("x");
+                       WriteNamespaceDeclarations(ns);
+                       WriteEndElement();
+                       Assert.AreEqual ("<x />", Content);
+
+                       Reset();
+                       ns.Add("mypref", ANamespace);
+                       WriteStartElement("x");
+                       WriteNamespaceDeclarations(ns);
+                       WriteEndElement();
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));
+
+                       Reset();
+                       ns.Add("ns2", "another:urn");
+                       WriteStartElement("x");
+                       WriteNamespaceDeclarations(ns);
+                       WriteEndElement();
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:ns2='another:urn' xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));
+
+                       Reset();
+                       ns.Add("ns3", "ya:urn");
+                       WriteStartElement("x");
+                       WriteNamespaceDeclarations(ns);
+                       WriteEndElement();
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x xmlns:ns3='ya:urn' xmlns:ns2='another:urn' xmlns:mypref='some:urn' />"), XmlSerializerTests.Infoset(Content));
+               }
+
+               [Test]
+               public void TestWriteNullableStringLiteral()
+               {
+                       WriteNullableStringLiteral("x", null, null);
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));
+
+                       Reset();
+                       WriteNullableStringLiteral("x", null, "");
+                       Assert.AreEqual ("<x />", Content);
+                       
+                       Reset();
+                       WriteNullableStringLiteral("x", null, "a<b\'c");
+                       Assert.AreEqual ("<x>a&lt;b\'c</x>", Content);
+
+                       Reset();
+                       WriteNullableStringLiteral("x", ANamespace, "b");
+                       Assert.AreEqual ("<x xmlns='some:urn'>b</x>", Content);
+               }
+
+               [Test]
+               public void TestWriteNullableStringLiteralRaw()
+               {
+                       WriteNullableStringLiteralRaw("x", null, new byte[] {1, 2, 244});
+                       Assert.AreEqual ("<x>AQL0</x>", Content);
+               }
+
+               [Test]
+               public void TestWriteNullTagEncoded()
+               {
+                       WriteNullTagEncoded("x");
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));
+               }
+
+               [Test]
+               public void TestWriteNullTagLiteral()
+               {
+                       WriteNullTagLiteral("x");
+                       Assert.AreEqual (XmlSerializerTests.Infoset("<x d1p1:nil='true' xmlns:d1p1='http://www.w3.org/2001/XMLSchema-instance' />"), XmlSerializerTests.Infoset(Content));
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestWritePotentiallyReferencingElement ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, EnumDefaultValue.e1, typeof (EnumDefaultValue), true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>1</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, (int) 1, typeof (EnumDefaultValue), true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}' xmlns='{2}'>1</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", typeof (string), true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>something</x>", ANamespace), xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, "something", null, true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}' xmlns='{2}'>something</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWritePotentiallyReferencingElement ("x", ANamespace, new string[] { "A", "B" }, typeof (string[]), true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<q3:Array id='id1' xmlns:q4='{0}' q3:arrayType='q4:string[2]' xmlns:q3='{1}'>" +
+                               "<Item>A</Item>" +
+                               "<Item>B</Item>" +
+                               "</q3:Array>", XmlSchemaNamespace, SoapEncodingNamespace), xsw.Content, "#5");
+               }
+
+               [Test]
+               public void TestWriteSerializable()
+               {
+                       // FIXME
+                       //Assert.AreEqual (, "");
+               }
+
+               [Test]
+               public void TestWriteStartDocument()
+               {
+                       Assert.AreEqual ("", Content);
+                       
+                       WriteStartDocument();
+                       Assert.AreEqual ("<?xml version='1.0' encoding='utf-16'?>", Content);
+               }
+
+               [Test]
+               public void TestWriteStartElement()
+               {
+                       WriteStartElement("x");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x />", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteValue("a");
+                       WriteEndElement();
+                       Assert.AreEqual ("<x>a</x>", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteStartElement("y", "z");
+                       WriteEndElement();
+                       WriteEndElement();
+                       Assert.AreEqual ("<x><y xmlns='z' /></x>", Content);
+
+                       Reset();
+                       WriteStartElement("x");
+                       WriteStartElement("y", "z", true);
+                       WriteEndElement();
+                       WriteEndElement();
+                       Assert.AreEqual ("<x><q1:y xmlns:q1='z' /></x>", Content);
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_Base64Binary ()
+               {
+                       byte[] byteArray = new byte[] { 255, 20, 10, 5, 0, 7 };
+                       string expected = "/xQKBQAH";
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", ANamespace, expected),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", expected), xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", expected), xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, expected),
+                               xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace, expected),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>{1}</>", ANamespace, expected), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, byteArray, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<base64Binary xmlns='{0}'>{1}</base64Binary>",
+                               XmlSchemaNamespace, expected), xsw.Content, "#7");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_Base64Binary_XsiType ()
+               {
+                       byte[] byteArray = new byte[] { 255, 20, 10, 5, 0, 7 };
+                       string expected = "/xQKBQAH";
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, byteArray, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:base64Binary' xmlns:d1p1='{1}'>{2}</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, expected), 
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, byteArray, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:base64Binary' xmlns:d1p1='{1}'>{2}</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, expected),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_Boolean ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>true</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, false, false);
+                       Assert.AreEqual ("<x>false</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, true, false);
+                       Assert.AreEqual ("<x>true</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, false, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>false</x>", XmlSchemaNamespace), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>true</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, false, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>false</>", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, true, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<boolean xmlns='{0}'>true</boolean>", XmlSchemaNamespace),
+                               xsw.Content, "#7");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_Boolean_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, true, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:boolean' xmlns:d1p1='{1}'>true</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, false, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:boolean' xmlns:d1p1='{1}'>false</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_Char ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, 'c', false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>99</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, 'a', false);
+                       Assert.AreEqual ("<x>97</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, 'b', false);
+                       Assert.AreEqual ("<x>98</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, 'd', false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>100</x>", XmlSchemaNamespace), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, 'e', false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>101</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, ' ', false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>32</>", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, '0', false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<char xmlns='{0}'>48</char>", WsdlTypesNamespace),
+                               xsw.Content, "#7");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // namespace should be wsdl types ns
+               public void TestWriteTypedPrimitive_Char_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, 'c', true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:char' xmlns:d1p1='{1}'>99</x>",
+                               WsdlTypesNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, 'a', true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:char' xmlns:d1p1='{1}'>97</x>",
+                               WsdlTypesNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_DateTime ()
+               {
+                       DateTime dateTime = new DateTime (1973, 08, 13);
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", ANamespace, FromDateTime (dateTime)),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", FromDateTime (dateTime)), xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", FromDateTime (dateTime)), xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, 
+                               FromDateTime (dateTime)), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace,
+                               FromDateTime (dateTime)), xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>{1}</>", ANamespace, FromDateTime (dateTime)),
+                               xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, dateTime, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<dateTime xmlns='{0}'>{1}</dateTime>", XmlSchemaNamespace,
+                               FromDateTime (dateTime)), xsw.Content, "#7");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_DateTime_XsiType ()
+               {
+                       DateTime dateTime = new DateTime (1973, 08, 13);
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, dateTime, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:dateTime' xmlns:d1p1='{1}'>{2}</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, 
+                               FromDateTime (dateTime)), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, dateTime, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:dateTime' xmlns:d1p1='{1}'>{2}</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace,
+                               FromDateTime (dateTime)), xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // enum name is output instead of integral value
+               public void TestWriteTypedPrimitive_Enum ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, EnumDefaultValue.e1, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>1</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, EnumDefaultValue.e2, false);
+                       Assert.AreEqual ("<x>2</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, EnumDefaultValue.e3, false);
+                       Assert.AreEqual ("<x>3</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, EnumDefaultValue.e1, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>1</x>", XmlSchemaNamespace), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, EnumDefaultValue.e2, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>2</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, EnumDefaultValue.e3, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>3</>", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, EnumDefaultValue.e2, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<int xmlns='{0}'>2</int>", XmlSchemaNamespace),
+                               xsw.Content, "#7");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // InvalidOperationException is thrown
+               public void TestWriteTypedPrimitive_Enum_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, EnumDefaultValue.e1, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}'>1</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, EnumDefaultValue.e2, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}'>2</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_Guid ()
+               {
+                       Guid guid = new Guid ("CA761232-ED42-11CE-BACD-00AA0057B223");
+                       string expectedGuid = "ca761232-ed42-11ce-bacd-00aa0057b223";
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", ANamespace, expectedGuid), 
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", expectedGuid), xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x>{0}</x>", expectedGuid), xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaNamespace, expectedGuid),
+                               xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>{1}</x>", XmlSchemaInstanceNamespace, expectedGuid),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>{1}</>", ANamespace, expectedGuid), 
+                               xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, guid, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<guid xmlns='{0}'>{1}</guid>", WsdlTypesNamespace, 
+                               expectedGuid), xsw.Content, "#7");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // namespace should be wsdl types ns
+               public void TestWriteTypedPrimitive_Guid_XsiType ()
+               {
+                       Guid guid = new Guid ("CA761232-ED42-11CE-BACD-00AA0057B223");
+                       string expectedGuid = "ca761232-ed42-11ce-bacd-00aa0057b223";
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, guid, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:guid' xmlns:d1p1='{1}'>{2}</x>",
+                               WsdlTypesNamespace, XmlSchemaInstanceNamespace, expectedGuid),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, guid, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:guid' xmlns:d1p1='{1}'>{2}</x>",
+                               WsdlTypesNamespace, XmlSchemaInstanceNamespace, expectedGuid),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_Int ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, 76665, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>76665</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, -5656, false);
+                       Assert.AreEqual ("<x>-5656</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, 0, false);
+                       Assert.AreEqual ("<x>0</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, 534, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>534</x>", XmlSchemaNamespace), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, -6756, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>-6756</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, 434, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>434</>", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, 434, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<int xmlns='{0}'>434</int>", XmlSchemaNamespace),
+                               xsw.Content, "#7");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_Int_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, -6756, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:int' xmlns:d1p1='{1}'>-6756</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, 434, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}'>434</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #8 fails
+               public void TestWriteTypedPrimitive_String ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, "hello", false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>hello</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, "hello", false);
+                       Assert.AreEqual ("<x>hello</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, "hello", false);
+                       Assert.AreEqual ("<x>hello</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, "hello", false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>hello</x>", XmlSchemaNamespace),
+                               xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, "hello", false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>hello</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, string.Empty, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}' />", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, "<\"te'st\">", false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>&lt;\"te'st\"&gt;</>", ANamespace),
+                               xsw.Content, "#7");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, "hello", false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<string xmlns='{0}'>hello</string>", XmlSchemaNamespace),
+                               xsw.Content, "#8");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_String_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:string' xmlns:d1p1='{1}'>hello</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace), 
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}'>hello</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // order of namespace declaration differs from that of MSFT
+               public void TestWriteTypedPrimitive_String_XsiType_Namespace ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:string' xmlns:d1p1='{1}' xmlns='{2}'>hello</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='string' xmlns:d1p1='{0}' xmlns='{1}'>hello</x>",
+                               XmlSchemaInstanceNamespace, XmlSchemaNamespace),
+                               xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:string' xmlns:d1p1='{1}' xmlns='{1}'>hello</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace), xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, string.Empty, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q3='{0}' d1p1:type='q3:string' xmlns:d1p1='{1}' xmlns='{2}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, "<\"te'st\">", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns:q4='{0}' d1p1:type='q4:string' xmlns:d1p1='{1}' xmlns='{2}'>&lt;\"te'st\"&gt;</>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, "hello", true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<string d1p1:type='string' xmlns:d1p1='{0}' xmlns='{1}'>hello</string>",
+                               XmlSchemaInstanceNamespace, XmlSchemaNamespace), 
+                               xsw.Content, "#6");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #7 fails
+               public void TestWriteTypedPrimitive_UnsignedByte ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, (byte) 5, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>5</x>", ANamespace), xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, (byte) 125, false);
+                       Assert.AreEqual ("<x>125</x>", xsw.Content, "#2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, (byte) 0, false);
+                       Assert.AreEqual ("<x>0</x>", xsw.Content, "#3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, (byte) 255, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>255</x>", XmlSchemaNamespace), xsw.Content, "#4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, (byte) 128, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>128</x>", XmlSchemaInstanceNamespace),
+                               xsw.Content, "#5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, (byte) 1, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>1</>", ANamespace), xsw.Content, "#6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, (byte) 99, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<unsignedByte xmlns='{0}'>99</unsignedByte>",
+                               XmlSchemaNamespace), xsw.Content, "#7");
+               }
+
+               [Test]
+               public void TestWriteTypedPrimitive_UnsignedByte_XsiType ()
+               {
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, (byte) 5, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' d1p1:type='q1:unsignedByte' xmlns:d1p1='{1}'>5</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, (byte) 99, true);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:unsignedByte' xmlns:d1p1='{1}'>99</x>",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               xsw.Content, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // #A7 fails
+               public void TestWriteTypedPrimitive_XmlQualifiedName ()
+               {
+                       XmlQualifiedName qname = new XmlQualifiedName ("something", AnotherNamespace);
+
+                       XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q1='{0}' xmlns='{1}'>q1:something</x>", 
+                               AnotherNamespace, ANamespace), xsw.Content, "#A1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}'>q2:something</x>",
+                               AnotherNamespace), xsw.Content, "#A2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q3='{0}'>q3:something</x>", AnotherNamespace), 
+                               xsw.Content, "#A3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q4='{0}' xmlns='{1}'>q4:something</x>", AnotherNamespace, 
+                               XmlSchemaNamespace), xsw.Content, "#A4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q5='{0}' xmlns='{1}'>q5:something</x>", AnotherNamespace, 
+                               XmlSchemaInstanceNamespace), xsw.Content, "#A5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns:q6='{0}' xmlns='{1}'>q6:something</>", AnotherNamespace,
+                               ANamespace), xsw.Content, "#A6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<QName xmlns:q7='{0}' xmlns='{1}'>q7:something</QName>",
+                               AnotherNamespace, XmlSchemaNamespace), xsw.Content, "#A7");
+
+                       xsw.Reset ();
+
+                       qname = new XmlQualifiedName ("else");
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>else</x>", ANamespace), xsw.Content, "#B1");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", string.Empty, qname, false);
+                       Assert.AreEqual ("<x>else</x>", xsw.Content, "#B2");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", null, qname, false);
+                       Assert.AreEqual ("<x>else</x>", xsw.Content, "#B3");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaNamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>else</x>", XmlSchemaNamespace), xsw.Content, "#B4");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive ("x", XmlSchemaInstanceNamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}'>else</x>", XmlSchemaInstanceNamespace), 
+                               xsw.Content, "#B5");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (string.Empty, ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "< xmlns='{0}'>else</>", ANamespace), xsw.Content, "#B6");
+
+                       xsw.Reset ();
+
+                       xsw.ExecuteWriteTypedPrimitive (null, ANamespace, qname, false);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<QName xmlns='{0}'>else</QName>", XmlSchemaNamespace), 
+                               xsw.Content, "#B7");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NullReferenceException))]
+               public void TestWriteTypedPrimitive_Null_Value()
+               {
+                       WriteTypedPrimitive("x", ANamespace, null, false);
+               }
+
+               [Test]
+               [Category ("NotWorking")] // InvalidOperatinException is not thrown
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TestWriteTypedPrimitive_NonPrimitive ()
+               {
+                       // The type System.Version was not expected. Use the XmlInclude
+                       // or SoapInclude attribute to specify types that are not known
+                       // statically.
+                       WriteTypedPrimitive ("x", ANamespace, new Version (), false);
+               }
+
+               [Test]
+               public void TestWriteValue()
+               {
+                       WriteValue("");
+                       Assert.AreEqual ("", Content);
+
+                       Reset();
+                       WriteValue("hello");
+                       Assert.AreEqual ("hello", Content);
+
+                       Reset();
+                       string v = null;
+                       WriteValue(v);
+                       Assert.AreEqual ("", Content);
+
+                       Reset();
+                       WriteValue(new byte[] {13, 8, 99});
+                       Assert.AreEqual ("DQhj", Content);
+               }
+
+               public void TestWriteXmlAttribute()
+               {
+                       // FIXME
+                       // XmlNode related
+               }
+
+               [Test]
+               public void TestWriteXsiType()
+               {
+                       WriteStartElement("x");
+                       WriteXsiType("pref", null);
+                       WriteEndElement();
+                       Assert.AreEqual (string.Format(CultureInfo.InvariantCulture,
+                               "<x d1p1:type='pref' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),
+                               Content, "#1");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType ("int", XmlSchemaNamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format(CultureInfo.InvariantCulture,
+                               "<x xmlns:q2='{0}' d1p1:type='q2:int' xmlns:d1p1='{1}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace),
+                               Content, "#2");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType ("int", ANamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q3='{0}' d1p1:type='q3:int' xmlns:d1p1='{1}' />",
+                               ANamespace, XmlSchemaInstanceNamespace), Content, "#3");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType ("int", XmlSchemaInstanceNamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q4='{0}' q4:type='q4:int' />",
+                               XmlSchemaInstanceNamespace), Content, "#4");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType ("int", string.Empty);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='int' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),
+                               Content, "#5");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType (string.Empty, null);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='' xmlns:d1p1='{0}' />", XmlSchemaInstanceNamespace),
+                               Content, "#6");
+
+                       Reset ();
+
+                       WriteStartElement ("x");
+                       WriteXsiType (null, null);
+                       WriteEndElement ();
+                       Assert.AreEqual ("<x />", Content, "#7");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // order of namespace declaration differs from that of MSFT
+               public void TestWriteXsiType_Namespace ()
+               {
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType ("pref", null);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='pref' xmlns:d1p1='{0}' xmlns='{1}' />", 
+                               XmlSchemaInstanceNamespace, ANamespace), Content, "#1");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType ("int", XmlSchemaNamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q5='{0}' d1p1:type='q5:int' xmlns:d1p1='{1}' xmlns='{2}' />",
+                               XmlSchemaNamespace, XmlSchemaInstanceNamespace, ANamespace),
+                               Content, "#2");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType ("int", ANamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='int' xmlns:d1p1='{1}' xmlns='{2}' />",
+                               ANamespace, XmlSchemaInstanceNamespace, ANamespace), 
+                               Content, "#3");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType ("int", XmlSchemaInstanceNamespace);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns:q6='{0}' q6:type='q6:int' xmlns='{1}' />",
+                               XmlSchemaInstanceNamespace, ANamespace), Content, "#4");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType ("int", string.Empty);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='int' xmlns:d1p1='{0}' xmlns='{1}' />",
+                               XmlSchemaInstanceNamespace, ANamespace), Content, "#5");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType (string.Empty, null);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x d1p1:type='' xmlns:d1p1='{0}' xmlns='{1}' />",
+                               XmlSchemaInstanceNamespace, ANamespace), Content, "#6");
+
+                       Reset ();
+
+                       WriteStartElement ("x", ANamespace);
+                       WriteXsiType (null, null);
+                       WriteEndElement ();
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<x xmlns='{0}' />", ANamespace), Content, "#7");
+               }
+
+
+#if NET_2_0
+               [Test]
+               public void TestFromEnum_Null_TypeName ()
+               {
+                       string[] values = { "one", "two", "three", "four" };
+                       long[] ids = { 1, 2, 3, 4 };
+
+                       Assert.AreEqual ("one", FromEnum (1, values, ids, (string) null));
+               }
+
+               [Test]
+               public void TestCreateInvalidEnumValueException ()
+               {
+                       Exception ex = CreateInvalidEnumValueException("AnInvalidValue", "SomeType");
+                       Assert.IsNotNull (ex, "#1");
+                       Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                       Assert.IsNotNull (ex.Message, "#3");
+                       Assert.IsTrue (ex.Message.IndexOf ("AnInvalidValue") != -1, "#4");
+                       Assert.IsTrue (ex.Message.IndexOf ("SomeType") != -1, "#5");
+               }
+#endif
+       }
+}
index e77109b72b96649332324b52ee44be7b1dd3b420..d2c9ce66b3ecfa0bfcd3fd1b625806fadf429918 100644 (file)
-//\r
-// System.Xml.XmlSerializerTestClasses\r
-//\r
-// Author:\r
-//   Erik LeBel <eriklebel@yahoo.ca>\r
-//\r
-// (C) 2003 Erik LeBel\r
-//\r
-// Classes to use in the testing of the XmlSerializer\r
-//\r
-\r
-using System;\r
-using System.ComponentModel;\r
-using System.Collections;\r
-using System.Xml;\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-namespace MonoTests.System.Xml.TestClasses\r
-{\r
-       public enum SimpleEnumeration { FIRST, SECOND };\r
-\r
-       [Flags]\r
-       public enum EnumDefaultValue { e1 = 1, e2 = 2, e3 = 3 }\r
-       public enum EnumDefaultValueNF { e1 = 1, e2 = 2, e3 = 3 }\r
-\r
-       [Flags]\r
-       public enum FlagEnum { \r
-               [XmlEnum ("one")]\r
-               e1 = 1,\r
-               [XmlEnum ("two")]\r
-               e2 = 2,\r
-               [XmlEnum ("four")]\r
-               e4 = 4\r
-       }\r
-\r
-       [Flags]\r
-       [SoapType ("flagenum")]\r
-       public enum FlagEnum_Encoded\r
-       {\r
-               [SoapEnum ("one")]\r
-               e1 = 1,\r
-               [SoapEnum ("two")]\r
-               e2 = 2,\r
-               [SoapEnum ("four")]\r
-               e4 = 4\r
-       }\r
-\r
-       [Flags]\r
-       public enum ZeroFlagEnum {\r
-               [XmlEnum ("zero")]\r
-               e0 = 0,\r
-               [XmlEnum ("o<n>e")]\r
-               e1 = 1,\r
-               [XmlEnum ("tns:t<w>o")]\r
-               e2 = 2,\r
-               [XmlEnum ("four")]\r
-               [XmlIgnore]\r
-               e4 = 4\r
-       }\r
-       \r
-       public class SimpleClass\r
-       {\r
-               public string something = null;\r
-       }\r
-\r
-       public class StringCollection : CollectionBase\r
-       {\r
-               public void Add (String parameter) \r
-               {\r
-                       List.Insert (Count, parameter);\r
-               }\r
-                       \r
-               public String this [int index]\r
-               {\r
-                       get\r
-                       { \r
-                               if (index < 0 || index > Count)\r
-                                       throw new ArgumentOutOfRangeException ();\r
-                                       \r
-                               return (String) List [index]; \r
-                       }\r
-                       set { List [index] = value; }\r
-               }\r
-       }\r
-       \r
-       public class StringCollectionContainer\r
-       {\r
-               StringCollection messages = new StringCollection();\r
-               \r
-               public StringCollection Messages\r
-               {\r
-                       get { return messages; }\r
-               }\r
-       }\r
-\r
-       public class ArrayContainer\r
-       {\r
-               public object [] items = null;\r
-       }\r
-       \r
-       public class ClassArrayContainer\r
-       {\r
-               public SimpleClass [] items = null;\r
-       }\r
-       \r
-       [XmlRoot("simple")]\r
-       public class SimpleClassWithXmlAttributes\r
-       {\r
-               [XmlAttribute("member")]\r
-               public string something = null;\r
-       }\r
-       \r
-       [XmlRoot("field")]\r
-       public class Field\r
-       {\r
-               [XmlAttribute ("flag1")]\r
-               [DefaultValue (1)]\r
-               public FlagEnum Flags1;\r
-\r
-               [XmlAttribute ("flag2")]\r
-               [DefaultValue (FlagEnum.e1)]\r
-               public FlagEnum Flags2;\r
-\r
-               [XmlAttribute ("flag3", Form = XmlSchemaForm.Qualified)]\r
-               [DefaultValue (FlagEnum.e1 | FlagEnum.e2)]\r
-               public FlagEnum Flags3;\r
-\r
-               [XmlAttribute ("flag4")]\r
-               public FlagEnum Flags4;\r
-\r
-               [XmlAttribute("modifiers")]\r
-               public MapModifiers Modifiers;\r
-\r
-               [XmlAttribute ("modifiers2", Form=XmlSchemaForm.Unqualified)]\r
-               public MapModifiers Modifiers2;\r
-\r
-               [XmlAttribute ("modifiers3")]\r
-               [DefaultValue (0)]\r
-               public MapModifiers Modifiers3;\r
-\r
-               [XmlAttribute ("modifiers4", Form=XmlSchemaForm.Unqualified)]\r
-               [DefaultValue (MapModifiers.Protected)]\r
-               public MapModifiers Modifiers4;\r
-\r
-               [XmlAttribute ("modifiers5", Form = XmlSchemaForm.Qualified)]\r
-               [DefaultValue (MapModifiers.Public)]\r
-               public MapModifiers Modifiers5;\r
-\r
-               [XmlAttribute ("names")]\r
-               public string[] Names;\r
-\r
-               [XmlAttribute ("street")]\r
-               public string Street;\r
-       }\r
-\r
-       [SoapType ("field", Namespace = "some:urn")]\r
-       public class Field_Encoded\r
-       {\r
-               [SoapAttribute ("flag1")]\r
-               [DefaultValue (FlagEnum_Encoded.e1)]\r
-               public FlagEnum_Encoded Flags1;\r
-\r
-               [SoapAttribute ("flag2")]\r
-               [DefaultValue (FlagEnum_Encoded.e1)]\r
-               public FlagEnum_Encoded Flags2;\r
-\r
-               [SoapAttribute ("flag3")]\r
-               [DefaultValue (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2)]\r
-               public FlagEnum_Encoded Flags3;\r
-\r
-               [SoapAttribute ("flag4")]\r
-               public FlagEnum_Encoded Flags4;\r
-\r
-               [SoapAttribute ("modifiers")]\r
-               public MapModifiers Modifiers;\r
-\r
-               [SoapAttribute ("modifiers2")]\r
-               public MapModifiers Modifiers2;\r
-\r
-               [SoapAttribute ("modifiers3")]\r
-               [DefaultValue (MapModifiers.Public)]\r
-               public MapModifiers Modifiers3;\r
-\r
-               [SoapAttribute ("modifiers4")]\r
-               [DefaultValue (MapModifiers.Protected)]\r
-               public MapModifiers Modifiers4;\r
-\r
-               [SoapAttribute ("modifiers5")]\r
-               [DefaultValue (MapModifiers.Public)]\r
-               public MapModifiers Modifiers5;\r
-\r
-               public string[] Names;\r
-\r
-               [SoapAttribute ("street")]\r
-               public string Street;\r
-       }\r
-\r
-       [Flags]\r
-       public enum MapModifiers\r
-       {\r
-               [XmlEnum("public")]\r
-               [SoapEnum ("PuBlIc")]\r
-               Public = 0,\r
-               [XmlEnum("protected")]\r
-               Protected = 1,\r
-       }\r
-\r
-       public class MyList : ArrayList\r
-       {\r
-               object container;\r
-               \r
-               // NOTE: MyList has no public constructor\r
-               public MyList (object container) : base()\r
-               {\r
-                       this.container = container;\r
-               }\r
-       }\r
-       \r
-       public class Container\r
-       {\r
-               public MyList Items;\r
-               \r
-               public Container () {\r
-                       Items = new MyList(this);\r
-               }\r
-       }\r
-       \r
-       public class Container2\r
-       {\r
-               public MyList Items;\r
-               \r
-               public Container2 () {\r
-               }\r
-               \r
-               public Container2 (bool b) {\r
-                       Items = new MyList(this);\r
-               }\r
-       }\r
-\r
-       public class MyElem: XmlElement\r
-       {\r
-               public MyElem (XmlDocument doc): base ("","myelem","", doc)\r
-               {\r
-                       SetAttribute ("aa","1");\r
-               }\r
-\r
-               [XmlAttribute]\r
-               public int kk=1;\r
-       }\r
-\r
-       public class MyDocument: XmlDocument\r
-       {\r
-               public MyDocument ()\r
-               {\r
-               }\r
-\r
-               [XmlAttribute]\r
-               public int kk=1;\r
-       }\r
-       \r
-       public class CDataContainer\r
-       {\r
-               public XmlCDataSection cdata;\r
-       }\r
-       \r
-       public class NodeContainer\r
-       {\r
-               public XmlNode node;\r
-       }\r
-       \r
-       public class Choices\r
-       {\r
-               [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]\r
-               [XmlElementAttribute("ChoiceOne", typeof(string), IsNullable=false)]\r
-               [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]\r
-               [XmlChoiceIdentifier("ItemType")]\r
-               public string MyChoice;\r
-\r
-               [XmlIgnore]\r
-               public ItemChoiceType ItemType;\r
-       }\r
-       \r
-       [XmlType(IncludeInSchema = false)]\r
-       public enum ItemChoiceType\r
-       {\r
-               ChoiceZero,\r
-               [XmlEnum ("ChoiceOne")]\r
-               StrangeOne,\r
-               ChoiceTwo,\r
-       }\r
-       \r
-       public class WrongChoices\r
-       {\r
-               [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]\r
-               [XmlElementAttribute("StrangeOne", typeof(string), IsNullable=false)]\r
-               [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]\r
-               [XmlChoiceIdentifier("ItemType")]\r
-               public string MyChoice;\r
-\r
-               [XmlIgnore]\r
-               public ItemChoiceType ItemType;\r
-       }\r
-       \r
-       [XmlType ("Type with space")]\r
-       public class TestSpace\r
-       {\r
-          [XmlElement (ElementName = "Element with space")]\r
-          public int elem;\r
-           \r
-          [XmlAttribute (AttributeName = "Attribute with space")]\r
-          public int attr; \r
-       }\r
-\r
-       [Serializable]\r
-       public class ReadOnlyProperties {\r
-               string[] strArr = new string[2] { "string1", "string2" };\r
-\r
-               public string[] StrArr {\r
-                       get { return strArr; }\r
-               }\r
-               \r
-               public string dat {\r
-                       get { return "fff"; }\r
-               } \r
-       }\r
-       \r
-       [XmlRoot("root")]\r
-       public class ListDefaults\r
-       {\r
-               public ListDefaults ()\r
-               {\r
-                       ed = new SimpleClass ();\r
-                       str = "hola";\r
-               }\r
-               \r
-           public ArrayList list2;\r
-           \r
-           public MyList list3;\r
-           \r
-           public string[] list4;\r
-           \r
-               [XmlElement("e", typeof(SimpleClass))]\r
-           public ArrayList list5;\r
-           \r
-               [DefaultValue (null)]\r
-           public SimpleClass ed;\r
-           \r
-               [DefaultValue (null)]\r
-           public string str; \r
-       }\r
-       \r
-       public class clsPerson\r
-       {\r
-               public IList EmailAccounts;\r
-       }\r
-       \r
-       public class ArrayClass\r
-       {\r
-               public object names = new object[] { "un","dos" };\r
-       }\r
-       \r
-       public class CompositeValueType\r
-       {\r
-               public void Init ()\r
-               {\r
-                       Items = new object[] { 1, 2 };\r
-                       ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.In, ItemsChoiceType.Es };\r
-               }\r
-          \r
-               [XmlElementAttribute("Es", typeof(int))]\r
-               [XmlElementAttribute("In", typeof(int))]\r
-               [XmlChoiceIdentifierAttribute("ItemsElementName")]\r
-               public object[] Items;\r
-          \r
-               [XmlElementAttribute("ItemsElementName")]\r
-               [XmlIgnoreAttribute()]\r
-               public ItemsChoiceType[] ItemsElementName;\r
-       }\r
-\r
-       public enum ItemsChoiceType {\r
-          In, Es\r
-       }\r
-       \r
-       public class ArrayAttributeWithType\r
-       {\r
-               [XmlAttribute (DataType="anyURI")]\r
-               public string[] at = new string [] { "a","b" };\r
-\r
-               [XmlAttribute (DataType="base64Binary")]\r
-               public byte[][] bin1 = new byte[][] { new byte[]{1,2},  new byte[]{1,2}};\r
-               \r
-               [XmlAttribute (DataType="base64Binary")]\r
-               public byte[] bin2 = new byte[] { 1,2 };\r
-       }\r
-       \r
-       public class ArrayAttributeWithWrongType\r
-       {\r
-               [XmlAttribute (DataType="int")]\r
-               public string[] at = new string [] { "a","b" };\r
-       }\r
-       \r
-       [XmlType ("Container")]\r
-       public class EntityContainer\r
-       {\r
-               EntityCollection collection1;\r
-               EntityCollection collection2;\r
-               EntityCollection collection3 = new EntityCollection ("root");\r
-               EntityCollection collection4 = new EntityCollection ("root");\r
-               \r
-               [XmlArray (IsNullable=true)]\r
-               public EntityCollection Collection1 {\r
-                       get { return collection1; }\r
-                       set { collection1 = value; collection1.Container = "assigned"; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=false)]\r
-               public EntityCollection Collection2 {\r
-                       get { return collection2; }\r
-                       set { collection2 = value; collection2.Container = "assigned"; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=true)]\r
-               public EntityCollection Collection3 {\r
-                       get { return collection3; }\r
-                       set { collection3 = value; collection3.Container = "assigned"; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=false)]\r
-               public EntityCollection Collection4 {\r
-                       get { return collection4; }\r
-                       set { collection4 = value; collection4.Container = "assigned"; }\r
-               }\r
-       }\r
-       \r
-       [XmlType ("Container")]\r
-       public class ArrayEntityContainer\r
-       {\r
-               Entity[] collection1;\r
-               Entity[] collection2;\r
-               Entity[] collection3 = new Entity [0];\r
-               Entity[] collection4 = new Entity [0];\r
-               \r
-               [XmlArray (IsNullable=true)]\r
-               public Entity[] Collection1 {\r
-                       get { return collection1; }\r
-                       set { collection1 = value; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=false)]\r
-               public Entity[] Collection2 {\r
-                       get { return collection2; }\r
-                       set { collection2 = value; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=true)]\r
-               public Entity[] Collection3 {\r
-                       get { return collection3; }\r
-                       set { collection3 = value; }\r
-               }\r
-               \r
-               [XmlArray (IsNullable=false)]\r
-               public Entity[] Collection4 {\r
-                       get { return collection4; }\r
-                       set { collection4 = value; }\r
-               }\r
-       }\r
-       \r
-       public class Entity\r
-       {\r
-               private string _name = string.Empty;\r
-               private string _parent = null;\r
-\r
-               [XmlAttribute]\r
-               public string Name {\r
-                       get { return _name; }\r
-                       set { _name = value; }\r
-               }\r
-\r
-               [XmlIgnore] \r
-               public string Parent {\r
-                       get { return _parent; }\r
-                       set { _parent = value; }\r
-               }\r
-       }\r
-\r
-       public class EntityCollection : ArrayList\r
-       {\r
-               public string _container;\r
-\r
-               public EntityCollection ()\r
-               {\r
-               }\r
-\r
-               public EntityCollection (string c)\r
-               {\r
-                       _container = c;\r
-               }\r
-\r
-               public string Container {\r
-                       get { return _container; }\r
-                       set { _container = value; }\r
-               }\r
-\r
-               public int Add (Entity value)\r
-               {\r
-                       if(_container != null)\r
-                               value.Parent = _container;\r
-\r
-                       return base.Add(value);\r
-               }\r
-\r
-               public new Entity this[int index]\r
-               {\r
-                       get { return (Entity) base[index]; }\r
-                       set { base[index] = value; }\r
-               }\r
-       }\r
-       \r
-       [XmlType ("Container")]\r
-       public class ObjectWithReadonlyCollection\r
-       {\r
-               EntityCollection collection1 = new EntityCollection ("root");\r
-               \r
-               public EntityCollection Collection1 {\r
-                       get { return collection1; }\r
-               }\r
-       }\r
-       \r
-       [XmlType ("Container")]\r
-       public class ObjectWithReadonlyNulCollection\r
-       {\r
-               EntityCollection collection1;\r
-               \r
-               public EntityCollection Collection1 {\r
-                       get { return collection1; }\r
-               }\r
-       }\r
-       \r
-       [XmlType ("Container")]\r
-       public class ObjectWithReadonlyArray\r
-       {\r
-               Entity[] collection1 = new Entity [0];\r
-               \r
-               public Entity[] Collection1 {\r
-                       get { return collection1; }\r
-               }\r
-       }\r
-       \r
-       [XmlInclude (typeof(SubclassTestSub))]\r
-       public class SubclassTestBase\r
-       {\r
-       }\r
-       \r
-       public class SubclassTestSub: SubclassTestBase\r
-       {\r
-       }\r
-       \r
-       public class SubclassTestExtra\r
-       {\r
-       }\r
-       \r
-       public class SubclassTestContainer\r
-       {\r
-               [XmlElement ("a", typeof(SubclassTestBase))]\r
-               [XmlElement ("b", typeof(SubclassTestExtra))]\r
-               public object data;\r
-       }\r
-\r
-       public class DictionaryWithIndexer : DictionaryBase\r
-       {\r
-               public TimeSpan this[int index] {\r
-                       get { return TimeSpan.MinValue; }\r
-               }\r
-\r
-               public void Add (TimeSpan value)\r
-               {\r
-               }\r
-       }\r
-\r
-       [XmlRoot(Namespace="some:urn")]\r
-       [SoapTypeAttribute (Namespace="another:urn")]\r
-       public class PrimitiveTypesContainer\r
-       {\r
-               public PrimitiveTypesContainer ()\r
-               {\r
-                       Number = 2004;\r
-                       Name = "some name";\r
-                       Index = (byte) 56;\r
-                       Password = new byte[] { 243, 15 };\r
-                       PathSeparatorCharacter = '/';\r
-               }\r
-\r
-               public int Number;\r
-               public string Name;\r
-               public byte Index;\r
-               public byte[] Password;\r
-               public char PathSeparatorCharacter;\r
-       }\r
-       \r
-       public class TestSchemaForm1\r
-       {\r
-               public PrintTypeResponse p1;\r
-               \r
-               [XmlElement(Namespace="urn:oo")]\r
-               public PrintTypeResponse p2;\r
-       }\r
-\r
-       [XmlType (Namespace="urn:testForm")]\r
-       public class TestSchemaForm2\r
-       {\r
-               public PrintTypeResponse p1;\r
-               \r
-               [XmlElement(Namespace="urn:oo")]\r
-               public PrintTypeResponse p2;\r
-       }\r
-\r
-       [XmlType (Namespace="urn:responseTypes")]\r
-       public class PrintTypeResponse {\r
-               [XmlElement (Form=XmlSchemaForm.Unqualified, IsNullable=true)]\r
-           public OutputType result;\r
-           public PrintTypeResponse intern;\r
-           \r
-           public void Init ()\r
-           {\r
-               result = new OutputType ();\r
-               result.data = "data1";\r
-               intern = new PrintTypeResponse ();\r
-               intern.result = new OutputType ();\r
-               intern.result.data = "data2";\r
-           }\r
-       }\r
-\r
-       [XmlType (Namespace="urn:responseTypes")]\r
-       public class OutputType {\r
-           \r
-               [XmlElement (Form=XmlSchemaForm.Unqualified, IsNullable=true)]\r
-           public string data;\r
-       }\r
-\r
-       [XmlRootAttribute ("testDefault", Namespace="urn:myNS", IsNullable=false)]\r
-       [SoapType("testDefault", Namespace="urn:myNS")]\r
-       public class TestDefault\r
-       {\r
-               public string str;\r
-\r
-               [DefaultValue ("Default Value")]\r
-               public string strDefault = "Default Value";\r
-\r
-               [DefaultValue (true)]\r
-               public bool boolT = true;\r
-\r
-               [DefaultValue (false)]\r
-               public bool boolF = false;\r
-\r
-               [DefaultValue (typeof (decimal), "10")]\r
-               public decimal decimalval = 10m;\r
-\r
-               [DefaultValue (FlagEnum.e1 | FlagEnum.e4)]\r
-               public FlagEnum flag = (FlagEnum.e1 | FlagEnum.e4);\r
-\r
-               [DefaultValue (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4)]\r
-               public FlagEnum_Encoded flagencoded = (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4);\r
-       }\r
-\r
-       [XmlType ("optionalValueType", Namespace="some:urn")]\r
-       [XmlRootAttribute ("optionalValue", Namespace="another:urn", IsNullable=false)]\r
-       public class OptionalValueTypeContainer\r
-       {\r
-               [DefaultValue (FlagEnum.e1 | FlagEnum.e4)]\r
-               public FlagEnum Attributes = FlagEnum.e1 | FlagEnum.e4;\r
-\r
-               [DefaultValue (FlagEnum.e1)]\r
-               public FlagEnum Flags = FlagEnum.e1;\r
-\r
-               [XmlIgnore]\r
-               [SoapIgnore]\r
-               public bool FlagsSpecified;\r
-\r
-               [DefaultValue (false)]\r
-               public bool IsEmpty;\r
-\r
-               [XmlIgnore]\r
-               [SoapIgnore]\r
-               public bool IsEmptySpecified {\r
-                       get { return _isEmptySpecified; }\r
-                       set { _isEmptySpecified = value; }\r
-               }\r
-\r
-               [DefaultValue (false)]\r
-               public bool IsNull;\r
-\r
-               private bool _isEmptySpecified;\r
-       }\r
-\r
-       public class Group\r
-       {\r
-               [SoapAttribute (Namespace = "http://www.cpandl.com")]\r
-               public string GroupName;\r
-\r
-               [SoapAttribute (DataType = "base64Binary")]\r
-               public Byte [] GroupNumber;\r
-\r
-               [SoapAttribute (DataType = "date", AttributeName = "CreationDate")]\r
-               public DateTime Today;\r
-\r
-               [SoapElement (DataType = "nonNegativeInteger", ElementName = "PosInt")]\r
-               public string PostitiveInt;\r
-\r
-               [SoapIgnore]\r
-               public bool IgnoreThis;\r
-\r
-               [DefaultValue (GroupType.B)]\r
-               public GroupType Grouptype;\r
-               public Vehicle MyVehicle;\r
-\r
-               [SoapInclude (typeof (Car))]\r
-               public Vehicle myCar (string licNumber)\r
-               {\r
-                       Vehicle v;\r
-                       if (licNumber == string.Empty) {\r
-                               v = new Car();\r
-                               v.licenseNumber = "!!!!!!";\r
-                       } else {\r
-                               v = new Car();\r
-                               v.licenseNumber = licNumber;\r
-                       }\r
-                       return v;\r
-               }\r
-       }\r
-\r
-       [SoapInclude (typeof (Car))]\r
-       public abstract class Vehicle\r
-       {\r
-               public string licenseNumber;\r
-               [SoapElement (DataType = "date")]\r
-               public DateTime makeDate;\r
-               [DefaultValue ("450")]\r
-               public string weight;\r
-       }\r
-\r
-       public class Car: Vehicle\r
-       {\r
-       }\r
-\r
-       public enum GroupType\r
-       {\r
-               [SoapEnum ("Small")]\r
-               A,\r
-               [SoapEnum ("Large")]\r
-               B\r
-       }\r
-}\r
+//
+// System.Xml.XmlSerializerTestClasses
+//
+// Author:
+//   Erik LeBel <eriklebel@yahoo.ca>
+//
+// (C) 2003 Erik LeBel
+//
+// Classes to use in the testing of the XmlSerializer
+//
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace MonoTests.System.Xml.TestClasses
+{
+       public enum SimpleEnumeration { FIRST, SECOND };
+
+       [Flags]
+       public enum EnumDefaultValue { e1 = 1, e2 = 2, e3 = 3 }
+       public enum EnumDefaultValueNF { e1 = 1, e2 = 2, e3 = 3 }
+
+       [Flags]
+       public enum FlagEnum { 
+               [XmlEnum ("one")]
+               e1 = 1,
+               [XmlEnum ("two")]
+               e2 = 2,
+               [XmlEnum ("four")]
+               e4 = 4
+       }
+
+       [Flags]
+       [SoapType ("flagenum")]
+       public enum FlagEnum_Encoded
+       {
+               [SoapEnum ("one")]
+               e1 = 1,
+               [SoapEnum ("two")]
+               e2 = 2,
+               [SoapEnum ("four")]
+               e4 = 4
+       }
+
+       [Flags]
+       public enum ZeroFlagEnum {
+               [XmlEnum ("zero")]
+               e0 = 0,
+               [XmlEnum ("o<n>e")]
+               e1 = 1,
+               [XmlEnum ("tns:t<w>o")]
+               e2 = 2,
+               [XmlEnum ("four")]
+               [XmlIgnore]
+               e4 = 4
+       }
+       
+       public class SimpleClass
+       {
+               public string something = null;
+       }
+
+       public class StringCollection : CollectionBase
+       {
+               public void Add (String parameter) 
+               {
+                       List.Insert (Count, parameter);
+               }
+                       
+               public String this [int index]
+               {
+                       get
+                       { 
+                               if (index < 0 || index > Count)
+                                       throw new ArgumentOutOfRangeException ();
+                                       
+                               return (String) List [index]; 
+                       }
+                       set { List [index] = value; }
+               }
+       }
+       
+       public class StringCollectionContainer
+       {
+               StringCollection messages = new StringCollection();
+               
+               public StringCollection Messages
+               {
+                       get { return messages; }
+               }
+       }
+
+       public class ArrayContainer
+       {
+               public object [] items = null;
+       }
+       
+       public class ClassArrayContainer
+       {
+               public SimpleClass [] items = null;
+       }
+       
+       [XmlRoot("simple")]
+       public class SimpleClassWithXmlAttributes
+       {
+               [XmlAttribute("member")]
+               public string something = null;
+       }
+       
+       [XmlRoot("field")]
+       public class Field
+       {
+               [XmlAttribute ("flag1")]
+               [DefaultValue (1)]
+               public FlagEnum Flags1;
+
+               [XmlAttribute ("flag2")]
+               [DefaultValue (FlagEnum.e1)]
+               public FlagEnum Flags2;
+
+               [XmlAttribute ("flag3", Form = XmlSchemaForm.Qualified)]
+               [DefaultValue (FlagEnum.e1 | FlagEnum.e2)]
+               public FlagEnum Flags3;
+
+               [XmlAttribute ("flag4")]
+               public FlagEnum Flags4;
+
+               [XmlAttribute("modifiers")]
+               public MapModifiers Modifiers;
+
+               [XmlAttribute ("modifiers2", Form=XmlSchemaForm.Unqualified)]
+               public MapModifiers Modifiers2;
+
+               [XmlAttribute ("modifiers3")]
+               [DefaultValue (0)]
+               public MapModifiers Modifiers3;
+
+               [XmlAttribute ("modifiers4", Form=XmlSchemaForm.Unqualified)]
+               [DefaultValue (MapModifiers.Protected)]
+               public MapModifiers Modifiers4;
+
+               [XmlAttribute ("modifiers5", Form = XmlSchemaForm.Qualified)]
+               [DefaultValue (MapModifiers.Public)]
+               public MapModifiers Modifiers5;
+
+               [XmlAttribute ("names")]
+               public string[] Names;
+
+               [XmlAttribute ("street")]
+               public string Street;
+       }
+
+       [SoapType ("field", Namespace = "some:urn")]
+       public class Field_Encoded
+       {
+               [SoapAttribute ("flag1")]
+               [DefaultValue (FlagEnum_Encoded.e1)]
+               public FlagEnum_Encoded Flags1;
+
+               [SoapAttribute ("flag2")]
+               [DefaultValue (FlagEnum_Encoded.e1)]
+               public FlagEnum_Encoded Flags2;
+
+               [SoapAttribute ("flag3")]
+               [DefaultValue (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2)]
+               public FlagEnum_Encoded Flags3;
+
+               [SoapAttribute ("flag4")]
+               public FlagEnum_Encoded Flags4;
+
+               [SoapAttribute ("modifiers")]
+               public MapModifiers Modifiers;
+
+               [SoapAttribute ("modifiers2")]
+               public MapModifiers Modifiers2;
+
+               [SoapAttribute ("modifiers3")]
+               [DefaultValue (MapModifiers.Public)]
+               public MapModifiers Modifiers3;
+
+               [SoapAttribute ("modifiers4")]
+               [DefaultValue (MapModifiers.Protected)]
+               public MapModifiers Modifiers4;
+
+               [SoapAttribute ("modifiers5")]
+               [DefaultValue (MapModifiers.Public)]
+               public MapModifiers Modifiers5;
+
+               public string[] Names;
+
+               [SoapAttribute ("street")]
+               public string Street;
+       }
+
+       [Flags]
+       public enum MapModifiers
+       {
+               [XmlEnum("public")]
+               [SoapEnum ("PuBlIc")]
+               Public = 0,
+               [XmlEnum("protected")]
+               Protected = 1,
+       }
+
+       public class MyList : ArrayList
+       {
+               object container;
+               
+               // NOTE: MyList has no public constructor
+               public MyList (object container) : base()
+               {
+                       this.container = container;
+               }
+       }
+       
+       public class Container
+       {
+               public MyList Items;
+               
+               public Container () {
+                       Items = new MyList(this);
+               }
+       }
+       
+       public class Container2
+       {
+               public MyList Items;
+               
+               public Container2 () {
+               }
+               
+               public Container2 (bool b) {
+                       Items = new MyList(this);
+               }
+       }
+
+       public class MyElem: XmlElement
+       {
+               public MyElem (XmlDocument doc): base ("","myelem","", doc)
+               {
+                       SetAttribute ("aa","1");
+               }
+
+               [XmlAttribute]
+               public int kk=1;
+       }
+
+       public class MyDocument: XmlDocument
+       {
+               public MyDocument ()
+               {
+               }
+
+               [XmlAttribute]
+               public int kk=1;
+       }
+       
+       public class CDataContainer
+       {
+               public XmlCDataSection cdata;
+       }
+       
+       public class NodeContainer
+       {
+               public XmlNode node;
+       }
+       
+       public class Choices
+       {
+               [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]
+               [XmlElementAttribute("ChoiceOne", typeof(string), IsNullable=false)]
+               [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]
+               [XmlChoiceIdentifier("ItemType")]
+               public string MyChoice;
+
+               [XmlIgnore]
+               public ItemChoiceType ItemType;
+       }
+       
+       [XmlType(IncludeInSchema = false)]
+       public enum ItemChoiceType
+       {
+               ChoiceZero,
+               [XmlEnum ("ChoiceOne")]
+               StrangeOne,
+               ChoiceTwo,
+       }
+       
+       public class WrongChoices
+       {
+               [XmlElementAttribute("ChoiceZero", typeof(string), IsNullable=false)]
+               [XmlElementAttribute("StrangeOne", typeof(string), IsNullable=false)]
+               [XmlElementAttribute("ChoiceTwo", typeof(string), IsNullable=false)]
+               [XmlChoiceIdentifier("ItemType")]
+               public string MyChoice;
+
+               [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"; }
+               } 
+       }
+       
+       [XmlRoot("root")]
+       public class ListDefaults
+       {
+               public ListDefaults ()
+               {
+                       ed = new SimpleClass ();
+                       str = "hola";
+               }
+               
+           public ArrayList list2;
+           
+           public MyList list3;
+           
+           public string[] list4;
+           
+               [XmlElement("e", typeof(SimpleClass))]
+           public ArrayList list5;
+           
+               [DefaultValue (null)]
+           public SimpleClass ed;
+           
+               [DefaultValue (null)]
+           public string str; 
+       }
+       
+       public class clsPerson
+       {
+               public IList EmailAccounts;
+       }
+       
+       public class ArrayClass
+       {
+               public object names = new object[] { "un","dos" };
+       }
+       
+       public class CompositeValueType
+       {
+               public void Init ()
+               {
+                       Items = new object[] { 1, 2 };
+                       ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.In, ItemsChoiceType.Es };
+               }
+          
+               [XmlElementAttribute("Es", typeof(int))]
+               [XmlElementAttribute("In", typeof(int))]
+               [XmlChoiceIdentifierAttribute("ItemsElementName")]
+               public object[] Items;
+          
+               [XmlElementAttribute("ItemsElementName")]
+               [XmlIgnoreAttribute()]
+               public ItemsChoiceType[] ItemsElementName;
+       }
+
+       public enum ItemsChoiceType {
+          In, Es
+       }
+       
+       public class ArrayAttributeWithType
+       {
+               [XmlAttribute (DataType="anyURI")]
+               public string[] at = new string [] { "a","b" };
+
+               [XmlAttribute (DataType="base64Binary")]
+               public byte[][] bin1 = new byte[][] { new byte[]{1,2},  new byte[]{1,2}};
+               
+               [XmlAttribute (DataType="base64Binary")]
+               public byte[] bin2 = new byte[] { 1,2 };
+       }
+       
+       public class ArrayAttributeWithWrongType
+       {
+               [XmlAttribute (DataType="int")]
+               public string[] at = new string [] { "a","b" };
+       }
+       
+       [XmlType ("Container")]
+       public class EntityContainer
+       {
+               EntityCollection collection1;
+               EntityCollection collection2;
+               EntityCollection collection3 = new EntityCollection ("root");
+               EntityCollection collection4 = new EntityCollection ("root");
+               
+               [XmlArray (IsNullable=true)]
+               public EntityCollection Collection1 {
+                       get { return collection1; }
+                       set { collection1 = value; collection1.Container = "assigned"; }
+               }
+               
+               [XmlArray (IsNullable=false)]
+               public EntityCollection Collection2 {
+                       get { return collection2; }
+                       set { collection2 = value; collection2.Container = "assigned"; }
+               }
+               
+               [XmlArray (IsNullable=true)]
+               public EntityCollection Collection3 {
+                       get { return collection3; }
+                       set { collection3 = value; collection3.Container = "assigned"; }
+               }
+               
+               [XmlArray (IsNullable=false)]
+               public EntityCollection Collection4 {
+                       get { return collection4; }
+                       set { collection4 = value; collection4.Container = "assigned"; }
+               }
+       }
+       
+       [XmlType ("Container")]
+       public class ArrayEntityContainer
+       {
+               Entity[] collection1;
+               Entity[] collection2;
+               Entity[] collection3 = new Entity [0];
+               Entity[] collection4 = new Entity [0];
+               
+               [XmlArray (IsNullable=true)]
+               public Entity[] Collection1 {
+                       get { return collection1; }
+                       set { collection1 = value; }
+               }
+               
+               [XmlArray (IsNullable=false)]
+               public Entity[] Collection2 {
+                       get { return collection2; }
+                       set { collection2 = value; }
+               }
+               
+               [XmlArray (IsNullable=true)]
+               public Entity[] Collection3 {
+                       get { return collection3; }
+                       set { collection3 = value; }
+               }
+               
+               [XmlArray (IsNullable=false)]
+               public Entity[] Collection4 {
+                       get { return collection4; }
+                       set { collection4 = value; }
+               }
+       }
+       
+       public class Entity
+       {
+               private string _name = string.Empty;
+               private string _parent = null;
+
+               [XmlAttribute]
+               public string Name {
+                       get { return _name; }
+                       set { _name = value; }
+               }
+
+               [XmlIgnore] 
+               public string Parent {
+                       get { return _parent; }
+                       set { _parent = value; }
+               }
+       }
+
+       public class EntityCollection : ArrayList
+       {
+               public string _container;
+
+               public EntityCollection ()
+               {
+               }
+
+               public EntityCollection (string c)
+               {
+                       _container = c;
+               }
+
+               public string Container {
+                       get { return _container; }
+                       set { _container = value; }
+               }
+
+               public int Add (Entity value)
+               {
+                       if(_container != null)
+                               value.Parent = _container;
+
+                       return base.Add(value);
+               }
+
+               public new Entity this[int index]
+               {
+                       get { return (Entity) base[index]; }
+                       set { base[index] = value; }
+               }
+       }
+       
+       [XmlType ("Container")]
+       public class ObjectWithReadonlyCollection
+       {
+               EntityCollection collection1 = new EntityCollection ("root");
+               
+               public EntityCollection Collection1 {
+                       get { return collection1; }
+               }
+       }
+       
+       [XmlType ("Container")]
+       public class ObjectWithReadonlyNulCollection
+       {
+               EntityCollection collection1;
+               
+               public EntityCollection Collection1 {
+                       get { return collection1; }
+               }
+       }
+       
+       [XmlType ("Container")]
+       public class ObjectWithReadonlyArray
+       {
+               Entity[] collection1 = new Entity [0];
+               
+               public Entity[] Collection1 {
+                       get { return collection1; }
+               }
+       }
+       
+       [XmlInclude (typeof(SubclassTestSub))]
+       public class SubclassTestBase
+       {
+       }
+       
+       public class SubclassTestSub: SubclassTestBase
+       {
+       }
+       
+       public class SubclassTestExtra
+       {
+       }
+       
+       public class SubclassTestContainer
+       {
+               [XmlElement ("a", typeof(SubclassTestBase))]
+               [XmlElement ("b", typeof(SubclassTestExtra))]
+               public object data;
+       }
+
+       public class DictionaryWithIndexer : DictionaryBase
+       {
+               public TimeSpan this[int index] {
+                       get { return TimeSpan.MinValue; }
+               }
+
+               public void Add (TimeSpan value)
+               {
+               }
+       }
+
+       [XmlRoot(Namespace="some:urn")]
+       [SoapTypeAttribute (Namespace="another:urn")]
+       public class PrimitiveTypesContainer
+       {
+               public PrimitiveTypesContainer ()
+               {
+                       Number = 2004;
+                       Name = "some name";
+                       Index = (byte) 56;
+                       Password = new byte[] { 243, 15 };
+                       PathSeparatorCharacter = '/';
+               }
+
+               public int Number;
+               public string Name;
+               public byte Index;
+               public byte[] Password;
+               public char PathSeparatorCharacter;
+       }
+       
+       public class TestSchemaForm1
+       {
+               public PrintTypeResponse p1;
+               
+               [XmlElement(Namespace="urn:oo")]
+               public PrintTypeResponse p2;
+       }
+
+       [XmlType (Namespace="urn:testForm")]
+       public class TestSchemaForm2
+       {
+               public PrintTypeResponse p1;
+               
+               [XmlElement(Namespace="urn:oo")]
+               public PrintTypeResponse p2;
+       }
+
+       [XmlType (Namespace="urn:responseTypes")]
+       public class PrintTypeResponse {
+               [XmlElement (Form=XmlSchemaForm.Unqualified, IsNullable=true)]
+           public OutputType result;
+           public PrintTypeResponse intern;
+           
+           public void Init ()
+           {
+               result = new OutputType ();
+               result.data = "data1";
+               intern = new PrintTypeResponse ();
+               intern.result = new OutputType ();
+               intern.result.data = "data2";
+           }
+       }
+
+       [XmlType (Namespace="urn:responseTypes")]
+       public class OutputType {
+           
+               [XmlElement (Form=XmlSchemaForm.Unqualified, IsNullable=true)]
+           public string data;
+       }
+
+       [XmlRootAttribute ("testDefault", Namespace="urn:myNS", IsNullable=false)]
+       [SoapType("testDefault", Namespace="urn:myNS")]
+       public class TestDefault
+       {
+               public string str;
+
+               [DefaultValue ("Default Value")]
+               public string strDefault = "Default Value";
+
+               [DefaultValue (true)]
+               public bool boolT = true;
+
+               [DefaultValue (false)]
+               public bool boolF = false;
+
+               [DefaultValue (typeof (decimal), "10")]
+               public decimal decimalval = 10m;
+
+               [DefaultValue (FlagEnum.e1 | FlagEnum.e4)]
+               public FlagEnum flag = (FlagEnum.e1 | FlagEnum.e4);
+
+               [DefaultValue (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4)]
+               public FlagEnum_Encoded flagencoded = (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4);
+       }
+
+       [XmlType ("optionalValueType", Namespace="some:urn")]
+       [XmlRootAttribute ("optionalValue", Namespace="another:urn", IsNullable=false)]
+       public class OptionalValueTypeContainer
+       {
+               [DefaultValue (FlagEnum.e1 | FlagEnum.e4)]
+               public FlagEnum Attributes = FlagEnum.e1 | FlagEnum.e4;
+
+               [DefaultValue (FlagEnum.e1)]
+               public FlagEnum Flags = FlagEnum.e1;
+
+               [XmlIgnore]
+               [SoapIgnore]
+               public bool FlagsSpecified;
+
+               [DefaultValue (false)]
+               public bool IsEmpty;
+
+               [XmlIgnore]
+               [SoapIgnore]
+               public bool IsEmptySpecified {
+                       get { return _isEmptySpecified; }
+                       set { _isEmptySpecified = value; }
+               }
+
+               [DefaultValue (false)]
+               public bool IsNull;
+
+               private bool _isEmptySpecified;
+       }
+
+       public class Group
+       {
+               [SoapAttribute (Namespace = "http://www.cpandl.com")]
+               public string GroupName;
+
+               [SoapAttribute (DataType = "base64Binary")]
+               public Byte [] GroupNumber;
+
+               [SoapAttribute (DataType = "date", AttributeName = "CreationDate")]
+               public DateTime Today;
+
+               [SoapElement (DataType = "nonNegativeInteger", ElementName = "PosInt")]
+               public string PostitiveInt;
+
+               [SoapIgnore]
+               public bool IgnoreThis;
+
+               [DefaultValue (GroupType.B)]
+               public GroupType Grouptype;
+               public Vehicle MyVehicle;
+
+               [SoapInclude (typeof (Car))]
+               public Vehicle myCar (string licNumber)
+               {
+                       Vehicle v;
+                       if (licNumber == string.Empty) {
+                               v = new Car();
+                               v.licenseNumber = "!!!!!!";
+                       } else {
+                               v = new Car();
+                               v.licenseNumber = licNumber;
+                       }
+                       return v;
+               }
+       }
+
+       [SoapInclude (typeof (Car))]
+       public abstract class Vehicle
+       {
+               public string licenseNumber;
+               [SoapElement (DataType = "date")]
+               public DateTime makeDate;
+               [DefaultValue ("450")]
+               public string weight;
+       }
+
+       public class Car: Vehicle
+       {
+       }
+
+       public enum GroupType
+       {
+               [SoapEnum ("Small")]
+               A,
+               [SoapEnum ("Large")]
+               B
+       }
+}
index b182d08038689e25591bd671bc0ff063a23a11a8..81f2b3b3e1aa9f849b282f7e4dda35f0b5239ac3 100644 (file)
-//\r
-// System.Xml.XmlSerializerTests\r
-//\r
-// Author:\r
-//   Erik LeBel <eriklebel@yahoo.ca>\r
-//\r
-// (C) 2003 Erik LeBel\r
-//\r
-//\r
-// NOTES:\r
-//  Where possible, these tests avoid testing the order of\r
-//  an object's members serialization. Mono and .NET do not\r
-//  reflect members in the same order.\r
-//\r
-//  Only serializations tests so far, no deserialization.\r
-//\r
-// FIXME\r
-//  test XmlArrayAttribute\r
-//  test XmlArrayItemAttribute\r
-//  test serialization of decimal type\r
-//  test serialization of Guid type\r
-//  test XmlNode serialization with and without modifying attributes.\r
-//  test deserialization\r
-//  FIXMEs found in this file\r
-\r
-using System;\r
-using System.Collections;\r
-using System.Globalization;\r
-using System.IO;\r
-using System.Text;\r
-using System.Xml;\r
-using System.Xml.Schema;\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-using MonoTests.System.Xml.TestClasses;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlSerializerTests\r
-       {\r
-               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";\r
-               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";\r
-               const string ANamespace = "some:urn";\r
-               const string AnotherNamespace = "another:urn";\r
-\r
-               StringWriter sw;\r
-               XmlTextWriter xtw;\r
-               XmlSerializer xs;\r
-\r
-               private void SetUpWriter ()\r
-               {\r
-                       sw = new StringWriter ();\r
-                       xtw = new XmlTextWriter (sw);\r
-                       xtw.QuoteChar = '\'';\r
-                       xtw.Formatting = Formatting.None;\r
-               }\r
-\r
-               private string WriterText {\r
-                       get {\r
-                               string val = sw.GetStringBuilder ().ToString ();\r
-                               int offset = val.IndexOf ('>') + 1;\r
-                               val = val.Substring (offset);\r
-                               return Infoset (val);\r
-                       }\r
-               }\r
-\r
-               private void Serialize (object o)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType ());\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void Serialize (object o, Type type)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (type);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void Serialize (object o, XmlSerializerNamespaces ns)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType ());\r
-                       xs.Serialize (xtw, o, ns);\r
-               }\r
-\r
-               private void Serialize (object o, XmlAttributeOverrides ao)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType (), ao);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void Serialize (object o, XmlAttributeOverrides ao, string defaultNamespace)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType (), ao, Type.EmptyTypes,\r
-                               (XmlRootAttribute) null, defaultNamespace);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void Serialize (object o, XmlRootAttribute root)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (o.GetType (), root);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void Serialize (object o, XmlTypeMapping typeMapping)\r
-               {\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (typeMapping);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void SerializeEncoded (object o)\r
-               {\r
-                       SerializeEncoded (o, o.GetType ());\r
-               }\r
-\r
-               private void SerializeEncoded (object o, SoapAttributeOverrides ao)\r
-               {\r
-                       XmlTypeMapping mapping = CreateSoapMapping (o.GetType (), ao);\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (mapping);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void SerializeEncoded (object o, SoapAttributeOverrides ao, string defaultNamespace)\r
-               {\r
-                       XmlTypeMapping mapping = CreateSoapMapping (o.GetType (), ao, defaultNamespace);\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (mapping);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void SerializeEncoded (object o, Type type)\r
-               {\r
-                       XmlTypeMapping mapping = CreateSoapMapping (type);\r
-                       SetUpWriter ();\r
-                       xs = new XmlSerializer (mapping);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               private void SerializeEncoded (XmlTextWriter xtw, object o, Type type)\r
-               {\r
-                       XmlTypeMapping mapping = CreateSoapMapping (type);\r
-                       xs = new XmlSerializer (mapping);\r
-                       xs.Serialize (xtw, o);\r
-               }\r
-\r
-               // test constructors\r
-#if USE_VERSION_1_1    // It doesn't pass on MS.NET 1.1.\r
-               [Test]\r
-               public void TestConstructor()\r
-               {\r
-                       XmlSerializer ser = new XmlSerializer (null, "");\r
-               }\r
-#else\r
-#endif\r
-\r
-               // test basic types ////////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeInt ()\r
-               {\r
-                       Serialize (10);\r
-                       Assert.AreEqual (Infoset ("<int>10</int>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeBool ()\r
-               {\r
-                       Serialize (true);\r
-                       Assert.AreEqual (Infoset ("<boolean>true</boolean>"), WriterText);\r
-\r
-                       Serialize (false);\r
-                       Assert.AreEqual (Infoset ("<boolean>false</boolean>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeString ()\r
-               {\r
-                       Serialize ("hello");\r
-                       Assert.AreEqual (Infoset ("<string>hello</string>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEmptyString ()\r
-               {\r
-                       Serialize (String.Empty);\r
-                       Assert.AreEqual (Infoset ("<string />"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeNullObject ()\r
-               {\r
-                       Serialize (null, typeof (object));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<anyType xmlns:xsd='{0}' xmlns:xsi='{1}' xsi:nil='true' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               [Ignore ("The generated XML is not exact but it is equivalent")]\r
-               public void TestSerializeNullString ()\r
-               {\r
-                       Serialize (null, typeof (string));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<string xmlns:xsd='{0}' xmlns:xsi='{1}' xsi:nil='true' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeIntArray ()\r
-               {\r
-                       Serialize (new int [] { 1, 2, 3, 4 });\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<ArrayOfInt xmlns:xsd='{0}' xmlns:xsi='{1}'><int>1</int><int>2</int><int>3</int><int>4</int></ArrayOfInt>",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEmptyArray ()\r
-               {\r
-                       Serialize (new int [] { });\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<ArrayOfInt xmlns:xsd='{0}' xmlns:xsi='{1}' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeChar ()\r
-               {\r
-                       Serialize ('A');\r
-                       Assert.AreEqual (Infoset ("<char>65</char>"), WriterText);\r
-\r
-                       Serialize ('\0');\r
-                       Assert.AreEqual (Infoset ("<char>0</char>"), WriterText);\r
-\r
-                       Serialize ('\n');\r
-                       Assert.AreEqual (Infoset ("<char>10</char>"), WriterText);\r
-\r
-                       Serialize ('\uFF01');\r
-                       Assert.AreEqual (Infoset ("<char>65281</char>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeFloat ()\r
-               {\r
-                       Serialize (10.78);\r
-                       Assert.AreEqual (Infoset ("<double>10.78</double>"), WriterText);\r
-\r
-                       Serialize (-1e8);\r
-                       Assert.AreEqual (Infoset ("<double>-100000000</double>"), WriterText);\r
-\r
-                       // FIXME test INF and other boundary conditions that may exist with floats\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumeration_FromValue ()\r
-               {\r
-                       Serialize ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));\r
-                       Assert.AreEqual (\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<SimpleEnumeration>SECOND</SimpleEnumeration>",\r
-                               sw.ToString ());\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")]\r
-               public void TestSerializeEnumeration_FromValue_Encoded ()\r
-               {\r
-                       SerializeEncoded ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>SECOND</SimpleEnumeration>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString ());\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumeration ()\r
-               {\r
-                       Serialize (SimpleEnumeration.FIRST);\r
-                       Assert.AreEqual (Infoset ("<SimpleEnumeration>FIRST</SimpleEnumeration>"), WriterText, "#1");\r
-\r
-                       Serialize (SimpleEnumeration.SECOND);\r
-                       Assert.AreEqual (Infoset ("<SimpleEnumeration>SECOND</SimpleEnumeration>"), WriterText, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumeration_Encoded ()\r
-               {\r
-                       SerializeEncoded (SimpleEnumeration.FIRST);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>FIRST</SimpleEnumeration>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#B1");\r
-\r
-                       SerializeEncoded (SimpleEnumeration.SECOND);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>SECOND</SimpleEnumeration>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#B2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValue ()\r
-               {\r
-                       Serialize (new EnumDefaultValue ());\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue />"), WriterText, "#1");\r
-\r
-                       Serialize (new SimpleEnumeration ());\r
-                       Assert.AreEqual (Infoset ("<SimpleEnumeration>FIRST</SimpleEnumeration>"), WriterText, "#2");\r
-\r
-                       Serialize (3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#3");\r
-\r
-                       Serialize (EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#4");\r
-\r
-                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e2, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#5");\r
-\r
-                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#6");\r
-\r
-                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#7");\r
-\r
-                       Serialize (EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#8");\r
-\r
-                       Serialize (3, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>one two</FlagEnum>"), WriterText, "#9");\r
-\r
-                       Serialize (5, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>one four</FlagEnum>"), WriterText, "#10");\r
-\r
-                       Serialize (FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>four</FlagEnum>"), WriterText, "#11");\r
-\r
-                       Serialize (FlagEnum.e1 | FlagEnum.e2, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>one two</FlagEnum>"), WriterText, "#12");\r
-\r
-                       Serialize (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>one two four</FlagEnum>"), WriterText, "#13");\r
-\r
-                       Serialize (FlagEnum.e1 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>one four</FlagEnum>"), WriterText, "#14");\r
-\r
-                       Serialize (FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (Infoset ("<FlagEnum>two four</FlagEnum>"), WriterText, "#15");\r
-\r
-                       Serialize (3, typeof (EnumDefaultValueNF));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>e3</EnumDefaultValueNF>"), WriterText, "#16");\r
-\r
-                       Serialize (EnumDefaultValueNF.e2, typeof (EnumDefaultValueNF));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>e2</EnumDefaultValueNF>"), WriterText, "#17");\r
-\r
-                       Serialize (2, typeof (ZeroFlagEnum));\r
-                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>tns:t&lt;w&gt;o</ZeroFlagEnum>"), WriterText, "#18");\r
-\r
-                       Serialize (new ZeroFlagEnum ()); // enum actually has a field with value 0\r
-                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>zero</ZeroFlagEnum>"), WriterText, "#19");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")]\r
-               public void TestSerializeEnumDefaultValue_Encoded ()\r
-               {\r
-                       SerializeEncoded (new EnumDefaultValue ());\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}' />",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#1");\r
-\r
-                       SerializeEncoded (new SimpleEnumeration ());\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>FIRST</SimpleEnumeration>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#2");\r
-\r
-                       SerializeEncoded (3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#3");\r
-\r
-                       SerializeEncoded (EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#4");\r
-\r
-                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e2, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#5");\r
-\r
-                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#6");\r
-\r
-                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#7");\r
-\r
-                       SerializeEncoded (EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#8");\r
-\r
-                       SerializeEncoded (3, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#9");\r
-\r
-                       SerializeEncoded (5, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e4</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#10");\r
-\r
-                       SerializeEncoded (FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e4</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#11");\r
-\r
-                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e2, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#12");\r
-\r
-                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2 e4</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#13");\r
-\r
-                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e4</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#14");\r
-\r
-                       SerializeEncoded (FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e2 e4</FlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#15");\r
-\r
-                       SerializeEncoded (3, typeof (EnumDefaultValueNF));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValueNF d1p1:type='EnumDefaultValueNF' xmlns:d1p1='{0}'>e3</EnumDefaultValueNF>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#16");\r
-\r
-                       SerializeEncoded (EnumDefaultValueNF.e2, typeof (EnumDefaultValueNF));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<EnumDefaultValueNF d1p1:type='EnumDefaultValueNF' xmlns:d1p1='{0}'>e2</EnumDefaultValueNF>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#17");\r
-\r
-                       SerializeEncoded (2, typeof (ZeroFlagEnum));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<ZeroFlagEnum d1p1:type='ZeroFlagEnum' xmlns:d1p1='{0}'>e2</ZeroFlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#18");\r
-\r
-                       SerializeEncoded (new ZeroFlagEnum ()); // enum actually has a field with value 0\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<ZeroFlagEnum d1p1:type='ZeroFlagEnum' xmlns:d1p1='{0}'>e0</ZeroFlagEnum>",\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#19");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValue_InvalidValue1 ()\r
-               {\r
-                       try {\r
-                               Serialize ("b", typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#A1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#A2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#A3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("e1", typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#B2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#B3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("e1,e2", typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#C2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#C3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize (string.Empty, typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#D2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#D3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("1", typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#E2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#E3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("0", typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#F1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#F2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#F3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize (new SimpleClass (), typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#G1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#G2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#G3");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValue_InvalidValue2 ()\r
-               {\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (5, typeof (EnumDefaultValue));\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                               Assert.IsNotNull (ex.InnerException, "#3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'5'") != -1, "#6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValue).FullName) != -1, "#7");\r
-                       }\r
-#else\r
-                       Serialize (5, typeof (EnumDefaultValue));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValue>5</EnumDefaultValue>"), WriterText);\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValueNF_InvalidValue1 ()\r
-               {\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (new EnumDefaultValueNF ());\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                               Assert.IsNotNull (ex.InnerException, "#3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'0'") != -1, "#6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#7");\r
-                       }\r
-#else\r
-                       Serialize (new EnumDefaultValueNF ());\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>0</EnumDefaultValueNF>"), WriterText);\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValueNF_InvalidValue2 ()\r
-               {\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (15, typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                               Assert.IsNotNull (ex.InnerException, "#3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'15'") != -1, "#6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#7");\r
-                       }\r
-#else\r
-                       Serialize (15, typeof (EnumDefaultValueNF));\r
-                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>15</EnumDefaultValueNF>"), WriterText);\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeEnumDefaultValueNF_InvalidValue3 ()\r
-               {\r
-                       try {\r
-                               Serialize ("b", typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#A1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#A2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#A3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("e2", typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#B1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#B2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#B3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize (string.Empty, typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#C1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#C2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#C3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("1", typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#D2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#D3");\r
-                       }\r
-\r
-                       try {\r
-                               Serialize ("0", typeof (EnumDefaultValueNF));\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.IsNotNull (ex.InnerException, "#E2");\r
-                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#E3");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeField ()\r
-               {\r
-                       Field f = new Field ();\r
-                       Serialize (f, typeof (Field));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='' flag2='' flag3=''" +\r
-                               " flag4='' modifiers='public' modifiers2='public' modifiers4='public' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#A");\r
-\r
-                       f.Flags1 = FlagEnum.e1;\r
-                       f.Flags2 = FlagEnum.e1;\r
-                       f.Flags3 = FlagEnum.e2;\r
-                       f.Modifiers = MapModifiers.Protected;\r
-                       f.Modifiers2 = MapModifiers.Public;\r
-                       f.Modifiers3 = MapModifiers.Public;\r
-                       f.Modifiers4 = MapModifiers.Protected;\r
-                       f.Modifiers5 = MapModifiers.Public;\r
-                       Serialize (f, typeof (Field));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag3='two' flag4=''" +\r
-                               " modifiers='protected' modifiers2='public' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#B");\r
-\r
-                       f.Flags1 = (FlagEnum) 1;\r
-                       f.Flags1 = FlagEnum.e2;\r
-                       f.Flags2 = FlagEnum.e2;\r
-                       f.Flags3 = FlagEnum.e1 | FlagEnum.e2;\r
-                       f.Modifiers = MapModifiers.Public;\r
-                       f.Modifiers2 = MapModifiers.Protected;\r
-                       f.Modifiers3 = MapModifiers.Protected;\r
-                       f.Modifiers4 = MapModifiers.Public;\r
-                       f.Modifiers5 = MapModifiers.Protected;\r
-                       Serialize (f, typeof (Field));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='two' flag2='two'" +\r
-                               " flag4='' modifiers='public' modifiers2='protected'" +\r
-                               " modifiers3='protected' modifiers4='public'" +\r
-                               " modifiers5='protected' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#C");\r
-\r
-                       f.Flags1 = FlagEnum.e1 | FlagEnum.e2;\r
-                       f.Flags2 = FlagEnum.e2;\r
-                       f.Flags3 = FlagEnum.e4;\r
-                       f.Flags4 = FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4;\r
-                       f.Modifiers3 = MapModifiers.Public;\r
-                       f.Modifiers4 = MapModifiers.Protected;\r
-                       f.Modifiers5 = MapModifiers.Public;\r
-                       f.Names = new string [] { "a", "b" };\r
-                       Serialize (f, typeof (Field));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='one two' flag2='two'" +\r
-                               " flag3='four' flag4='one two four' modifiers='public'" +\r
-                               " modifiers2='protected' names='a b' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#D");\r
-\r
-                       f.Flags2 = (FlagEnum) 444;\r
-                       f.Flags3 = (FlagEnum) 555;\r
-                       f.Modifiers = (MapModifiers) 666;\r
-                       f.Modifiers2 = (MapModifiers) 777;\r
-                       f.Modifiers3 = (MapModifiers) 0;\r
-                       f.Modifiers4 = (MapModifiers) 888;\r
-                       f.Modifiers5 = (MapModifiers) 999;\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (f, typeof (Field));\r
-                               Assert.Fail ("#E1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");\r
-                               Assert.IsNotNull (ex.Message, "#E3");\r
-                               Assert.IsNotNull (ex.InnerException, "#E4");\r
-\r
-                               // Instance validation error: '444' is not a valid value for\r
-                               // MonoTests.System.Xml.TestClasses.FlagEnum\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#E6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#E7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#E8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#E9");\r
-                       }\r
-#else\r
-                       Serialize (f, typeof (Field));\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='one two' flag2='444'" +\r
-                               " flag3='555' flag4='one two four' modifiers='666' modifiers2='777'" +\r
-                               " modifiers4='888' modifiers5='999' names='a b' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#E");\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotDotNet")] // MS bug\r
-               public void TestSerializeField_Encoded ()\r
-               {\r
-                       Field_Encoded f = new Field_Encoded ();\r
-                       SerializeEncoded (f, typeof (Field_Encoded));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag1=''" +\r
-                               " flag2='' flag3='' flag4='' modifiers='PuBlIc'" +\r
-                               " modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='some:urn' />",\r
-#else\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1=''" +\r
-                               " flag2='' flag3='' flag4='' modifiers='PuBlIc'" +\r
-                               " modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='some:urn' />",\r
-#endif\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),\r
-                               sw.GetStringBuilder ().ToString (), "#A");\r
-\r
-                       f.Flags1 = FlagEnum_Encoded.e1;\r
-                       f.Flags2 = FlagEnum_Encoded.e1;\r
-                       f.Flags3 = FlagEnum_Encoded.e2;\r
-                       f.Modifiers = MapModifiers.Protected;\r
-                       f.Modifiers2 = MapModifiers.Public;\r
-                       f.Modifiers3 = MapModifiers.Public;\r
-                       f.Modifiers4 = MapModifiers.Protected;\r
-                       f.Modifiers5 = MapModifiers.Public;\r
-                       SerializeEncoded (f, typeof (Field_Encoded));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag3='two'" +\r
-                               " flag4='' modifiers='Protected' modifiers2='PuBlIc'" +\r
-                               " xmlns:q1='some:urn' />",\r
-#else\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag3='two'" +\r
-                               " flag4='' modifiers='Protected' modifiers2='PuBlIc'" +\r
-                               " xmlns:q1='some:urn' />",\r
-#endif\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),\r
-                               sw.GetStringBuilder ().ToString (), "#B");\r
-\r
-                       f.Flags1 = FlagEnum_Encoded.e2;\r
-                       f.Flags2 = FlagEnum_Encoded.e2;\r
-                       f.Flags3 = FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2;\r
-                       f.Modifiers = MapModifiers.Public;\r
-                       f.Modifiers2 = MapModifiers.Protected;\r
-                       f.Modifiers3 = MapModifiers.Protected;\r
-                       f.Modifiers4 = MapModifiers.Public;\r
-                       f.Modifiers5 = MapModifiers.Protected;\r
-                       SerializeEncoded (f, typeof (Field_Encoded));\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag1='two'" +\r
-                               " flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected'" +\r
-                               " modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected'" +\r
-                               " xmlns:q1='some:urn' />",\r
-#else\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='two'" +\r
-                               " flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected'" +\r
-                               " modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected'" +\r
-                               " xmlns:q1='some:urn' />",\r
-#endif\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),\r
-                               sw.GetStringBuilder ().ToString (), "#C");\r
-\r
-                       f.Flags1 = (FlagEnum_Encoded) 1;\r
-                       f.Flags2 = (FlagEnum_Encoded) 444;\r
-                       f.Flags3 = (FlagEnum_Encoded) 555;\r
-                       f.Modifiers = (MapModifiers) 666;\r
-                       f.Modifiers2 = (MapModifiers) 777;\r
-                       f.Modifiers3 = (MapModifiers) 0;\r
-                       f.Modifiers4 = (MapModifiers) 888;\r
-                       f.Modifiers5 = (MapModifiers) 999;\r
-#if NET_2_0\r
-                       try {\r
-#endif\r
-                       SerializeEncoded (f, typeof (Field_Encoded));\r
-#if NET_2_0\r
-                               Assert.Fail ("#D1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error generating the XML document\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");\r
-                               Assert.IsNotNull (ex.Message, "#D3");\r
-                               Assert.IsNotNull (ex.InnerException, "#D4");\r
-\r
-                               // Instance validation error: '444' is not a valid value for\r
-                               // MonoTests.System.Xml.TestClasses.FlagEnum_Encoded\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#D6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum_Encoded).FullName) != -1, "#D8");\r
-                               Assert.IsNull (ex.InnerException.InnerException, "#D9");\r
-                       }\r
-#else\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag2='444'" +\r
-                               " flag3='555' flag4='' modifiers='666' modifiers2='777'" +\r
-                               " modifiers4='888' modifiers5='999' xmlns:q1='some:urn' />",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),\r
-                               sw.GetStringBuilder ().ToString (), "#D");\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeGroup ()\r
-               {\r
-                       Group myGroup = new Group ();\r
-                       myGroup.GroupName = ".NET";\r
-\r
-                       Byte [] hexByte = new Byte [] { 0x64, 0x32 };\r
-                       myGroup.GroupNumber = hexByte;\r
-\r
-                       DateTime myDate = new DateTime (2002, 5, 2);\r
-                       myGroup.Today = myDate;\r
-                       myGroup.PostitiveInt = "10000";\r
-                       myGroup.IgnoreThis = true;\r
-                       Car thisCar = (Car) myGroup.myCar ("1234566");\r
-                       myGroup.MyVehicle = thisCar;\r
-\r
-                       SetUpWriter ();\r
-                       xtw.WriteStartDocument (true);\r
-                       xtw.WriteStartElement ("Wrapper");\r
-                       SerializeEncoded (xtw, myGroup, typeof (Group));\r
-                       xtw.WriteEndElement ();\r
-                       xtw.Close ();\r
-\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns:d2p1='http://www.cpandl.com' CreationDate='2002-05-02' d2p1:GroupName='.NET' GroupNumber='ZDI=' id='id1'>" +\r
-                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +\r
-                               "<Grouptype xsi:type='GroupType'>Small</Grouptype>" +\r
-                               "<MyVehicle href='#id2' />" +\r
-                               "</Group>" +\r
-                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +\r
-                               "<licenseNumber xmlns:q1='{0}' d2p1:type='q1:string'>1234566</licenseNumber>" +\r
-                               "<makeDate xmlns:q2='{0}' d2p1:type='q2:date'>0001-01-01</makeDate>" +\r
-                               "</Car>" +\r
-                               "</Wrapper>",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#1");\r
-\r
-                       myGroup.GroupName = null;\r
-                       myGroup.Grouptype = GroupType.B;\r
-                       myGroup.MyVehicle.licenseNumber = null;\r
-                       myGroup.MyVehicle.weight = "450";\r
-\r
-                       SetUpWriter ();\r
-                       xtw.WriteStartDocument (true);\r
-                       xtw.WriteStartElement ("Wrapper");\r
-                       SerializeEncoded (xtw, myGroup, typeof (Group));\r
-                       xtw.WriteEndElement ();\r
-                       xtw.Close ();\r
-\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<Wrapper>" +\r
-                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' CreationDate='2002-05-02' GroupNumber='ZDI=' id='id1'>" +\r
-                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +\r
-                               "<Grouptype xsi:type='GroupType'>Large</Grouptype>" +\r
-                               "<MyVehicle href='#id2' />" +\r
-                               "</Group>" +\r
-                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +\r
-                               "<makeDate xmlns:q1='{0}' d2p1:type='q1:date'>0001-01-01</makeDate>" +\r
-                               "<weight xmlns:q2='{0}' d2p1:type='q2:string'>450</weight>" +\r
-                               "</Car>" +\r
-                               "</Wrapper>",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeZeroFlagEnum_InvalidValue ()\r
-               {\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (4, typeof (ZeroFlagEnum)); // corresponding enum field is marked XmlIgnore\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                               Assert.IsNotNull (ex.InnerException, "#3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'4'") != -1, "#6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#7");\r
-                       }\r
-#else\r
-                       Serialize (4, typeof (ZeroFlagEnum)); // corresponding enum field is marked XmlIgnore\r
-                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>4</ZeroFlagEnum>"), WriterText);\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeQualifiedName ()\r
-               {\r
-                       Serialize (new XmlQualifiedName ("me", "home.urn"));\r
-                       Assert.AreEqual (Infoset ("<QName xmlns:q1='home.urn'>q1:me</QName>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeBytes ()\r
-               {\r
-                       Serialize ((byte) 0xAB);\r
-                       Assert.AreEqual (Infoset ("<unsignedByte>171</unsignedByte>"), WriterText);\r
-\r
-                       Serialize ((byte) 15);\r
-                       Assert.AreEqual (Infoset ("<unsignedByte>15</unsignedByte>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeByteArrays ()\r
-               {\r
-                       Serialize (new byte [] { });\r
-                       Assert.AreEqual (Infoset ("<base64Binary />"), WriterText);\r
-\r
-                       Serialize (new byte [] { 0xAB, 0xCD });\r
-                       Assert.AreEqual (Infoset ("<base64Binary>q80=</base64Binary>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeDateTime ()\r
-               {\r
-                       DateTime d = new DateTime ();\r
-                       Serialize (d);\r
-\r
-                       TimeZone tz = TimeZone.CurrentTimeZone;\r
-                       TimeSpan off = tz.GetUtcOffset (d);\r
-                       string sp = string.Format ("{0}{1:00}:{2:00}", off.Ticks >= 0 ? "+" : "", off.Hours, off.Minutes);\r
-                       Assert.AreEqual (Infoset ("<dateTime>0001-01-01T00:00:00.0000000" + sp + "</dateTime>"), WriterText);\r
-               }\r
-\r
-               /*\r
-               FIXME\r
-                - decimal\r
-                - Guid\r
-                - XmlNode objects\r
-               \r
-               [Test]\r
-               public void TestSerialize()\r
-               {\r
-                       Serialize();\r
-                       Assert.AreEqual (WriterText, "");\r
-               }\r
-               */\r
-\r
-               // test basic class serialization /////////////////////////////////////         \r
-               [Test]\r
-               public void TestSerializeSimpleClass ()\r
-               {\r
-                       SimpleClass simple = new SimpleClass ();\r
-                       Serialize (simple);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       simple.something = "hello";\r
-\r
-                       Serialize (simple);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeStringCollection ()\r
-               {\r
-                       StringCollection strings = new StringCollection ();\r
-                       Serialize (strings);\r
-                       Assert.AreEqual (Infoset ("<ArrayOfString xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       strings.Add ("hello");\r
-                       strings.Add ("goodbye");\r
-                       Serialize (strings);\r
-                       Assert.AreEqual (Infoset ("<ArrayOfString xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><string>hello</string><string>goodbye</string></ArrayOfString>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeOptionalValueTypeContainer ()\r
-               {\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes attr;\r
-                       OptionalValueTypeContainer optionalValue = new OptionalValueTypeContainer ();\r
-\r
-                       Serialize (optionalValue);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}' />",\r
-#else\r
-                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}' />",\r
-#endif\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace, AnotherNamespace),\r
-                               sw.ToString (), "#1");\r
-\r
-                       attr = new XmlAttributes ();\r
-\r
-                       // remove the DefaultValue attribute on the Flags member\r
-                       overrides.Add (typeof (OptionalValueTypeContainer), "Flags", attr);\r
-                       // remove the DefaultValue attribute on the Attributes member\r
-                       overrides.Add (typeof (OptionalValueTypeContainer), "Attributes", attr);\r
-\r
-                       Serialize (optionalValue, overrides);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}'>" +\r
-#else\r
-                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +\r
-#endif\r
-                               "<Attributes xmlns='{3}'>one four</Attributes>" +\r
-                               "</optionalValue>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,\r
-                               AnotherNamespace, ANamespace), sw.ToString (), "#2");\r
-\r
-                       optionalValue.FlagsSpecified = true;\r
-                       Serialize (optionalValue, overrides);\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}'>" +\r
-#else\r
-                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +\r
-#endif\r
-                               "<Attributes xmlns='{3}'>one four</Attributes>" +\r
-                               "<Flags xmlns='{3}'>one</Flags>" +\r
-                               "</optionalValue>",\r
-                               XmlSchema.Namespace, XmlSchema.InstanceNamespace, AnotherNamespace,\r
-                               ANamespace), sw.ToString (), "#3");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializePlainContainer ()\r
-               {\r
-                       StringCollectionContainer container = new StringCollectionContainer ();\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages /></StringCollectionContainer>"), WriterText);\r
-\r
-                       container.Messages.Add ("hello");\r
-                       container.Messages.Add ("goodbye");\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages><string>hello</string><string>goodbye</string></Messages></StringCollectionContainer>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeArrayContainer ()\r
-               {\r
-                       ArrayContainer container = new ArrayContainer ();\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       container.items = new object [] { 10, 20 };\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><anyType xsi:type='xsd:int'>10</anyType><anyType xsi:type='xsd:int'>20</anyType></items></ArrayContainer>"), WriterText);\r
-\r
-                       container.items = new object [] { 10, "hello" };\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><anyType xsi:type='xsd:int'>10</anyType><anyType xsi:type='xsd:string'>hello</anyType></items></ArrayContainer>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeClassArrayContainer ()\r
-               {\r
-                       ClassArrayContainer container = new ClassArrayContainer ();\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<ClassArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       SimpleClass simple1 = new SimpleClass ();\r
-                       simple1.something = "hello";\r
-                       SimpleClass simple2 = new SimpleClass ();\r
-                       simple2.something = "hello";\r
-                       container.items = new SimpleClass [2];\r
-                       container.items [0] = simple1;\r
-                       container.items [1] = simple2;\r
-                       Serialize (container);\r
-                       Assert.AreEqual (Infoset ("<ClassArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><SimpleClass><something>hello</something></SimpleClass><SimpleClass><something>hello</something></SimpleClass></items></ClassArrayContainer>"), WriterText);\r
-               }\r
-\r
-               // test basic attributes ///////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeSimpleClassWithXmlAttributes ()\r
-               {\r
-                       SimpleClassWithXmlAttributes simple = new SimpleClassWithXmlAttributes ();\r
-                       Serialize (simple);\r
-                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       simple.something = "hello";\r
-                       Serialize (simple);\r
-                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' member='hello' />"), WriterText);\r
-               }\r
-\r
-               // test overrides ///////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeSimpleClassWithOverrides ()\r
-               {\r
-                       // Also tests XmlIgnore\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       attr.XmlIgnore = true;\r
-                       overrides.Add (typeof (SimpleClassWithXmlAttributes), "something", attr);\r
-\r
-                       SimpleClassWithXmlAttributes simple = new SimpleClassWithXmlAttributes ();\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeSchema ()\r
-               {\r
-                       XmlSchema schema = new XmlSchema ();\r
-                       schema.Items.Add (new XmlSchemaAttribute ());\r
-                       schema.Items.Add (new XmlSchemaAttributeGroup ());\r
-                       schema.Items.Add (new XmlSchemaComplexType ());\r
-                       schema.Items.Add (new XmlSchemaNotation ());\r
-                       schema.Items.Add (new XmlSchemaSimpleType ());\r
-                       schema.Items.Add (new XmlSchemaGroup ());\r
-                       schema.Items.Add (new XmlSchemaElement ());\r
-\r
-                       StringWriter sw = new StringWriter ();\r
-                       XmlTextWriter xtw = new XmlTextWriter (sw);\r
-                       xtw.QuoteChar = '\'';\r
-                       xtw.Formatting = Formatting.Indented;\r
-                       XmlSerializer xs = new XmlSerializer (schema.GetType ());\r
-                       xs.Serialize (xtw, schema);\r
-\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>{0}" +\r
-                               "<xsd:schema xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>{0}" +\r
-                               "  <xsd:attribute />{0}" +\r
-                               "  <xsd:attributeGroup />{0}" +\r
-                               "  <xsd:complexType />{0}" +\r
-                               "  <xsd:notation />{0}" +\r
-                               "  <xsd:simpleType />{0}" +\r
-                               "  <xsd:group />{0}" +\r
-                               "  <xsd:element />{0}" +\r
-                               "</xsd:schema>", Environment.NewLine), sw.ToString ());\r
-               }\r
-\r
-               // test xmlText //////////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeXmlTextAttribute ()\r
-               {\r
-                       SimpleClass simple = new SimpleClass ();\r
-                       simple.something = "hello";\r
-\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       attr.XmlText = new XmlTextAttribute ();\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>hello</SimpleClass>"), WriterText, "#1");\r
-\r
-                       attr.XmlText = new XmlTextAttribute (typeof (string));\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>hello</SimpleClass>"), WriterText, "#2");\r
-\r
-                       try {\r
-                               attr.XmlText = new XmlTextAttribute (typeof (byte []));\r
-                               Serialize (simple, overrides);\r
-                               Assert.Fail ("#A1: XmlText.Type does not match the type it serializes: this should have failed");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // there was an error reflecting type 'MonoTests.System.Xml.TestClasses.SimpleClass'\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");\r
-                               Assert.IsNotNull (ex.Message, "#A3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (SimpleClass).FullName) != -1, "#A4");\r
-                               Assert.IsNotNull (ex.InnerException, "#A5");\r
-\r
-                               // there was an error reflecting field 'something'.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#A6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#A7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("something") != -1, "#A8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#A9");\r
-\r
-                               // the type for XmlText may not be specified for primitive types.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#A10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A11");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#A12");\r
-                       }\r
-\r
-                       try {\r
-                               attr.XmlText = new XmlTextAttribute ();\r
-                               attr.XmlText.DataType = "sometype";\r
-                               Serialize (simple, overrides);\r
-                               Assert.Fail ("#B1: XmlText.DataType does not match the type it serializes: this should have failed");\r
-                       } catch (InvalidOperationException ex) {\r
-                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.SimpleClass'.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");\r
-                               Assert.IsNotNull (ex.Message, "#B3");\r
-                               Assert.IsTrue (ex.Message.IndexOf (typeof (SimpleClass).FullName) != -1, "#B4");\r
-                               Assert.IsNotNull (ex.InnerException, "#B5");\r
-\r
-                               // There was an error reflecting field 'something'.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B6");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#B7");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("something") != -1, "#B8");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException, "#B9");\r
-\r
-                               //FIXME\r
-                               /*\r
-                               // There was an error reflecting type 'System.String'.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#B10");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B11");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (string).FullName) != -1, "#B12");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.InnerException, "#B13");\r
-\r
-                               // Value 'sometype' cannot be used for the XmlElementAttribute.DataType property. \r
-                               // The datatype 'http://www.w3.org/2001/XMLSchema:sometype' is missing.\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.InnerException.GetType (), "#B14");\r
-                               Assert.IsNotNull (ex.InnerException.InnerException.InnerException.Message, "#B15");\r
-                               Assert.IsTrue (ex.InnerException.InnerException.InnerException.Message.IndexOf ("http://www.w3.org/2001/XMLSchema:sometype") != -1, "#B16");\r
-                               Assert.IsNull (ex.InnerException.InnerException.InnerException.InnerException, "#B17");\r
-                               */\r
-                       }\r
-               }\r
-\r
-               // test xmlRoot //////////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeXmlRootAttribute ()\r
-               {\r
-                       // constructor override & element name\r
-                       XmlRootAttribute root = new XmlRootAttribute ();\r
-                       root.ElementName = "renamed";\r
-\r
-                       SimpleClassWithXmlAttributes simpleWithAttributes = new SimpleClassWithXmlAttributes ();\r
-                       Serialize (simpleWithAttributes, root);\r
-                       Assert.AreEqual (Infoset ("<renamed xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-\r
-                       SimpleClass simple = null;\r
-                       root.IsNullable = false;\r
-                       try {\r
-                               Serialize (simple, root);\r
-                               Assert.Fail ("Cannot serialize null object if XmlRoot's IsNullable == false");\r
-                       } catch (NullReferenceException) {\r
-                       }\r
-\r
-                       root.IsNullable = true;\r
-                       try {\r
-                               Serialize (simple, root);\r
-                               Assert.Fail ("Cannot serialize null object if XmlRoot's IsNullable == true");\r
-                       } catch (NullReferenceException) {\r
-                       }\r
-\r
-                       simple = new SimpleClass ();\r
-                       root.ElementName = null;\r
-                       root.Namespace = "some.urn";\r
-                       Serialize (simple, root);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='some.urn' />"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlRootAttributeOnMember ()\r
-               {\r
-                       // nested root\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes childAttr = new XmlAttributes ();\r
-                       childAttr.XmlRoot = new XmlRootAttribute ("simple");\r
-                       overrides.Add (typeof (SimpleClass), childAttr);\r
-\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       attr.XmlRoot = new XmlRootAttribute ("simple");\r
-                       overrides.Add (typeof (ClassArrayContainer), attr);\r
-\r
-                       ClassArrayContainer container = new ClassArrayContainer ();\r
-                       container.items = new SimpleClass [1];\r
-                       container.items [0] = new SimpleClass ();\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><SimpleClass /></items></simple>"), WriterText);\r
-\r
-                       // FIXME test data type\r
-               }\r
-\r
-               // test XmlAttribute /////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeXmlAttributeAttribute ()\r
-               {\r
-                       // null\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       attr.XmlAttribute = new XmlAttributeAttribute ();\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       SimpleClass simple = new SimpleClass (); ;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");\r
-\r
-                       // regular\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' something='hello' />"), WriterText, "#2");\r
-\r
-                       // AttributeName\r
-                       attr.XmlAttribute.AttributeName = "somethingelse";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' somethingelse='hello' />"), WriterText, "#3");\r
-\r
-                       // Type\r
-                       // FIXME this should work, shouldnt it?\r
-                       // attr.XmlAttribute.Type = typeof(string);\r
-                       // Serialize(simple, overrides);\r
-                       // Assert(WriterText.EndsWith(" something='hello' />"));\r
-\r
-                       // Namespace\r
-                       attr.XmlAttribute.Namespace = "some:urn";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' d1p1:somethingelse='hello' xmlns:d1p1='some:urn' />"), WriterText, "#4");\r
-\r
-                       // FIXME DataType\r
-                       // FIXME XmlSchemaForm Form\r
-\r
-                       // FIXME write XmlQualifiedName as attribute\r
-               }\r
-\r
-               // test XmlElement ///////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeXmlElementAttribute ()\r
-               {\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       XmlElementAttribute element = new XmlElementAttribute ();\r
-                       attr.XmlElements.Add (element);\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       // null\r
-                       SimpleClass simple = new SimpleClass (); ;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");\r
-\r
-                       // not null\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText, "#2");\r
-\r
-                       //ElementName\r
-                       element.ElementName = "saying";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><saying>hello</saying></SimpleClass>"), WriterText, "#3");\r
-\r
-                       //IsNullable\r
-                       element.IsNullable = false;\r
-                       simple.something = null;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#4");\r
-\r
-                       element.IsNullable = true;\r
-                       simple.something = null;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><saying xsi:nil='true' /></SimpleClass>"), WriterText, "#5");\r
-\r
-                       //Namespace\r
-                       element.ElementName = null;\r
-                       element.IsNullable = false;\r
-                       element.Namespace = "some:urn";\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xmlns='some:urn'>hello</something></SimpleClass>"), WriterText, "#6");\r
-\r
-                       //FIXME DataType\r
-                       //FIXME Form\r
-                       //FIXME Type\r
-               }\r
-\r
-               // test XmlElementAttribute with arrays and collections //////////////////\r
-               [Test]\r
-               public void TestSerializeCollectionWithXmlElementAttribute ()\r
-               {\r
-                       // the rule is:\r
-                       // if no type is specified or the specified type \r
-                       //    matches the contents of the collection, \r
-                       //    serialize each element in an element named after the member.\r
-                       // if the type does not match, or matches the collection itself,\r
-                       //    create a base wrapping element for the member, and then\r
-                       //    wrap each collection item in its own wrapping element based on type.\r
-\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       XmlElementAttribute element = new XmlElementAttribute ();\r
-                       attr.XmlElements.Add (element);\r
-                       overrides.Add (typeof (StringCollectionContainer), "Messages", attr);\r
-\r
-                       // empty collection & no type info in XmlElementAttribute\r
-                       StringCollectionContainer container = new StringCollectionContainer ();\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");\r
-\r
-                       // non-empty collection & no type info in XmlElementAttribute\r
-                       container.Messages.Add ("hello");\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages></StringCollectionContainer>"), WriterText, "#2");\r
-\r
-                       // non-empty collection & only type info in XmlElementAttribute\r
-                       element.Type = typeof (StringCollection);\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages><string>hello</string></Messages></StringCollectionContainer>"), WriterText, "#3");\r
-\r
-                       // non-empty collection & only type info in XmlElementAttribute\r
-                       element.Type = typeof (string);\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages></StringCollectionContainer>"), WriterText, "#4");\r
-\r
-                       // two elements\r
-                       container.Messages.Add ("goodbye");\r
-                       element.Type = null;\r
-                       Serialize (container, overrides);\r
-                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages><Messages>goodbye</Messages></StringCollectionContainer>"), WriterText, "#5");\r
-               }\r
-\r
-               // test DefaultValue /////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeDefaultValueAttribute ()\r
-               {\r
-                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();\r
-\r
-                       XmlAttributes attr = new XmlAttributes ();\r
-                       string defaultValueInstance = "nothing";\r
-                       attr.XmlDefaultValue = defaultValueInstance;\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       // use the default\r
-                       SimpleClass simple = new SimpleClass ();\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A1");\r
-\r
-                       // same value as default\r
-                       simple.something = defaultValueInstance;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A2");\r
-\r
-                       // some other value\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText, "#A3");\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attr = new XmlAttributes ();\r
-                       attr.XmlAttribute = new XmlAttributeAttribute ();\r
-                       attr.XmlDefaultValue = defaultValueInstance;\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       // use the default\r
-                       simple = new SimpleClass ();\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B1");\r
-\r
-                       // same value as default\r
-                       simple.something = defaultValueInstance;\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B2");\r
-\r
-                       // some other value\r
-                       simple.something = "hello";\r
-                       Serialize (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass something='hello' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B3");\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attr = new XmlAttributes ();\r
-                       attr.XmlAttribute = new XmlAttributeAttribute ("flagenc");\r
-                       overrides.Add (typeof (TestDefault), "flagencoded", attr);\r
-\r
-                       // use the default\r
-                       TestDefault testDefault = new TestDefault ();\r
-                       Serialize (testDefault);\r
-                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C1");\r
-\r
-                       // use the default with overrides\r
-                       Serialize (testDefault, overrides);\r
-                       Assert.AreEqual (Infoset ("<testDefault flagenc='e1 e4' xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C2");\r
-\r
-                       overrides = new XmlAttributeOverrides ();\r
-                       attr = new XmlAttributes ();\r
-                       attr.XmlAttribute = new XmlAttributeAttribute ("flagenc");\r
-                       attr.XmlDefaultValue = (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4); // add default again\r
-                       overrides.Add (typeof (TestDefault), "flagencoded", attr);\r
-\r
-                       // use the default with overrides\r
-                       Serialize (testDefault, overrides);\r
-                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C3");\r
-\r
-                       // use the default with overrides and default namspace\r
-                       Serialize (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C4");\r
-\r
-                       // non-default values\r
-                       testDefault.strDefault = "Some Text";\r
-                       testDefault.boolT = false;\r
-                       testDefault.boolF = true;\r
-                       testDefault.decimalval = 20m;\r
-                       testDefault.flag = FlagEnum.e2;\r
-                       testDefault.flagencoded = FlagEnum_Encoded.e2 | FlagEnum_Encoded.e1;\r
-                       Serialize (testDefault);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<testDefault xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault>Some Text</strDefault>" +\r
-                               "    <boolT>false</boolT>" +\r
-                               "    <boolF>true</boolF>" +\r
-                               "    <decimalval>20</decimalval>" +\r
-                               "    <flag>two</flag>" +\r
-                               "    <flagencoded>e1 e2</flagencoded>" +\r
-                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C5");\r
-\r
-                       Serialize (testDefault, overrides);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault>Some Text</strDefault>" +\r
-                               "    <boolT>false</boolT>" +\r
-                               "    <boolF>true</boolF>" +\r
-                               "    <decimalval>20</decimalval>" +\r
-                               "    <flag>two</flag>" +\r
-                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C6");\r
-\r
-                       Serialize (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault>Some Text</strDefault>" +\r
-                               "    <boolT>false</boolT>" +\r
-                               "    <boolF>true</boolF>" +\r
-                               "    <decimalval>20</decimalval>" +\r
-                               "    <flag>two</flag>" +\r
-                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C7");\r
-\r
-                       attr = new XmlAttributes ();\r
-                       XmlTypeAttribute xmlType = new XmlTypeAttribute ("flagenum");\r
-                       xmlType.Namespace = "yetanother:urn";\r
-                       attr.XmlType = xmlType;\r
-                       overrides.Add (typeof (FlagEnum_Encoded), attr);\r
-\r
-                       Serialize (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault>Some Text</strDefault>" +\r
-                               "    <boolT>false</boolT>" +\r
-                               "    <boolF>true</boolF>" +\r
-                               "    <decimalval>20</decimalval>" +\r
-                               "    <flag>two</flag>" +\r
-                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C8");\r
-\r
-                       attr = new XmlAttributes ();\r
-                       attr.XmlType = new XmlTypeAttribute ("testDefault");\r
-                       overrides.Add (typeof (TestDefault), attr);\r
-\r
-                       Serialize (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<testDefault flagenc='e1 e2' xmlns='{2}' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault>Some Text</strDefault>" +\r
-                               "    <boolT>false</boolT>" +\r
-                               "    <boolF>true</boolF>" +\r
-                               "    <decimalval>20</decimalval>" +\r
-                               "    <flag>two</flag>" +\r
-                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,\r
-                               AnotherNamespace)), WriterText, "#C9");\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")] // SerializationCodeGenerator outputs wrong xsi:type for flagencoded in #C1\r
-               public void TestSerializeDefaultValueAttribute_Encoded ()\r
-               {\r
-                       SoapAttributeOverrides overrides = new SoapAttributeOverrides ();\r
-                       SoapAttributes attr = new SoapAttributes ();\r
-                       attr.SoapAttribute = new SoapAttributeAttribute ();\r
-                       string defaultValueInstance = "nothing";\r
-                       attr.SoapDefaultValue = defaultValueInstance;\r
-                       overrides.Add (typeof (SimpleClass), "something", attr);\r
-\r
-                       // use the default\r
-                       SimpleClass simple = new SimpleClass ();\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A1");\r
-\r
-                       // same value as default\r
-                       simple.something = defaultValueInstance;\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A2");\r
-\r
-                       // some other value\r
-                       simple.something = "hello";\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' something='hello' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A3");\r
-\r
-                       attr.SoapAttribute = null;\r
-                       attr.SoapElement = new SoapElementAttribute ();\r
-\r
-                       // use the default\r
-                       simple = new SimpleClass ();\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B1");\r
-\r
-                       // same value as default\r
-                       simple.something = defaultValueInstance;\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xsi:type='xsd:string'>nothing</something></SimpleClass>"), WriterText, "#B2");\r
-\r
-                       // some other value\r
-                       simple.something = "hello";\r
-                       SerializeEncoded (simple, overrides);\r
-                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xsi:type='xsd:string'>hello</something></SimpleClass>"), WriterText, "#B3");\r
-\r
-                       overrides = new SoapAttributeOverrides ();\r
-                       attr = new SoapAttributes ();\r
-                       attr.SoapElement = new SoapElementAttribute ("flagenc");\r
-                       overrides.Add (typeof (TestDefault), "flagencoded", attr);\r
-\r
-                       // use the default (from MS KB325691)\r
-                       TestDefault testDefault = new TestDefault ();\r
-                       SerializeEncoded (testDefault);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +\r
-                               "    <flag xsi:type='FlagEnum'>e1 e4</flag>" +\r
-                               "    <flagencoded xsi:type='flagenum'>one four</flagencoded>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C1");\r
-\r
-                       SerializeEncoded (testDefault, overrides);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +\r
-                               "    <flag xsi:type='FlagEnum'>e1 e4</flag>" +\r
-                               "    <flagenc xsi:type='flagenum'>one four</flagenc>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C2");\r
-\r
-                       SerializeEncoded (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +\r
-                               "    <flag xmlns:q2='{2}' xsi:type='q2:FlagEnum'>e1 e4</flag>" +\r
-                               "    <flagenc xmlns:q3='{2}' xsi:type='q3:flagenum'>one four</flagenc>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,\r
-                               AnotherNamespace)), WriterText, "#C3");\r
-\r
-                       // non-default values\r
-                       testDefault.strDefault = "Some Text";\r
-                       testDefault.boolT = false;\r
-                       testDefault.boolF = true;\r
-                       testDefault.decimalval = 20m;\r
-                       testDefault.flag = FlagEnum.e2;\r
-                       testDefault.flagencoded = FlagEnum_Encoded.e2 | FlagEnum_Encoded.e1;\r
-                       SerializeEncoded (testDefault);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +\r
-                               "    <flag xsi:type='FlagEnum'>e2</flag>" +\r
-                               "    <flagencoded xsi:type='flagenum'>one two</flagencoded>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C4");\r
-\r
-                       SerializeEncoded (testDefault, overrides);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +\r
-                               "    <flag xsi:type='FlagEnum'>e2</flag>" +\r
-                               "    <flagenc xsi:type='flagenum'>one two</flagenc>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),\r
-                               WriterText, "#C5");\r
-\r
-                       attr = new SoapAttributes ();\r
-                       attr.SoapType = new SoapTypeAttribute ("flagenum", "yetanother:urn");\r
-                       overrides.Add (typeof (FlagEnum_Encoded), attr);\r
-\r
-                       SerializeEncoded (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +\r
-                               "    <flag xmlns:q2='{2}' xsi:type='q2:FlagEnum'>e2</flag>" +\r
-                               "    <flagenc xmlns:q3='yetanother:urn' xsi:type='q3:flagenum'>one two</flagenc>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,\r
-                               AnotherNamespace)), WriterText, "#C6");\r
-\r
-                       attr = new SoapAttributes ();\r
-                       attr.SoapType = new SoapTypeAttribute ("testDefault");\r
-                       overrides.Add (typeof (TestDefault), attr);\r
-\r
-                       SerializeEncoded (testDefault, overrides, AnotherNamespace);\r
-                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,\r
-                               "<q1:testDefault id='id1' xmlns:q1='{2}' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +\r
-                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +\r
-                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +\r
-                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +\r
-                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +\r
-                               "    <flag xsi:type='q1:FlagEnum'>e2</flag>" +\r
-                               "    <flagenc xmlns:q2='yetanother:urn' xsi:type='q2:flagenum'>one two</flagenc>" +\r
-                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,\r
-                               AnotherNamespace)), WriterText, "#C7");\r
-               }\r
-\r
-               // test XmlEnum //////////////////////////////////////////////////////////\r
-               [Test]\r
-               public void TestSerializeXmlEnumAttribute ()\r
-               {\r
-                       Serialize (XmlSchemaForm.Qualified);\r
-                       Assert.AreEqual (Infoset ("<XmlSchemaForm>qualified</XmlSchemaForm>"), WriterText, "#1");\r
-\r
-                       Serialize (XmlSchemaForm.Unqualified);\r
-                       Assert.AreEqual (Infoset ("<XmlSchemaForm>unqualified</XmlSchemaForm>"), WriterText, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlEnumAttribute_IgnoredValue ()\r
-               {\r
-                       // technically XmlSchemaForm.None has an XmlIgnore attribute,\r
-                       // but it is not being serialized as a member.\r
-\r
-#if NET_2_0\r
-                       try {\r
-                               Serialize (XmlSchemaForm.None);\r
-                               Assert.Fail ("#1");\r
-                       } catch (InvalidOperationException ex) {\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");\r
-                               Assert.IsNotNull (ex.InnerException, "#3");\r
-                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");\r
-                               Assert.IsNotNull (ex.InnerException.Message, "#5");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'0'") != -1, "#6");\r
-                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (XmlSchemaForm).FullName) != -1, "#7");\r
-                       }\r
-#else\r
-                       Serialize (XmlSchemaForm.None);\r
-                       Assert.AreEqual (Infoset ("<XmlSchemaForm>0</XmlSchemaForm>"), WriterText);\r
-#endif\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlNodeArray ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       Serialize (new XmlNode [] { doc.CreateAttribute ("at"), doc.CreateElement ("elem1"), doc.CreateElement ("elem2") }, typeof (object));\r
-                       Assert.AreEqual (Infoset ("<anyType at=\"\"><elem1/><elem2/></anyType>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlElement ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       Serialize (doc.CreateElement ("elem"), typeof (XmlElement));\r
-                       Assert.AreEqual (Infoset ("<elem/>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlElementSubclass ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       Serialize (new MyElem (doc), typeof (XmlElement));\r
-                       Assert.AreEqual (Infoset ("<myelem aa=\"1\"/>"), WriterText, "#1");\r
-\r
-                       Serialize (new MyElem (doc), typeof (MyElem));\r
-                       Assert.AreEqual (Infoset ("<myelem aa=\"1\"/>"), WriterText, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlCDataSection ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       CDataContainer c = new CDataContainer ();\r
-                       c.cdata = doc.CreateCDataSection ("data section contents");\r
-                       Serialize (c);\r
-                       Assert.AreEqual (Infoset ("<CDataContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><cdata><![CDATA[data section contents]]></cdata></CDataContainer>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeXmlNode ()\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       NodeContainer c = new NodeContainer ();\r
-                       c.node = doc.CreateTextNode ("text");\r
-                       Serialize (c);\r
-                       Assert.AreEqual (Infoset ("<NodeContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><node>text</node></NodeContainer>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeChoice ()\r
-               {\r
-                       Choices ch = new Choices ();\r
-                       ch.MyChoice = "choice text";\r
-                       ch.ItemType = ItemChoiceType.ChoiceZero;\r
-                       Serialize (ch);\r
-                       Assert.AreEqual (Infoset ("<Choices xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ChoiceZero>choice text</ChoiceZero></Choices>"), WriterText, "#1");\r
-                       ch.ItemType = ItemChoiceType.StrangeOne;\r
-                       Serialize (ch);\r
-                       Assert.AreEqual (Infoset ("<Choices xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ChoiceOne>choice text</ChoiceOne></Choices>"), WriterText, "#2");\r
-                       ch.ItemType = ItemChoiceType.ChoiceTwo;\r
-                       Serialize (ch);\r
-                       Assert.AreEqual (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, "#3");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeNamesWithSpaces ()\r
-               {\r
-                       TestSpace ts = new TestSpace ();\r
-                       ts.elem = 4;\r
-                       ts.attr = 5;\r
-                       Serialize (ts);\r
-                       Assert.AreEqual (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);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeReadOnlyProps ()\r
-               {\r
-                       ReadOnlyProperties ts = new ReadOnlyProperties ();\r
-                       Serialize (ts);\r
-                       Assert.AreEqual (Infoset ("<ReadOnlyProperties xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeIList ()\r
-               {\r
-                       clsPerson k = new clsPerson ();\r
-                       k.EmailAccounts = new ArrayList ();\r
-                       k.EmailAccounts.Add ("a");\r
-                       k.EmailAccounts.Add ("b");\r
-                       Serialize (k);\r
-                       Assert.AreEqual (Infoset ("<clsPerson xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><EmailAccounts><anyType xsi:type=\"xsd:string\">a</anyType><anyType xsi:type=\"xsd:string\">b</anyType></EmailAccounts></clsPerson>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeArrayEnc ()\r
-               {\r
-                       SoapReflectionImporter imp = new SoapReflectionImporter ();\r
-                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (ArrayClass));\r
-                       XmlSerializer ser = new XmlSerializer (map);\r
-                       StringWriter sw = new StringWriter ();\r
-                       XmlTextWriter tw = new XmlTextWriter (sw);\r
-                       tw.WriteStartElement ("aa");\r
-                       ser.Serialize (tw, new ArrayClass ());\r
-                       tw.WriteEndElement ();\r
-               }\r
-\r
-               [Test]\r
-               public void TestIncludeType ()\r
-               {\r
-                       // Test for bug #76049\r
-                       XmlReflectionImporter imp = new XmlReflectionImporter ();\r
-                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (object));\r
-                       imp.IncludeType (typeof (TestSpace));\r
-                       XmlSerializer ser = new XmlSerializer (map);\r
-                       ser.Serialize (new StringWriter (), new TestSpace ());\r
-               }\r
-\r
-               [Test]\r
-               public void TestSerializeChoiceArray ()\r
-               {\r
-                       CompositeValueType v = new CompositeValueType ();\r
-                       v.Init ();\r
-                       Serialize (v);\r
-                       Assert.AreEqual (Infoset ("<?xml version=\"1.0\" encoding=\"utf-16\"?><CompositeValueType xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><In>1</In><Es>2</Es></CompositeValueType>"), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestArrayAttributeWithDataType ()\r
-               {\r
-                       Serialize (new ArrayAttributeWithType ());\r
-                       string res = "<ArrayAttributeWithType xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";\r
-                       res += "at='a b' bin1='AQI= AQI=' bin2='AQI=' />";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               public void TestSubclassElementType ()\r
-               {\r
-                       SubclassTestContainer c = new SubclassTestContainer ();\r
-                       c.data = new SubclassTestSub ();\r
-                       Serialize (c);\r
-\r
-                       string res = "<SubclassTestContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";\r
-                       res += "<a xsi:type=\"SubclassTestSub\"/></SubclassTestContainer>";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-               }\r
-\r
-               [Test]\r
-               [ExpectedException (typeof (InvalidOperationException))]\r
-               public void TestArrayAttributeWithWrongDataType ()\r
-               {\r
-                       Serialize (new ArrayAttributeWithWrongType ());\r
-               }\r
-\r
-               [Test]\r
-               [Category ("NotWorking")]\r
-               public void TestSerializePrimitiveTypesContainer ()\r
-               {\r
-                       Serialize (new PrimitiveTypesContainer ());\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<PrimitiveTypesContainer xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='some:urn'>" +\r
-#else\r
-                               "<PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='some:urn'>" +\r
-#endif\r
-                               "<Number>2004</Number>" +\r
-                               "<Name>some name</Name>" +\r
-                               "<Index>56</Index>" +\r
-                               "<Password>8w8=</Password>" +\r
-                               "<PathSeparatorCharacter>47</PathSeparatorCharacter>" +\r
-                               "</PrimitiveTypesContainer>", XmlSchema.Namespace,\r
-                               XmlSchema.InstanceNamespace), sw.ToString (), "#1");\r
-\r
-                       SerializeEncoded (new PrimitiveTypesContainer ());\r
-                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,\r
-                               "<?xml version='1.0' encoding='utf-16'?>" +\r
-#if NET_2_0\r
-                               "<q1:PrimitiveTypesContainer xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' xmlns:q1='{2}'>" +\r
-#else\r
-                               "<q1:PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' xmlns:q1='{2}'>" +\r
-#endif\r
-                               "<Number xsi:type='xsd:int'>2004</Number>" +\r
-                               "<Name xsi:type='xsd:string'>some name</Name>" +\r
-                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +\r
-                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +\r
-                               "<PathSeparatorCharacter xmlns:q2='{3}' xsi:type='q2:char'>47</PathSeparatorCharacter>" +\r
-                               "</q1:PrimitiveTypesContainer>", XmlSchema.Namespace,\r
-                               XmlSchema.InstanceNamespace, AnotherNamespace, WsdlTypesNamespace),\r
-                               sw.ToString (), "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TestSchemaForm ()\r
-               {\r
-                       TestSchemaForm1 t1 = new TestSchemaForm1 ();\r
-                       t1.p1 = new PrintTypeResponse ();\r
-                       t1.p1.Init ();\r
-                       t1.p2 = new PrintTypeResponse ();\r
-                       t1.p2.Init ();\r
-\r
-                       TestSchemaForm2 t2 = new TestSchemaForm2 ();\r
-                       t2.p1 = new PrintTypeResponse ();\r
-                       t2.p1.Init ();\r
-                       t2.p2 = new PrintTypeResponse ();\r
-                       t2.p2.Init ();\r
-\r
-                       Serialize (t1);\r
-                       string res = "";\r
-                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";\r
-                       res += "<TestSchemaForm1 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";\r
-                       res += "  <p1>";\r
-                       res += "    <result>";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p1>";\r
-                       res += "  <p2 xmlns=\"urn:oo\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p2>";\r
-                       res += "</TestSchemaForm1>";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-\r
-                       Serialize (t2);\r
-                       res = "";\r
-                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";\r
-                       res += "<TestSchemaForm2 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";\r
-                       res += "  <p1 xmlns=\"urn:testForm\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p1>";\r
-                       res += "  <p2 xmlns=\"urn:oo\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p2>";\r
-                       res += "</TestSchemaForm2>";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-\r
-                       XmlReflectionImporter imp = new XmlReflectionImporter ();\r
-                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (TestSchemaForm1), "urn:extra");\r
-                       Serialize (t1, map);\r
-                       res = "";\r
-                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";\r
-                       res += "<TestSchemaForm1 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:extra\">";\r
-                       res += "  <p1>";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p1>";\r
-                       res += "  <p2 xmlns=\"urn:oo\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p2>";\r
-                       res += "</TestSchemaForm1>";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-\r
-                       imp = new XmlReflectionImporter ();\r
-                       map = imp.ImportTypeMapping (typeof (TestSchemaForm2), "urn:extra");\r
-                       Serialize (t2, map);\r
-                       res = "";\r
-                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";\r
-                       res += "<TestSchemaForm2 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:extra\">";\r
-                       res += "  <p1 xmlns=\"urn:testForm\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p1>";\r
-                       res += "  <p2 xmlns=\"urn:oo\">";\r
-                       res += "    <result xmlns=\"\">";\r
-                       res += "      <data>data1</data>";\r
-                       res += "    </result>";\r
-                       res += "    <intern xmlns=\"urn:responseTypes\">";\r
-                       res += "      <result xmlns=\"\">";\r
-                       res += "        <data>data2</data>";\r
-                       res += "      </result>";\r
-                       res += "    </intern>";\r
-                       res += "  </p2>";\r
-                       res += "</TestSchemaForm2>";\r
-                       Assert.AreEqual (Infoset (res), WriterText);\r
-               }\r
-\r
-               // bug #78536\r
-               [Test]\r
-               public void CDataTextNodes ()\r
-               {\r
-                       XmlSerializer ser = new XmlSerializer (typeof (CDataTextNodesType));\r
-                       ser.UnknownNode += new XmlNodeEventHandler (CDataTextNodes_BadNode);\r
-                       string xml = @"<CDataTextNodesType>\r
-  <foo><![CDATA[\r
-(?<filename>^([A-Z]:)?[^\(]+)\((?<line>\d+),(?<column>\d+)\):\r
-\s((?<warning>warning)|(?<error>error))\s[^:]+:(?<message>.+$)|\r
-(?<error>(fatal\s)?error)[^:]+:(?<message>.+$)\r
-       ]]></foo>\r
-</CDataTextNodesType>";\r
-                       ser.Deserialize (new XmlTextReader (xml, XmlNodeType.Document, null));\r
-               }\r
-\r
-               public class CDataTextNodesType\r
-               {\r
-                       public CDataTextNodesInternal foo;\r
-               }\r
-\r
-               public class CDataTextNodesInternal\r
-               {\r
-                       [XmlText]\r
-                       public string Value;\r
-               }\r
-\r
-               void CDataTextNodes_BadNode (object s, XmlNodeEventArgs e)\r
-               {\r
-                       Assert.Fail ();\r
-               }\r
-\r
-               // Helper methods\r
-\r
-               public static string Infoset (string sx)\r
-               {\r
-                       XmlDocument doc = new XmlDocument ();\r
-                       doc.LoadXml (sx);\r
-                       StringBuilder sb = new StringBuilder ();\r
-                       GetInfoset (doc.DocumentElement, sb);\r
-                       return sb.ToString ();\r
-               }\r
-\r
-               public static string Infoset (XmlNode nod)\r
-               {\r
-                       StringBuilder sb = new StringBuilder ();\r
-                       GetInfoset (nod, sb);\r
-                       return sb.ToString ();\r
-               }\r
-\r
-               static void GetInfoset (XmlNode nod, StringBuilder sb)\r
-               {\r
-                       switch (nod.NodeType) {\r
-                       case XmlNodeType.Attribute:\r
-                               if (nod.LocalName == "xmlns" && nod.NamespaceURI == "http://www.w3.org/2000/xmlns/") return;\r
-                               sb.Append (" " + nod.NamespaceURI + ":" + nod.LocalName + "='" + nod.Value + "'");\r
-                               break;\r
-\r
-                       case XmlNodeType.Element:\r
-                               XmlElement elem = (XmlElement) nod;\r
-                               sb.Append ("<" + elem.NamespaceURI + ":" + elem.LocalName);\r
-\r
-                               ArrayList ats = new ArrayList ();\r
-                               foreach (XmlAttribute at in elem.Attributes)\r
-                                       ats.Add (at.LocalName + " " + at.NamespaceURI);\r
-\r
-                               ats.Sort ();\r
-\r
-                               foreach (string name in ats) {\r
-                                       string [] nn = name.Split (' ');\r
-                                       GetInfoset (elem.Attributes [nn [0], nn [1]], sb);\r
-                               }\r
-\r
-                               sb.Append (">");\r
-                               foreach (XmlNode cn in elem.ChildNodes)\r
-                                       GetInfoset (cn, sb);\r
-                               sb.Append ("</>");\r
-                               break;\r
-\r
-                       default:\r
-                               sb.Append (nod.OuterXml);\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               static XmlTypeMapping CreateSoapMapping (Type type)\r
-               {\r
-                       SoapReflectionImporter importer = new SoapReflectionImporter ();\r
-                       return importer.ImportTypeMapping (type);\r
-               }\r
-\r
-               static XmlTypeMapping CreateSoapMapping (Type type, SoapAttributeOverrides ao)\r
-               {\r
-                       SoapReflectionImporter importer = new SoapReflectionImporter (ao);\r
-                       return importer.ImportTypeMapping (type);\r
-               }\r
-\r
-               static XmlTypeMapping CreateSoapMapping (Type type, SoapAttributeOverrides ao, string defaultNamespace)\r
-               {\r
-                       SoapReflectionImporter importer = new SoapReflectionImporter (ao, defaultNamespace);\r
-                       return importer.ImportTypeMapping (type);\r
-               }\r
-       }\r
-}\r
+//
+// System.Xml.XmlSerializerTests
+//
+// Author:
+//   Erik LeBel <eriklebel@yahoo.ca>
+//
+// (C) 2003 Erik LeBel
+//
+//
+// NOTES:
+//  Where possible, these tests avoid testing the order of
+//  an object's members serialization. Mono and .NET do not
+//  reflect members in the same order.
+//
+//  Only serializations tests so far, no deserialization.
+//
+// FIXME
+//  test XmlArrayAttribute
+//  test XmlArrayItemAttribute
+//  test serialization of decimal type
+//  test serialization of Guid type
+//  test XmlNode serialization with and without modifying attributes.
+//  test deserialization
+//  FIXMEs found in this file
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+using MonoTests.System.Xml.TestClasses;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlSerializerTests
+       {
+               const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";
+               const string WsdlTypesNamespace = "http://microsoft.com/wsdl/types/";
+               const string ANamespace = "some:urn";
+               const string AnotherNamespace = "another:urn";
+
+               StringWriter sw;
+               XmlTextWriter xtw;
+               XmlSerializer xs;
+
+               private void SetUpWriter ()
+               {
+                       sw = new StringWriter ();
+                       xtw = new XmlTextWriter (sw);
+                       xtw.QuoteChar = '\'';
+                       xtw.Formatting = Formatting.None;
+               }
+
+               private string WriterText {
+                       get {
+                               string val = sw.GetStringBuilder ().ToString ();
+                               int offset = val.IndexOf ('>') + 1;
+                               val = val.Substring (offset);
+                               return Infoset (val);
+                       }
+               }
+
+               private void Serialize (object o)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType ());
+                       xs.Serialize (xtw, o);
+               }
+
+               private void Serialize (object o, Type type)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (type);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void Serialize (object o, XmlSerializerNamespaces ns)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType ());
+                       xs.Serialize (xtw, o, ns);
+               }
+
+               private void Serialize (object o, XmlAttributeOverrides ao)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType (), ao);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void Serialize (object o, XmlAttributeOverrides ao, string defaultNamespace)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType (), ao, Type.EmptyTypes,
+                               (XmlRootAttribute) null, defaultNamespace);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void Serialize (object o, XmlRootAttribute root)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (o.GetType (), root);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void Serialize (object o, XmlTypeMapping typeMapping)
+               {
+                       SetUpWriter ();
+                       xs = new XmlSerializer (typeMapping);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void SerializeEncoded (object o)
+               {
+                       SerializeEncoded (o, o.GetType ());
+               }
+
+               private void SerializeEncoded (object o, SoapAttributeOverrides ao)
+               {
+                       XmlTypeMapping mapping = CreateSoapMapping (o.GetType (), ao);
+                       SetUpWriter ();
+                       xs = new XmlSerializer (mapping);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void SerializeEncoded (object o, SoapAttributeOverrides ao, string defaultNamespace)
+               {
+                       XmlTypeMapping mapping = CreateSoapMapping (o.GetType (), ao, defaultNamespace);
+                       SetUpWriter ();
+                       xs = new XmlSerializer (mapping);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void SerializeEncoded (object o, Type type)
+               {
+                       XmlTypeMapping mapping = CreateSoapMapping (type);
+                       SetUpWriter ();
+                       xs = new XmlSerializer (mapping);
+                       xs.Serialize (xtw, o);
+               }
+
+               private void SerializeEncoded (XmlTextWriter xtw, object o, Type type)
+               {
+                       XmlTypeMapping mapping = CreateSoapMapping (type);
+                       xs = new XmlSerializer (mapping);
+                       xs.Serialize (xtw, o);
+               }
+
+               // test constructors
+#if USE_VERSION_1_1    // It doesn't pass on MS.NET 1.1.
+               [Test]
+               public void TestConstructor()
+               {
+                       XmlSerializer ser = new XmlSerializer (null, "");
+               }
+#else
+#endif
+
+               // test basic types ////////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeInt ()
+               {
+                       Serialize (10);
+                       Assert.AreEqual (Infoset ("<int>10</int>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeBool ()
+               {
+                       Serialize (true);
+                       Assert.AreEqual (Infoset ("<boolean>true</boolean>"), WriterText);
+
+                       Serialize (false);
+                       Assert.AreEqual (Infoset ("<boolean>false</boolean>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeString ()
+               {
+                       Serialize ("hello");
+                       Assert.AreEqual (Infoset ("<string>hello</string>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeEmptyString ()
+               {
+                       Serialize (String.Empty);
+                       Assert.AreEqual (Infoset ("<string />"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeNullObject ()
+               {
+                       Serialize (null, typeof (object));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<anyType xmlns:xsd='{0}' xmlns:xsi='{1}' xsi:nil='true' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);
+               }
+
+               [Test]
+               [Ignore ("The generated XML is not exact but it is equivalent")]
+               public void TestSerializeNullString ()
+               {
+                       Serialize (null, typeof (string));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<string xmlns:xsd='{0}' xmlns:xsi='{1}' xsi:nil='true' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeIntArray ()
+               {
+                       Serialize (new int [] { 1, 2, 3, 4 });
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<ArrayOfInt xmlns:xsd='{0}' xmlns:xsi='{1}'><int>1</int><int>2</int><int>3</int><int>4</int></ArrayOfInt>",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeEmptyArray ()
+               {
+                       Serialize (new int [] { });
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<ArrayOfInt xmlns:xsd='{0}' xmlns:xsi='{1}' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeChar ()
+               {
+                       Serialize ('A');
+                       Assert.AreEqual (Infoset ("<char>65</char>"), WriterText);
+
+                       Serialize ('\0');
+                       Assert.AreEqual (Infoset ("<char>0</char>"), WriterText);
+
+                       Serialize ('\n');
+                       Assert.AreEqual (Infoset ("<char>10</char>"), WriterText);
+
+                       Serialize ('\uFF01');
+                       Assert.AreEqual (Infoset ("<char>65281</char>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeFloat ()
+               {
+                       Serialize (10.78);
+                       Assert.AreEqual (Infoset ("<double>10.78</double>"), WriterText);
+
+                       Serialize (-1e8);
+                       Assert.AreEqual (Infoset ("<double>-100000000</double>"), WriterText);
+
+                       // FIXME test INF and other boundary conditions that may exist with floats
+               }
+
+               [Test]
+               public void TestSerializeEnumeration_FromValue ()
+               {
+                       Serialize ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));
+                       Assert.AreEqual (
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<SimpleEnumeration>SECOND</SimpleEnumeration>",
+                               sw.ToString ());
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestSerializeEnumeration_FromValue_Encoded ()
+               {
+                       SerializeEncoded ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>SECOND</SimpleEnumeration>",
+                               XmlSchema.InstanceNamespace), sw.ToString ());
+               }
+
+               [Test]
+               public void TestSerializeEnumeration ()
+               {
+                       Serialize (SimpleEnumeration.FIRST);
+                       Assert.AreEqual (Infoset ("<SimpleEnumeration>FIRST</SimpleEnumeration>"), WriterText, "#1");
+
+                       Serialize (SimpleEnumeration.SECOND);
+                       Assert.AreEqual (Infoset ("<SimpleEnumeration>SECOND</SimpleEnumeration>"), WriterText, "#2");
+               }
+
+               [Test]
+               public void TestSerializeEnumeration_Encoded ()
+               {
+                       SerializeEncoded (SimpleEnumeration.FIRST);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>FIRST</SimpleEnumeration>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#B1");
+
+                       SerializeEncoded (SimpleEnumeration.SECOND);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>SECOND</SimpleEnumeration>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#B2");
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValue ()
+               {
+                       Serialize (new EnumDefaultValue ());
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue />"), WriterText, "#1");
+
+                       Serialize (new SimpleEnumeration ());
+                       Assert.AreEqual (Infoset ("<SimpleEnumeration>FIRST</SimpleEnumeration>"), WriterText, "#2");
+
+                       Serialize (3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#3");
+
+                       Serialize (EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#4");
+
+                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e2, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#5");
+
+                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#6");
+
+                       Serialize (EnumDefaultValue.e1 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#7");
+
+                       Serialize (EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>e3</EnumDefaultValue>"), WriterText, "#8");
+
+                       Serialize (3, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>one two</FlagEnum>"), WriterText, "#9");
+
+                       Serialize (5, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>one four</FlagEnum>"), WriterText, "#10");
+
+                       Serialize (FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>four</FlagEnum>"), WriterText, "#11");
+
+                       Serialize (FlagEnum.e1 | FlagEnum.e2, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>one two</FlagEnum>"), WriterText, "#12");
+
+                       Serialize (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>one two four</FlagEnum>"), WriterText, "#13");
+
+                       Serialize (FlagEnum.e1 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>one four</FlagEnum>"), WriterText, "#14");
+
+                       Serialize (FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (Infoset ("<FlagEnum>two four</FlagEnum>"), WriterText, "#15");
+
+                       Serialize (3, typeof (EnumDefaultValueNF));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>e3</EnumDefaultValueNF>"), WriterText, "#16");
+
+                       Serialize (EnumDefaultValueNF.e2, typeof (EnumDefaultValueNF));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>e2</EnumDefaultValueNF>"), WriterText, "#17");
+
+                       Serialize (2, typeof (ZeroFlagEnum));
+                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>tns:t&lt;w&gt;o</ZeroFlagEnum>"), WriterText, "#18");
+
+                       Serialize (new ZeroFlagEnum ()); // enum actually has a field with value 0
+                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>zero</ZeroFlagEnum>"), WriterText, "#19");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestSerializeEnumDefaultValue_Encoded ()
+               {
+                       SerializeEncoded (new EnumDefaultValue ());
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}' />",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#1");
+
+                       SerializeEncoded (new SimpleEnumeration ());
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<SimpleEnumeration d1p1:type='SimpleEnumeration' xmlns:d1p1='{0}'>FIRST</SimpleEnumeration>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#2");
+
+                       SerializeEncoded (3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#3");
+
+                       SerializeEncoded (EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#4");
+
+                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e2, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#5");
+
+                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#6");
+
+                       SerializeEncoded (EnumDefaultValue.e1 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#7");
+
+                       SerializeEncoded (EnumDefaultValue.e2 | EnumDefaultValue.e3, typeof (EnumDefaultValue));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValue d1p1:type='EnumDefaultValue' xmlns:d1p1='{0}'>e3</EnumDefaultValue>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#8");
+
+                       SerializeEncoded (3, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#9");
+
+                       SerializeEncoded (5, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e4</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#10");
+
+                       SerializeEncoded (FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e4</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#11");
+
+                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e2, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#12");
+
+                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e2 e4</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#13");
+
+                       SerializeEncoded (FlagEnum.e1 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e1 e4</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#14");
+
+                       SerializeEncoded (FlagEnum.e2 | FlagEnum.e4, typeof (FlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<FlagEnum d1p1:type='FlagEnum' xmlns:d1p1='{0}'>e2 e4</FlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#15");
+
+                       SerializeEncoded (3, typeof (EnumDefaultValueNF));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValueNF d1p1:type='EnumDefaultValueNF' xmlns:d1p1='{0}'>e3</EnumDefaultValueNF>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#16");
+
+                       SerializeEncoded (EnumDefaultValueNF.e2, typeof (EnumDefaultValueNF));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<EnumDefaultValueNF d1p1:type='EnumDefaultValueNF' xmlns:d1p1='{0}'>e2</EnumDefaultValueNF>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#17");
+
+                       SerializeEncoded (2, typeof (ZeroFlagEnum));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<ZeroFlagEnum d1p1:type='ZeroFlagEnum' xmlns:d1p1='{0}'>e2</ZeroFlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#18");
+
+                       SerializeEncoded (new ZeroFlagEnum ()); // enum actually has a field with value 0
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<ZeroFlagEnum d1p1:type='ZeroFlagEnum' xmlns:d1p1='{0}'>e0</ZeroFlagEnum>",
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#19");
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValue_InvalidValue1 ()
+               {
+                       try {
+                               Serialize ("b", typeof (EnumDefaultValue));
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#A2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#A3");
+                       }
+
+                       try {
+                               Serialize ("e1", typeof (EnumDefaultValue));
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#B2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#B3");
+                       }
+
+                       try {
+                               Serialize ("e1,e2", typeof (EnumDefaultValue));
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#C2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#C3");
+                       }
+
+                       try {
+                               Serialize (string.Empty, typeof (EnumDefaultValue));
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#D2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#D3");
+                       }
+
+                       try {
+                               Serialize ("1", typeof (EnumDefaultValue));
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#E2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#E3");
+                       }
+
+                       try {
+                               Serialize ("0", typeof (EnumDefaultValue));
+                               Assert.Fail ("#F1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#F2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#F3");
+                       }
+
+                       try {
+                               Serialize (new SimpleClass (), typeof (EnumDefaultValue));
+                               Assert.Fail ("#G1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#G2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#G3");
+                       }
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValue_InvalidValue2 ()
+               {
+#if NET_2_0
+                       try {
+                               Serialize (5, typeof (EnumDefaultValue));
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                               Assert.IsNotNull (ex.InnerException, "#3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'5'") != -1, "#6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValue).FullName) != -1, "#7");
+                       }
+#else
+                       Serialize (5, typeof (EnumDefaultValue));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValue>5</EnumDefaultValue>"), WriterText);
+#endif
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValueNF_InvalidValue1 ()
+               {
+#if NET_2_0
+                       try {
+                               Serialize (new EnumDefaultValueNF ());
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                               Assert.IsNotNull (ex.InnerException, "#3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'0'") != -1, "#6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#7");
+                       }
+#else
+                       Serialize (new EnumDefaultValueNF ());
+                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>0</EnumDefaultValueNF>"), WriterText);
+#endif
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValueNF_InvalidValue2 ()
+               {
+#if NET_2_0
+                       try {
+                               Serialize (15, typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                               Assert.IsNotNull (ex.InnerException, "#3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'15'") != -1, "#6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (EnumDefaultValueNF).FullName) != -1, "#7");
+                       }
+#else
+                       Serialize (15, typeof (EnumDefaultValueNF));
+                       Assert.AreEqual (Infoset ("<EnumDefaultValueNF>15</EnumDefaultValueNF>"), WriterText);
+#endif
+               }
+
+               [Test]
+               public void TestSerializeEnumDefaultValueNF_InvalidValue3 ()
+               {
+                       try {
+                               Serialize ("b", typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#A2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#A3");
+                       }
+
+                       try {
+                               Serialize ("e2", typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#B1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#B2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#B3");
+                       }
+
+                       try {
+                               Serialize (string.Empty, typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#C1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#C2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#C3");
+                       }
+
+                       try {
+                               Serialize ("1", typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#D2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#D3");
+                       }
+
+                       try {
+                               Serialize ("0", typeof (EnumDefaultValueNF));
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.IsNotNull (ex.InnerException, "#E2");
+                               Assert.AreEqual (typeof (InvalidCastException), ex.InnerException.GetType (), "#E3");
+                       }
+               }
+
+               [Test]
+               public void TestSerializeField ()
+               {
+                       Field f = new Field ();
+                       Serialize (f, typeof (Field));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='' flag2='' flag3=''" +
+                               " flag4='' modifiers='public' modifiers2='public' modifiers4='public' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#A");
+
+                       f.Flags1 = FlagEnum.e1;
+                       f.Flags2 = FlagEnum.e1;
+                       f.Flags3 = FlagEnum.e2;
+                       f.Modifiers = MapModifiers.Protected;
+                       f.Modifiers2 = MapModifiers.Public;
+                       f.Modifiers3 = MapModifiers.Public;
+                       f.Modifiers4 = MapModifiers.Protected;
+                       f.Modifiers5 = MapModifiers.Public;
+                       Serialize (f, typeof (Field));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag3='two' flag4=''" +
+                               " modifiers='protected' modifiers2='public' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#B");
+
+                       f.Flags1 = (FlagEnum) 1;
+                       f.Flags1 = FlagEnum.e2;
+                       f.Flags2 = FlagEnum.e2;
+                       f.Flags3 = FlagEnum.e1 | FlagEnum.e2;
+                       f.Modifiers = MapModifiers.Public;
+                       f.Modifiers2 = MapModifiers.Protected;
+                       f.Modifiers3 = MapModifiers.Protected;
+                       f.Modifiers4 = MapModifiers.Public;
+                       f.Modifiers5 = MapModifiers.Protected;
+                       Serialize (f, typeof (Field));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='two' flag2='two'" +
+                               " flag4='' modifiers='public' modifiers2='protected'" +
+                               " modifiers3='protected' modifiers4='public'" +
+                               " modifiers5='protected' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#C");
+
+                       f.Flags1 = FlagEnum.e1 | FlagEnum.e2;
+                       f.Flags2 = FlagEnum.e2;
+                       f.Flags3 = FlagEnum.e4;
+                       f.Flags4 = FlagEnum.e1 | FlagEnum.e2 | FlagEnum.e4;
+                       f.Modifiers3 = MapModifiers.Public;
+                       f.Modifiers4 = MapModifiers.Protected;
+                       f.Modifiers5 = MapModifiers.Public;
+                       f.Names = new string [] { "a", "b" };
+                       Serialize (f, typeof (Field));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='one two' flag2='two'" +
+                               " flag3='four' flag4='one two four' modifiers='public'" +
+                               " modifiers2='protected' names='a b' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#D");
+
+                       f.Flags2 = (FlagEnum) 444;
+                       f.Flags3 = (FlagEnum) 555;
+                       f.Modifiers = (MapModifiers) 666;
+                       f.Modifiers2 = (MapModifiers) 777;
+                       f.Modifiers3 = (MapModifiers) 0;
+                       f.Modifiers4 = (MapModifiers) 888;
+                       f.Modifiers5 = (MapModifiers) 999;
+#if NET_2_0
+                       try {
+                               Serialize (f, typeof (Field));
+                               Assert.Fail ("#E1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
+                               Assert.IsNotNull (ex.Message, "#E3");
+                               Assert.IsNotNull (ex.InnerException, "#E4");
+
+                               // Instance validation error: '444' is not a valid value for
+                               // MonoTests.System.Xml.TestClasses.FlagEnum
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#E5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#E6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#E7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum).FullName) != -1, "#E8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#E9");
+                       }
+#else
+                       Serialize (f, typeof (Field));
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<field xmlns:xsd='{0}' xmlns:xsi='{1}' flag1='one two' flag2='444'" +
+                               " flag3='555' flag4='one two four' modifiers='666' modifiers2='777'" +
+                               " modifiers4='888' modifiers5='999' names='a b' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)), WriterText, "#E");
+#endif
+               }
+
+               [Test]
+               [Category ("NotDotNet")] // MS bug
+               public void TestSerializeField_Encoded ()
+               {
+                       Field_Encoded f = new Field_Encoded ();
+                       SerializeEncoded (f, typeof (Field_Encoded));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag1=''" +
+                               " flag2='' flag3='' flag4='' modifiers='PuBlIc'" +
+                               " modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='some:urn' />",
+#else
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1=''" +
+                               " flag2='' flag3='' flag4='' modifiers='PuBlIc'" +
+                               " modifiers2='PuBlIc' modifiers4='PuBlIc' xmlns:q1='some:urn' />",
+#endif
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),
+                               sw.GetStringBuilder ().ToString (), "#A");
+
+                       f.Flags1 = FlagEnum_Encoded.e1;
+                       f.Flags2 = FlagEnum_Encoded.e1;
+                       f.Flags3 = FlagEnum_Encoded.e2;
+                       f.Modifiers = MapModifiers.Protected;
+                       f.Modifiers2 = MapModifiers.Public;
+                       f.Modifiers3 = MapModifiers.Public;
+                       f.Modifiers4 = MapModifiers.Protected;
+                       f.Modifiers5 = MapModifiers.Public;
+                       SerializeEncoded (f, typeof (Field_Encoded));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag3='two'" +
+                               " flag4='' modifiers='Protected' modifiers2='PuBlIc'" +
+                               " xmlns:q1='some:urn' />",
+#else
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag3='two'" +
+                               " flag4='' modifiers='Protected' modifiers2='PuBlIc'" +
+                               " xmlns:q1='some:urn' />",
+#endif
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),
+                               sw.GetStringBuilder ().ToString (), "#B");
+
+                       f.Flags1 = FlagEnum_Encoded.e2;
+                       f.Flags2 = FlagEnum_Encoded.e2;
+                       f.Flags3 = FlagEnum_Encoded.e1 | FlagEnum_Encoded.e2;
+                       f.Modifiers = MapModifiers.Public;
+                       f.Modifiers2 = MapModifiers.Protected;
+                       f.Modifiers3 = MapModifiers.Protected;
+                       f.Modifiers4 = MapModifiers.Public;
+                       f.Modifiers5 = MapModifiers.Protected;
+                       SerializeEncoded (f, typeof (Field_Encoded));
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<q1:field xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' flag1='two'" +
+                               " flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected'" +
+                               " modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected'" +
+                               " xmlns:q1='some:urn' />",
+#else
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag1='two'" +
+                               " flag2='two' flag4='' modifiers='PuBlIc' modifiers2='Protected'" +
+                               " modifiers3='Protected' modifiers4='PuBlIc' modifiers5='Protected'" +
+                               " xmlns:q1='some:urn' />",
+#endif
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),
+                               sw.GetStringBuilder ().ToString (), "#C");
+
+                       f.Flags1 = (FlagEnum_Encoded) 1;
+                       f.Flags2 = (FlagEnum_Encoded) 444;
+                       f.Flags3 = (FlagEnum_Encoded) 555;
+                       f.Modifiers = (MapModifiers) 666;
+                       f.Modifiers2 = (MapModifiers) 777;
+                       f.Modifiers3 = (MapModifiers) 0;
+                       f.Modifiers4 = (MapModifiers) 888;
+                       f.Modifiers5 = (MapModifiers) 999;
+#if NET_2_0
+                       try {
+#endif
+                       SerializeEncoded (f, typeof (Field_Encoded));
+#if NET_2_0
+                               Assert.Fail ("#D1");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error generating the XML document
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNotNull (ex.Message, "#D3");
+                               Assert.IsNotNull (ex.InnerException, "#D4");
+
+                               // Instance validation error: '444' is not a valid value for
+                               // MonoTests.System.Xml.TestClasses.FlagEnum_Encoded
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#D5");
+                               Assert.IsNotNull (ex.InnerException.Message, "#D6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'444'") != -1, "#D7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (FlagEnum_Encoded).FullName) != -1, "#D8");
+                               Assert.IsNull (ex.InnerException.InnerException, "#D9");
+                       }
+#else
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+                               "<q1:field xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' flag2='444'" +
+                               " flag3='555' flag4='' modifiers='666' modifiers2='777'" +
+                               " modifiers4='888' modifiers5='999' xmlns:q1='some:urn' />",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace),
+                               sw.GetStringBuilder ().ToString (), "#D");
+#endif
+               }
+
+               [Test]
+               public void TestSerializeGroup ()
+               {
+                       Group myGroup = new Group ();
+                       myGroup.GroupName = ".NET";
+
+                       Byte [] hexByte = new Byte [] { 0x64, 0x32 };
+                       myGroup.GroupNumber = hexByte;
+
+                       DateTime myDate = new DateTime (2002, 5, 2);
+                       myGroup.Today = myDate;
+                       myGroup.PostitiveInt = "10000";
+                       myGroup.IgnoreThis = true;
+                       Car thisCar = (Car) myGroup.myCar ("1234566");
+                       myGroup.MyVehicle = thisCar;
+
+                       SetUpWriter ();
+                       xtw.WriteStartDocument (true);
+                       xtw.WriteStartElement ("Wrapper");
+                       SerializeEncoded (xtw, myGroup, typeof (Group));
+                       xtw.WriteEndElement ();
+                       xtw.Close ();
+
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns:d2p1='http://www.cpandl.com' CreationDate='2002-05-02' d2p1:GroupName='.NET' GroupNumber='ZDI=' id='id1'>" +
+                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +
+                               "<Grouptype xsi:type='GroupType'>Small</Grouptype>" +
+                               "<MyVehicle href='#id2' />" +
+                               "</Group>" +
+                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +
+                               "<licenseNumber xmlns:q1='{0}' d2p1:type='q1:string'>1234566</licenseNumber>" +
+                               "<makeDate xmlns:q2='{0}' d2p1:type='q2:date'>0001-01-01</makeDate>" +
+                               "</Car>" +
+                               "</Wrapper>",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#1");
+
+                       myGroup.GroupName = null;
+                       myGroup.Grouptype = GroupType.B;
+                       myGroup.MyVehicle.licenseNumber = null;
+                       myGroup.MyVehicle.weight = "450";
+
+                       SetUpWriter ();
+                       xtw.WriteStartDocument (true);
+                       xtw.WriteStartElement ("Wrapper");
+                       SerializeEncoded (xtw, myGroup, typeof (Group));
+                       xtw.WriteEndElement ();
+                       xtw.Close ();
+
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<Wrapper>" +
+                               "<Group xmlns:xsd='{0}' xmlns:xsi='{1}' CreationDate='2002-05-02' GroupNumber='ZDI=' id='id1'>" +
+                               "<PosInt xsi:type='xsd:nonNegativeInteger'>10000</PosInt>" +
+                               "<Grouptype xsi:type='GroupType'>Large</Grouptype>" +
+                               "<MyVehicle href='#id2' />" +
+                               "</Group>" +
+                               "<Car xmlns:d2p1='{1}' id='id2' d2p1:type='Car'>" +
+                               "<makeDate xmlns:q1='{0}' d2p1:type='q1:date'>0001-01-01</makeDate>" +
+                               "<weight xmlns:q2='{0}' d2p1:type='q2:string'>450</weight>" +
+                               "</Car>" +
+                               "</Wrapper>",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#2");
+               }
+
+               [Test]
+               public void TestSerializeZeroFlagEnum_InvalidValue ()
+               {
+#if NET_2_0
+                       try {
+                               Serialize (4, typeof (ZeroFlagEnum)); // corresponding enum field is marked XmlIgnore
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                               Assert.IsNotNull (ex.InnerException, "#3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'4'") != -1, "#6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (ZeroFlagEnum).FullName) != -1, "#7");
+                       }
+#else
+                       Serialize (4, typeof (ZeroFlagEnum)); // corresponding enum field is marked XmlIgnore
+                       Assert.AreEqual (Infoset ("<ZeroFlagEnum>4</ZeroFlagEnum>"), WriterText);
+#endif
+               }
+
+               [Test]
+               public void TestSerializeQualifiedName ()
+               {
+                       Serialize (new XmlQualifiedName ("me", "home.urn"));
+                       Assert.AreEqual (Infoset ("<QName xmlns:q1='home.urn'>q1:me</QName>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeBytes ()
+               {
+                       Serialize ((byte) 0xAB);
+                       Assert.AreEqual (Infoset ("<unsignedByte>171</unsignedByte>"), WriterText);
+
+                       Serialize ((byte) 15);
+                       Assert.AreEqual (Infoset ("<unsignedByte>15</unsignedByte>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeByteArrays ()
+               {
+                       Serialize (new byte [] { });
+                       Assert.AreEqual (Infoset ("<base64Binary />"), WriterText);
+
+                       Serialize (new byte [] { 0xAB, 0xCD });
+                       Assert.AreEqual (Infoset ("<base64Binary>q80=</base64Binary>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeDateTime ()
+               {
+                       DateTime d = new DateTime ();
+                       Serialize (d);
+
+                       TimeZone tz = TimeZone.CurrentTimeZone;
+                       TimeSpan off = tz.GetUtcOffset (d);
+                       string sp = string.Format ("{0}{1:00}:{2:00}", off.Ticks >= 0 ? "+" : "", off.Hours, off.Minutes);
+                       Assert.AreEqual (Infoset ("<dateTime>0001-01-01T00:00:00.0000000" + sp + "</dateTime>"), WriterText);
+               }
+
+               /*
+               FIXME
+                - decimal
+                - Guid
+                - XmlNode objects
+               
+               [Test]
+               public void TestSerialize()
+               {
+                       Serialize();
+                       Assert.AreEqual (WriterText, "");
+               }
+               */
+
+               // test basic class serialization /////////////////////////////////////         
+               [Test]
+               public void TestSerializeSimpleClass ()
+               {
+                       SimpleClass simple = new SimpleClass ();
+                       Serialize (simple);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       simple.something = "hello";
+
+                       Serialize (simple);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeStringCollection ()
+               {
+                       StringCollection strings = new StringCollection ();
+                       Serialize (strings);
+                       Assert.AreEqual (Infoset ("<ArrayOfString xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       strings.Add ("hello");
+                       strings.Add ("goodbye");
+                       Serialize (strings);
+                       Assert.AreEqual (Infoset ("<ArrayOfString xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><string>hello</string><string>goodbye</string></ArrayOfString>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeOptionalValueTypeContainer ()
+               {
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes attr;
+                       OptionalValueTypeContainer optionalValue = new OptionalValueTypeContainer ();
+
+                       Serialize (optionalValue);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}' />",
+#else
+                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}' />",
+#endif
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace, AnotherNamespace),
+                               sw.ToString (), "#1");
+
+                       attr = new XmlAttributes ();
+
+                       // remove the DefaultValue attribute on the Flags member
+                       overrides.Add (typeof (OptionalValueTypeContainer), "Flags", attr);
+                       // remove the DefaultValue attribute on the Attributes member
+                       overrides.Add (typeof (OptionalValueTypeContainer), "Attributes", attr);
+
+                       Serialize (optionalValue, overrides);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}'>" +
+#else
+                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +
+#endif
+                               "<Attributes xmlns='{3}'>one four</Attributes>" +
+                               "</optionalValue>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,
+                               AnotherNamespace, ANamespace), sw.ToString (), "#2");
+
+                       optionalValue.FlagsSpecified = true;
+                       Serialize (optionalValue, overrides);
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<optionalValue xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='{2}'>" +
+#else
+                               "<optionalValue xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='{2}'>" +
+#endif
+                               "<Attributes xmlns='{3}'>one four</Attributes>" +
+                               "<Flags xmlns='{3}'>one</Flags>" +
+                               "</optionalValue>",
+                               XmlSchema.Namespace, XmlSchema.InstanceNamespace, AnotherNamespace,
+                               ANamespace), sw.ToString (), "#3");
+               }
+
+               [Test]
+               public void TestSerializePlainContainer ()
+               {
+                       StringCollectionContainer container = new StringCollectionContainer ();
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages /></StringCollectionContainer>"), WriterText);
+
+                       container.Messages.Add ("hello");
+                       container.Messages.Add ("goodbye");
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages><string>hello</string><string>goodbye</string></Messages></StringCollectionContainer>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeArrayContainer ()
+               {
+                       ArrayContainer container = new ArrayContainer ();
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       container.items = new object [] { 10, 20 };
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><anyType xsi:type='xsd:int'>10</anyType><anyType xsi:type='xsd:int'>20</anyType></items></ArrayContainer>"), WriterText);
+
+                       container.items = new object [] { 10, "hello" };
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<ArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><anyType xsi:type='xsd:int'>10</anyType><anyType xsi:type='xsd:string'>hello</anyType></items></ArrayContainer>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeClassArrayContainer ()
+               {
+                       ClassArrayContainer container = new ClassArrayContainer ();
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<ClassArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       SimpleClass simple1 = new SimpleClass ();
+                       simple1.something = "hello";
+                       SimpleClass simple2 = new SimpleClass ();
+                       simple2.something = "hello";
+                       container.items = new SimpleClass [2];
+                       container.items [0] = simple1;
+                       container.items [1] = simple2;
+                       Serialize (container);
+                       Assert.AreEqual (Infoset ("<ClassArrayContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><SimpleClass><something>hello</something></SimpleClass><SimpleClass><something>hello</something></SimpleClass></items></ClassArrayContainer>"), WriterText);
+               }
+
+               // test basic attributes ///////////////////////////////////////////////
+               [Test]
+               public void TestSerializeSimpleClassWithXmlAttributes ()
+               {
+                       SimpleClassWithXmlAttributes simple = new SimpleClassWithXmlAttributes ();
+                       Serialize (simple);
+                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       simple.something = "hello";
+                       Serialize (simple);
+                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' member='hello' />"), WriterText);
+               }
+
+               // test overrides ///////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeSimpleClassWithOverrides ()
+               {
+                       // Also tests XmlIgnore
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+
+                       XmlAttributes attr = new XmlAttributes ();
+                       attr.XmlIgnore = true;
+                       overrides.Add (typeof (SimpleClassWithXmlAttributes), "something", attr);
+
+                       SimpleClassWithXmlAttributes simple = new SimpleClassWithXmlAttributes ();
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeSchema ()
+               {
+                       XmlSchema schema = new XmlSchema ();
+                       schema.Items.Add (new XmlSchemaAttribute ());
+                       schema.Items.Add (new XmlSchemaAttributeGroup ());
+                       schema.Items.Add (new XmlSchemaComplexType ());
+                       schema.Items.Add (new XmlSchemaNotation ());
+                       schema.Items.Add (new XmlSchemaSimpleType ());
+                       schema.Items.Add (new XmlSchemaGroup ());
+                       schema.Items.Add (new XmlSchemaElement ());
+
+                       StringWriter sw = new StringWriter ();
+                       XmlTextWriter xtw = new XmlTextWriter (sw);
+                       xtw.QuoteChar = '\'';
+                       xtw.Formatting = Formatting.Indented;
+                       XmlSerializer xs = new XmlSerializer (schema.GetType ());
+                       xs.Serialize (xtw, schema);
+
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>{0}" +
+                               "<xsd:schema xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>{0}" +
+                               "  <xsd:attribute />{0}" +
+                               "  <xsd:attributeGroup />{0}" +
+                               "  <xsd:complexType />{0}" +
+                               "  <xsd:notation />{0}" +
+                               "  <xsd:simpleType />{0}" +
+                               "  <xsd:group />{0}" +
+                               "  <xsd:element />{0}" +
+                               "</xsd:schema>", Environment.NewLine), sw.ToString ());
+               }
+
+               // test xmlText //////////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeXmlTextAttribute ()
+               {
+                       SimpleClass simple = new SimpleClass ();
+                       simple.something = "hello";
+
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes attr = new XmlAttributes ();
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       attr.XmlText = new XmlTextAttribute ();
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>hello</SimpleClass>"), WriterText, "#1");
+
+                       attr.XmlText = new XmlTextAttribute (typeof (string));
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>hello</SimpleClass>"), WriterText, "#2");
+
+                       try {
+                               attr.XmlText = new XmlTextAttribute (typeof (byte []));
+                               Serialize (simple, overrides);
+                               Assert.Fail ("#A1: XmlText.Type does not match the type it serializes: this should have failed");
+                       } catch (InvalidOperationException ex) {
+                               // there was an error reflecting type 'MonoTests.System.Xml.TestClasses.SimpleClass'
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
+                               Assert.IsNotNull (ex.Message, "#A3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (SimpleClass).FullName) != -1, "#A4");
+                               Assert.IsNotNull (ex.InnerException, "#A5");
+
+                               // there was an error reflecting field 'something'.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#A6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#A7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("something") != -1, "#A8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#A9");
+
+                               // the type for XmlText may not be specified for primitive types.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#A10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#A11");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException, "#A12");
+                       }
+
+                       try {
+                               attr.XmlText = new XmlTextAttribute ();
+                               attr.XmlText.DataType = "sometype";
+                               Serialize (simple, overrides);
+                               Assert.Fail ("#B1: XmlText.DataType does not match the type it serializes: this should have failed");
+                       } catch (InvalidOperationException ex) {
+                               // There was an error reflecting type 'MonoTests.System.Xml.TestClasses.SimpleClass'.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (SimpleClass).FullName) != -1, "#B4");
+                               Assert.IsNotNull (ex.InnerException, "#B5");
+
+                               // There was an error reflecting field 'something'.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#B6");
+                               Assert.IsNotNull (ex.InnerException.Message, "#B7");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("something") != -1, "#B8");
+                               Assert.IsNotNull (ex.InnerException.InnerException, "#B9");
+
+                               //FIXME
+                               /*
+                               // There was an error reflecting type 'System.String'.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.GetType (), "#B10");
+                               Assert.IsNotNull (ex.InnerException.InnerException.Message, "#B11");
+                               Assert.IsTrue (ex.InnerException.InnerException.Message.IndexOf (typeof (string).FullName) != -1, "#B12");
+                               Assert.IsNotNull (ex.InnerException.InnerException.InnerException, "#B13");
+
+                               // Value 'sometype' cannot be used for the XmlElementAttribute.DataType property. 
+                               // The datatype 'http://www.w3.org/2001/XMLSchema:sometype' is missing.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.InnerException.InnerException.GetType (), "#B14");
+                               Assert.IsNotNull (ex.InnerException.InnerException.InnerException.Message, "#B15");
+                               Assert.IsTrue (ex.InnerException.InnerException.InnerException.Message.IndexOf ("http://www.w3.org/2001/XMLSchema:sometype") != -1, "#B16");
+                               Assert.IsNull (ex.InnerException.InnerException.InnerException.InnerException, "#B17");
+                               */
+                       }
+               }
+
+               // test xmlRoot //////////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeXmlRootAttribute ()
+               {
+                       // constructor override & element name
+                       XmlRootAttribute root = new XmlRootAttribute ();
+                       root.ElementName = "renamed";
+
+                       SimpleClassWithXmlAttributes simpleWithAttributes = new SimpleClassWithXmlAttributes ();
+                       Serialize (simpleWithAttributes, root);
+                       Assert.AreEqual (Infoset ("<renamed xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+
+                       SimpleClass simple = null;
+                       root.IsNullable = false;
+                       try {
+                               Serialize (simple, root);
+                               Assert.Fail ("Cannot serialize null object if XmlRoot's IsNullable == false");
+                       } catch (NullReferenceException) {
+                       }
+
+                       root.IsNullable = true;
+                       try {
+                               Serialize (simple, root);
+                               Assert.Fail ("Cannot serialize null object if XmlRoot's IsNullable == true");
+                       } catch (NullReferenceException) {
+                       }
+
+                       simple = new SimpleClass ();
+                       root.ElementName = null;
+                       root.Namespace = "some.urn";
+                       Serialize (simple, root);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='some.urn' />"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeXmlRootAttributeOnMember ()
+               {
+                       // nested root
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes childAttr = new XmlAttributes ();
+                       childAttr.XmlRoot = new XmlRootAttribute ("simple");
+                       overrides.Add (typeof (SimpleClass), childAttr);
+
+                       XmlAttributes attr = new XmlAttributes ();
+                       attr.XmlRoot = new XmlRootAttribute ("simple");
+                       overrides.Add (typeof (ClassArrayContainer), attr);
+
+                       ClassArrayContainer container = new ClassArrayContainer ();
+                       container.items = new SimpleClass [1];
+                       container.items [0] = new SimpleClass ();
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<simple xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ><items><SimpleClass /></items></simple>"), WriterText);
+
+                       // FIXME test data type
+               }
+
+               // test XmlAttribute /////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeXmlAttributeAttribute ()
+               {
+                       // null
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes attr = new XmlAttributes ();
+                       attr.XmlAttribute = new XmlAttributeAttribute ();
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       SimpleClass simple = new SimpleClass (); ;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");
+
+                       // regular
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' something='hello' />"), WriterText, "#2");
+
+                       // AttributeName
+                       attr.XmlAttribute.AttributeName = "somethingelse";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' somethingelse='hello' />"), WriterText, "#3");
+
+                       // Type
+                       // FIXME this should work, shouldnt it?
+                       // attr.XmlAttribute.Type = typeof(string);
+                       // Serialize(simple, overrides);
+                       // Assert(WriterText.EndsWith(" something='hello' />"));
+
+                       // Namespace
+                       attr.XmlAttribute.Namespace = "some:urn";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' d1p1:somethingelse='hello' xmlns:d1p1='some:urn' />"), WriterText, "#4");
+
+                       // FIXME DataType
+                       // FIXME XmlSchemaForm Form
+
+                       // FIXME write XmlQualifiedName as attribute
+               }
+
+               // test XmlElement ///////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeXmlElementAttribute ()
+               {
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes attr = new XmlAttributes ();
+                       XmlElementAttribute element = new XmlElementAttribute ();
+                       attr.XmlElements.Add (element);
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       // null
+                       SimpleClass simple = new SimpleClass (); ;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");
+
+                       // not null
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText, "#2");
+
+                       //ElementName
+                       element.ElementName = "saying";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><saying>hello</saying></SimpleClass>"), WriterText, "#3");
+
+                       //IsNullable
+                       element.IsNullable = false;
+                       simple.something = null;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#4");
+
+                       element.IsNullable = true;
+                       simple.something = null;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><saying xsi:nil='true' /></SimpleClass>"), WriterText, "#5");
+
+                       //Namespace
+                       element.ElementName = null;
+                       element.IsNullable = false;
+                       element.Namespace = "some:urn";
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xmlns='some:urn'>hello</something></SimpleClass>"), WriterText, "#6");
+
+                       //FIXME DataType
+                       //FIXME Form
+                       //FIXME Type
+               }
+
+               // test XmlElementAttribute with arrays and collections //////////////////
+               [Test]
+               public void TestSerializeCollectionWithXmlElementAttribute ()
+               {
+                       // the rule is:
+                       // if no type is specified or the specified type 
+                       //    matches the contents of the collection, 
+                       //    serialize each element in an element named after the member.
+                       // if the type does not match, or matches the collection itself,
+                       //    create a base wrapping element for the member, and then
+                       //    wrap each collection item in its own wrapping element based on type.
+
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+                       XmlAttributes attr = new XmlAttributes ();
+                       XmlElementAttribute element = new XmlElementAttribute ();
+                       attr.XmlElements.Add (element);
+                       overrides.Add (typeof (StringCollectionContainer), "Messages", attr);
+
+                       // empty collection & no type info in XmlElementAttribute
+                       StringCollectionContainer container = new StringCollectionContainer ();
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#1");
+
+                       // non-empty collection & no type info in XmlElementAttribute
+                       container.Messages.Add ("hello");
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages></StringCollectionContainer>"), WriterText, "#2");
+
+                       // non-empty collection & only type info in XmlElementAttribute
+                       element.Type = typeof (StringCollection);
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages><string>hello</string></Messages></StringCollectionContainer>"), WriterText, "#3");
+
+                       // non-empty collection & only type info in XmlElementAttribute
+                       element.Type = typeof (string);
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages></StringCollectionContainer>"), WriterText, "#4");
+
+                       // two elements
+                       container.Messages.Add ("goodbye");
+                       element.Type = null;
+                       Serialize (container, overrides);
+                       Assert.AreEqual (Infoset ("<StringCollectionContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Messages>hello</Messages><Messages>goodbye</Messages></StringCollectionContainer>"), WriterText, "#5");
+               }
+
+               // test DefaultValue /////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeDefaultValueAttribute ()
+               {
+                       XmlAttributeOverrides overrides = new XmlAttributeOverrides ();
+
+                       XmlAttributes attr = new XmlAttributes ();
+                       string defaultValueInstance = "nothing";
+                       attr.XmlDefaultValue = defaultValueInstance;
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       // use the default
+                       SimpleClass simple = new SimpleClass ();
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A1");
+
+                       // same value as default
+                       simple.something = defaultValueInstance;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A2");
+
+                       // some other value
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something>hello</something></SimpleClass>"), WriterText, "#A3");
+
+                       overrides = new XmlAttributeOverrides ();
+                       attr = new XmlAttributes ();
+                       attr.XmlAttribute = new XmlAttributeAttribute ();
+                       attr.XmlDefaultValue = defaultValueInstance;
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       // use the default
+                       simple = new SimpleClass ();
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B1");
+
+                       // same value as default
+                       simple.something = defaultValueInstance;
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B2");
+
+                       // some other value
+                       simple.something = "hello";
+                       Serialize (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass something='hello' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B3");
+
+                       overrides = new XmlAttributeOverrides ();
+                       attr = new XmlAttributes ();
+                       attr.XmlAttribute = new XmlAttributeAttribute ("flagenc");
+                       overrides.Add (typeof (TestDefault), "flagencoded", attr);
+
+                       // use the default
+                       TestDefault testDefault = new TestDefault ();
+                       Serialize (testDefault);
+                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C1");
+
+                       // use the default with overrides
+                       Serialize (testDefault, overrides);
+                       Assert.AreEqual (Infoset ("<testDefault flagenc='e1 e4' xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C2");
+
+                       overrides = new XmlAttributeOverrides ();
+                       attr = new XmlAttributes ();
+                       attr.XmlAttribute = new XmlAttributeAttribute ("flagenc");
+                       attr.XmlDefaultValue = (FlagEnum_Encoded.e1 | FlagEnum_Encoded.e4); // add default again
+                       overrides.Add (typeof (TestDefault), "flagencoded", attr);
+
+                       // use the default with overrides
+                       Serialize (testDefault, overrides);
+                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C3");
+
+                       // use the default with overrides and default namspace
+                       Serialize (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset ("<testDefault xmlns='urn:myNS' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#C4");
+
+                       // non-default values
+                       testDefault.strDefault = "Some Text";
+                       testDefault.boolT = false;
+                       testDefault.boolF = true;
+                       testDefault.decimalval = 20m;
+                       testDefault.flag = FlagEnum.e2;
+                       testDefault.flagencoded = FlagEnum_Encoded.e2 | FlagEnum_Encoded.e1;
+                       Serialize (testDefault);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<testDefault xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault>Some Text</strDefault>" +
+                               "    <boolT>false</boolT>" +
+                               "    <boolF>true</boolF>" +
+                               "    <decimalval>20</decimalval>" +
+                               "    <flag>two</flag>" +
+                               "    <flagencoded>e1 e2</flagencoded>" +
+                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C5");
+
+                       Serialize (testDefault, overrides);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault>Some Text</strDefault>" +
+                               "    <boolT>false</boolT>" +
+                               "    <boolF>true</boolF>" +
+                               "    <decimalval>20</decimalval>" +
+                               "    <flag>two</flag>" +
+                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C6");
+
+                       Serialize (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault>Some Text</strDefault>" +
+                               "    <boolT>false</boolT>" +
+                               "    <boolF>true</boolF>" +
+                               "    <decimalval>20</decimalval>" +
+                               "    <flag>two</flag>" +
+                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C7");
+
+                       attr = new XmlAttributes ();
+                       XmlTypeAttribute xmlType = new XmlTypeAttribute ("flagenum");
+                       xmlType.Namespace = "yetanother:urn";
+                       attr.XmlType = xmlType;
+                       overrides.Add (typeof (FlagEnum_Encoded), attr);
+
+                       Serialize (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<testDefault flagenc='e1 e2' xmlns='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault>Some Text</strDefault>" +
+                               "    <boolT>false</boolT>" +
+                               "    <boolF>true</boolF>" +
+                               "    <decimalval>20</decimalval>" +
+                               "    <flag>two</flag>" +
+                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C8");
+
+                       attr = new XmlAttributes ();
+                       attr.XmlType = new XmlTypeAttribute ("testDefault");
+                       overrides.Add (typeof (TestDefault), attr);
+
+                       Serialize (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<testDefault flagenc='e1 e2' xmlns='{2}' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault>Some Text</strDefault>" +
+                               "    <boolT>false</boolT>" +
+                               "    <boolF>true</boolF>" +
+                               "    <decimalval>20</decimalval>" +
+                               "    <flag>two</flag>" +
+                               "</testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,
+                               AnotherNamespace)), WriterText, "#C9");
+               }
+
+               [Test]
+               [Category ("NotWorking")] // SerializationCodeGenerator outputs wrong xsi:type for flagencoded in #C1
+               public void TestSerializeDefaultValueAttribute_Encoded ()
+               {
+                       SoapAttributeOverrides overrides = new SoapAttributeOverrides ();
+                       SoapAttributes attr = new SoapAttributes ();
+                       attr.SoapAttribute = new SoapAttributeAttribute ();
+                       string defaultValueInstance = "nothing";
+                       attr.SoapDefaultValue = defaultValueInstance;
+                       overrides.Add (typeof (SimpleClass), "something", attr);
+
+                       // use the default
+                       SimpleClass simple = new SimpleClass ();
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A1");
+
+                       // same value as default
+                       simple.something = defaultValueInstance;
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A2");
+
+                       // some other value
+                       simple.something = "hello";
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' something='hello' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#A3");
+
+                       attr.SoapAttribute = null;
+                       attr.SoapElement = new SoapElementAttribute ();
+
+                       // use the default
+                       simple = new SimpleClass ();
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText, "#B1");
+
+                       // same value as default
+                       simple.something = defaultValueInstance;
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xsi:type='xsd:string'>nothing</something></SimpleClass>"), WriterText, "#B2");
+
+                       // some other value
+                       simple.something = "hello";
+                       SerializeEncoded (simple, overrides);
+                       Assert.AreEqual (Infoset ("<SimpleClass id='id1' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><something xsi:type='xsd:string'>hello</something></SimpleClass>"), WriterText, "#B3");
+
+                       overrides = new SoapAttributeOverrides ();
+                       attr = new SoapAttributes ();
+                       attr.SoapElement = new SoapElementAttribute ("flagenc");
+                       overrides.Add (typeof (TestDefault), "flagencoded", attr);
+
+                       // use the default (from MS KB325691)
+                       TestDefault testDefault = new TestDefault ();
+                       SerializeEncoded (testDefault);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +
+                               "    <flag xsi:type='FlagEnum'>e1 e4</flag>" +
+                               "    <flagencoded xsi:type='flagenum'>one four</flagencoded>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C1");
+
+                       SerializeEncoded (testDefault, overrides);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +
+                               "    <flag xsi:type='FlagEnum'>e1 e4</flag>" +
+                               "    <flagenc xsi:type='flagenum'>one four</flagenc>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C2");
+
+                       SerializeEncoded (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Default Value</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>true</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>false</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>10</decimalval>" +
+                               "    <flag xmlns:q2='{2}' xsi:type='q2:FlagEnum'>e1 e4</flag>" +
+                               "    <flagenc xmlns:q3='{2}' xsi:type='q3:flagenum'>one four</flagenc>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,
+                               AnotherNamespace)), WriterText, "#C3");
+
+                       // non-default values
+                       testDefault.strDefault = "Some Text";
+                       testDefault.boolT = false;
+                       testDefault.boolF = true;
+                       testDefault.decimalval = 20m;
+                       testDefault.flag = FlagEnum.e2;
+                       testDefault.flagencoded = FlagEnum_Encoded.e2 | FlagEnum_Encoded.e1;
+                       SerializeEncoded (testDefault);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +
+                               "    <flag xsi:type='FlagEnum'>e2</flag>" +
+                               "    <flagencoded xsi:type='flagenum'>one two</flagencoded>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C4");
+
+                       SerializeEncoded (testDefault, overrides);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +
+                               "    <flag xsi:type='FlagEnum'>e2</flag>" +
+                               "    <flagenc xsi:type='flagenum'>one two</flagenc>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace)),
+                               WriterText, "#C5");
+
+                       attr = new SoapAttributes ();
+                       attr.SoapType = new SoapTypeAttribute ("flagenum", "yetanother:urn");
+                       overrides.Add (typeof (FlagEnum_Encoded), attr);
+
+                       SerializeEncoded (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='urn:myNS' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +
+                               "    <flag xmlns:q2='{2}' xsi:type='q2:FlagEnum'>e2</flag>" +
+                               "    <flagenc xmlns:q3='yetanother:urn' xsi:type='q3:flagenum'>one two</flagenc>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,
+                               AnotherNamespace)), WriterText, "#C6");
+
+                       attr = new SoapAttributes ();
+                       attr.SoapType = new SoapTypeAttribute ("testDefault");
+                       overrides.Add (typeof (TestDefault), attr);
+
+                       SerializeEncoded (testDefault, overrides, AnotherNamespace);
+                       Assert.AreEqual (Infoset (string.Format (CultureInfo.InvariantCulture,
+                               "<q1:testDefault id='id1' xmlns:q1='{2}' xmlns:xsd='{0}' xmlns:xsi='{1}'>" +
+                               "    <strDefault xsi:type='xsd:string'>Some Text</strDefault>" +
+                               "    <boolT xsi:type='xsd:boolean'>false</boolT>" +
+                               "    <boolF xsi:type='xsd:boolean'>true</boolF>" +
+                               "    <decimalval xsi:type='xsd:decimal'>20</decimalval>" +
+                               "    <flag xsi:type='q1:FlagEnum'>e2</flag>" +
+                               "    <flagenc xmlns:q2='yetanother:urn' xsi:type='q2:flagenum'>one two</flagenc>" +
+                               "</q1:testDefault>", XmlSchema.Namespace, XmlSchema.InstanceNamespace,
+                               AnotherNamespace)), WriterText, "#C7");
+               }
+
+               // test XmlEnum //////////////////////////////////////////////////////////
+               [Test]
+               public void TestSerializeXmlEnumAttribute ()
+               {
+                       Serialize (XmlSchemaForm.Qualified);
+                       Assert.AreEqual (Infoset ("<XmlSchemaForm>qualified</XmlSchemaForm>"), WriterText, "#1");
+
+                       Serialize (XmlSchemaForm.Unqualified);
+                       Assert.AreEqual (Infoset ("<XmlSchemaForm>unqualified</XmlSchemaForm>"), WriterText, "#2");
+               }
+
+               [Test]
+               public void TestSerializeXmlEnumAttribute_IgnoredValue ()
+               {
+                       // technically XmlSchemaForm.None has an XmlIgnore attribute,
+                       // but it is not being serialized as a member.
+
+#if NET_2_0
+                       try {
+                               Serialize (XmlSchemaForm.None);
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException ex) {
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+                               Assert.IsNotNull (ex.InnerException, "#3");
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.InnerException.GetType (), "#4");
+                               Assert.IsNotNull (ex.InnerException.Message, "#5");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf ("'0'") != -1, "#6");
+                               Assert.IsTrue (ex.InnerException.Message.IndexOf (typeof (XmlSchemaForm).FullName) != -1, "#7");
+                       }
+#else
+                       Serialize (XmlSchemaForm.None);
+                       Assert.AreEqual (Infoset ("<XmlSchemaForm>0</XmlSchemaForm>"), WriterText);
+#endif
+               }
+
+               [Test]
+               public void TestSerializeXmlNodeArray ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       Serialize (new XmlNode [] { doc.CreateAttribute ("at"), doc.CreateElement ("elem1"), doc.CreateElement ("elem2") }, typeof (object));
+                       Assert.AreEqual (Infoset ("<anyType at=\"\"><elem1/><elem2/></anyType>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeXmlElement ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       Serialize (doc.CreateElement ("elem"), typeof (XmlElement));
+                       Assert.AreEqual (Infoset ("<elem/>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeXmlElementSubclass ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       Serialize (new MyElem (doc), typeof (XmlElement));
+                       Assert.AreEqual (Infoset ("<myelem aa=\"1\"/>"), WriterText, "#1");
+
+                       Serialize (new MyElem (doc), typeof (MyElem));
+                       Assert.AreEqual (Infoset ("<myelem aa=\"1\"/>"), WriterText, "#2");
+               }
+
+               [Test]
+               public void TestSerializeXmlCDataSection ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       CDataContainer c = new CDataContainer ();
+                       c.cdata = doc.CreateCDataSection ("data section contents");
+                       Serialize (c);
+                       Assert.AreEqual (Infoset ("<CDataContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><cdata><![CDATA[data section contents]]></cdata></CDataContainer>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeXmlNode ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       NodeContainer c = new NodeContainer ();
+                       c.node = doc.CreateTextNode ("text");
+                       Serialize (c);
+                       Assert.AreEqual (Infoset ("<NodeContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><node>text</node></NodeContainer>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeChoice ()
+               {
+                       Choices ch = new Choices ();
+                       ch.MyChoice = "choice text";
+                       ch.ItemType = ItemChoiceType.ChoiceZero;
+                       Serialize (ch);
+                       Assert.AreEqual (Infoset ("<Choices xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ChoiceZero>choice text</ChoiceZero></Choices>"), WriterText, "#1");
+                       ch.ItemType = ItemChoiceType.StrangeOne;
+                       Serialize (ch);
+                       Assert.AreEqual (Infoset ("<Choices xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ChoiceOne>choice text</ChoiceOne></Choices>"), WriterText, "#2");
+                       ch.ItemType = ItemChoiceType.ChoiceTwo;
+                       Serialize (ch);
+                       Assert.AreEqual (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, "#3");
+               }
+
+               [Test]
+               public void TestSerializeNamesWithSpaces ()
+               {
+                       TestSpace ts = new TestSpace ();
+                       ts.elem = 4;
+                       ts.attr = 5;
+                       Serialize (ts);
+                       Assert.AreEqual (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);
+                       Assert.AreEqual (Infoset ("<ReadOnlyProperties xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' />"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeIList ()
+               {
+                       clsPerson k = new clsPerson ();
+                       k.EmailAccounts = new ArrayList ();
+                       k.EmailAccounts.Add ("a");
+                       k.EmailAccounts.Add ("b");
+                       Serialize (k);
+                       Assert.AreEqual (Infoset ("<clsPerson xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><EmailAccounts><anyType xsi:type=\"xsd:string\">a</anyType><anyType xsi:type=\"xsd:string\">b</anyType></EmailAccounts></clsPerson>"), WriterText);
+               }
+
+               [Test]
+               public void TestSerializeArrayEnc ()
+               {
+                       SoapReflectionImporter imp = new SoapReflectionImporter ();
+                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (ArrayClass));
+                       XmlSerializer ser = new XmlSerializer (map);
+                       StringWriter sw = new StringWriter ();
+                       XmlTextWriter tw = new XmlTextWriter (sw);
+                       tw.WriteStartElement ("aa");
+                       ser.Serialize (tw, new ArrayClass ());
+                       tw.WriteEndElement ();
+               }
+
+               [Test]
+               public void TestIncludeType ()
+               {
+                       // Test for bug #76049
+                       XmlReflectionImporter imp = new XmlReflectionImporter ();
+                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (object));
+                       imp.IncludeType (typeof (TestSpace));
+                       XmlSerializer ser = new XmlSerializer (map);
+                       ser.Serialize (new StringWriter (), new TestSpace ());
+               }
+
+               [Test]
+               public void TestSerializeChoiceArray ()
+               {
+                       CompositeValueType v = new CompositeValueType ();
+                       v.Init ();
+                       Serialize (v);
+                       Assert.AreEqual (Infoset ("<?xml version=\"1.0\" encoding=\"utf-16\"?><CompositeValueType xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><In>1</In><Es>2</Es></CompositeValueType>"), WriterText);
+               }
+
+               [Test]
+               public void TestArrayAttributeWithDataType ()
+               {
+                       Serialize (new ArrayAttributeWithType ());
+                       string res = "<ArrayAttributeWithType xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
+                       res += "at='a b' bin1='AQI= AQI=' bin2='AQI=' />";
+                       Assert.AreEqual (Infoset (res), WriterText);
+               }
+
+               [Test]
+               public void TestSubclassElementType ()
+               {
+                       SubclassTestContainer c = new SubclassTestContainer ();
+                       c.data = new SubclassTestSub ();
+                       Serialize (c);
+
+                       string res = "<SubclassTestContainer xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       res += "<a xsi:type=\"SubclassTestSub\"/></SubclassTestContainer>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void TestArrayAttributeWithWrongDataType ()
+               {
+                       Serialize (new ArrayAttributeWithWrongType ());
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestSerializePrimitiveTypesContainer ()
+               {
+                       Serialize (new PrimitiveTypesContainer ());
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<PrimitiveTypesContainer xmlns:xsi='{1}' xmlns:xsd='{0}' xmlns='some:urn'>" +
+#else
+                               "<PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' xmlns='some:urn'>" +
+#endif
+                               "<Number>2004</Number>" +
+                               "<Name>some name</Name>" +
+                               "<Index>56</Index>" +
+                               "<Password>8w8=</Password>" +
+                               "<PathSeparatorCharacter>47</PathSeparatorCharacter>" +
+                               "</PrimitiveTypesContainer>", XmlSchema.Namespace,
+                               XmlSchema.InstanceNamespace), sw.ToString (), "#1");
+
+                       SerializeEncoded (new PrimitiveTypesContainer ());
+                       Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
+                               "<?xml version='1.0' encoding='utf-16'?>" +
+#if NET_2_0
+                               "<q1:PrimitiveTypesContainer xmlns:xsi='{1}' xmlns:xsd='{0}' id='id1' xmlns:q1='{2}'>" +
+#else
+                               "<q1:PrimitiveTypesContainer xmlns:xsd='{0}' xmlns:xsi='{1}' id='id1' xmlns:q1='{2}'>" +
+#endif
+                               "<Number xsi:type='xsd:int'>2004</Number>" +
+                               "<Name xsi:type='xsd:string'>some name</Name>" +
+                               "<Index xsi:type='xsd:unsignedByte'>56</Index>" +
+                               "<Password xsi:type='xsd:base64Binary'>8w8=</Password>" +
+                               "<PathSeparatorCharacter xmlns:q2='{3}' xsi:type='q2:char'>47</PathSeparatorCharacter>" +
+                               "</q1:PrimitiveTypesContainer>", XmlSchema.Namespace,
+                               XmlSchema.InstanceNamespace, AnotherNamespace, WsdlTypesNamespace),
+                               sw.ToString (), "#2");
+               }
+
+               [Test]
+               public void TestSchemaForm ()
+               {
+                       TestSchemaForm1 t1 = new TestSchemaForm1 ();
+                       t1.p1 = new PrintTypeResponse ();
+                       t1.p1.Init ();
+                       t1.p2 = new PrintTypeResponse ();
+                       t1.p2.Init ();
+
+                       TestSchemaForm2 t2 = new TestSchemaForm2 ();
+                       t2.p1 = new PrintTypeResponse ();
+                       t2.p1.Init ();
+                       t2.p2 = new PrintTypeResponse ();
+                       t2.p2.Init ();
+
+                       Serialize (t1);
+                       string res = "";
+                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
+                       res += "<TestSchemaForm1 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";
+                       res += "  <p1>";
+                       res += "    <result>";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p1>";
+                       res += "  <p2 xmlns=\"urn:oo\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p2>";
+                       res += "</TestSchemaForm1>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+
+                       Serialize (t2);
+                       res = "";
+                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
+                       res += "<TestSchemaForm2 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";
+                       res += "  <p1 xmlns=\"urn:testForm\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p1>";
+                       res += "  <p2 xmlns=\"urn:oo\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p2>";
+                       res += "</TestSchemaForm2>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+
+                       XmlReflectionImporter imp = new XmlReflectionImporter ();
+                       XmlTypeMapping map = imp.ImportTypeMapping (typeof (TestSchemaForm1), "urn:extra");
+                       Serialize (t1, map);
+                       res = "";
+                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
+                       res += "<TestSchemaForm1 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:extra\">";
+                       res += "  <p1>";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p1>";
+                       res += "  <p2 xmlns=\"urn:oo\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p2>";
+                       res += "</TestSchemaForm1>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+
+                       imp = new XmlReflectionImporter ();
+                       map = imp.ImportTypeMapping (typeof (TestSchemaForm2), "urn:extra");
+                       Serialize (t2, map);
+                       res = "";
+                       res += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
+                       res += "<TestSchemaForm2 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:extra\">";
+                       res += "  <p1 xmlns=\"urn:testForm\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p1>";
+                       res += "  <p2 xmlns=\"urn:oo\">";
+                       res += "    <result xmlns=\"\">";
+                       res += "      <data>data1</data>";
+                       res += "    </result>";
+                       res += "    <intern xmlns=\"urn:responseTypes\">";
+                       res += "      <result xmlns=\"\">";
+                       res += "        <data>data2</data>";
+                       res += "      </result>";
+                       res += "    </intern>";
+                       res += "  </p2>";
+                       res += "</TestSchemaForm2>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+               }
+
+               // bug #78536
+               [Test]
+               public void CDataTextNodes ()
+               {
+                       XmlSerializer ser = new XmlSerializer (typeof (CDataTextNodesType));
+                       ser.UnknownNode += new XmlNodeEventHandler (CDataTextNodes_BadNode);
+                       string xml = @"<CDataTextNodesType>
+  <foo><![CDATA[
+(?<filename>^([A-Z]:)?[^\(]+)\((?<line>\d+),(?<column>\d+)\):
+\s((?<warning>warning)|(?<error>error))\s[^:]+:(?<message>.+$)|
+(?<error>(fatal\s)?error)[^:]+:(?<message>.+$)
+       ]]></foo>
+</CDataTextNodesType>";
+                       ser.Deserialize (new XmlTextReader (xml, XmlNodeType.Document, null));
+               }
+
+               public class CDataTextNodesType
+               {
+                       public CDataTextNodesInternal foo;
+               }
+
+               public class CDataTextNodesInternal
+               {
+                       [XmlText]
+                       public string Value;
+               }
+
+               void CDataTextNodes_BadNode (object s, XmlNodeEventArgs e)
+               {
+                       Assert.Fail ();
+               }
+
+               // Helper methods
+
+               public static string Infoset (string sx)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml (sx);
+                       StringBuilder sb = new StringBuilder ();
+                       GetInfoset (doc.DocumentElement, sb);
+                       return sb.ToString ();
+               }
+
+               public static string Infoset (XmlNode nod)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       GetInfoset (nod, sb);
+                       return sb.ToString ();
+               }
+
+               static void GetInfoset (XmlNode nod, StringBuilder sb)
+               {
+                       switch (nod.NodeType) {
+                       case XmlNodeType.Attribute:
+                               if (nod.LocalName == "xmlns" && nod.NamespaceURI == "http://www.w3.org/2000/xmlns/") return;
+                               sb.Append (" " + nod.NamespaceURI + ":" + nod.LocalName + "='" + nod.Value + "'");
+                               break;
+
+                       case XmlNodeType.Element:
+                               XmlElement elem = (XmlElement) nod;
+                               sb.Append ("<" + elem.NamespaceURI + ":" + elem.LocalName);
+
+                               ArrayList ats = new ArrayList ();
+                               foreach (XmlAttribute at in elem.Attributes)
+                                       ats.Add (at.LocalName + " " + at.NamespaceURI);
+
+                               ats.Sort ();
+
+                               foreach (string name in ats) {
+                                       string [] nn = name.Split (' ');
+                                       GetInfoset (elem.Attributes [nn [0], nn [1]], sb);
+                               }
+
+                               sb.Append (">");
+                               foreach (XmlNode cn in elem.ChildNodes)
+                                       GetInfoset (cn, sb);
+                               sb.Append ("</>");
+                               break;
+
+                       default:
+                               sb.Append (nod.OuterXml);
+                               break;
+                       }
+               }
+
+               static XmlTypeMapping CreateSoapMapping (Type type)
+               {
+                       SoapReflectionImporter importer = new SoapReflectionImporter ();
+                       return importer.ImportTypeMapping (type);
+               }
+
+               static XmlTypeMapping CreateSoapMapping (Type type, SoapAttributeOverrides ao)
+               {
+                       SoapReflectionImporter importer = new SoapReflectionImporter (ao);
+                       return importer.ImportTypeMapping (type);
+               }
+
+               static XmlTypeMapping CreateSoapMapping (Type type, SoapAttributeOverrides ao, string defaultNamespace)
+               {
+                       SoapReflectionImporter importer = new SoapReflectionImporter (ao, defaultNamespace);
+                       return importer.ImportTypeMapping (type);
+               }
+       }
+}
index fdec3781b45b52e9da28eca128530e1c30359b84..f1470974e25dc3ac9b0c9aa04ba87a1a7aa99ac4 100644 (file)
@@ -1,36 +1,36 @@
-//\r
-// Tests for System.Xml.Serialization.XmlTextAttribute\r
-//\r
-// Author:\r
-//   Gert Driesen\r
-//\r
-// (C) 2005 Novell\r
-//\r
-\r
-using System.Xml.Serialization;\r
-\r
-using NUnit.Framework;\r
-\r
-namespace MonoTests.System.XmlSerialization\r
-{\r
-       [TestFixture]\r
-       public class XmlTextAttributeTests\r
-       {\r
-               [Test]\r
-               public void DataTypeDefault ()\r
-               {\r
-                       XmlTextAttribute attr = new XmlTextAttribute ();\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#1");\r
-\r
-                       attr.DataType = null;\r
-                       Assert.AreEqual (string.Empty, attr.DataType, "#2");\r
-               }\r
-\r
-               [Test]\r
-               public void TypeDefault ()\r
-               {\r
-                       XmlTextAttribute attr = new XmlTextAttribute ();\r
-                       Assert.IsNull (attr.Type);\r
-               }\r
-       }\r
-}\r
+//
+// Tests for System.Xml.Serialization.XmlTextAttribute
+//
+// Author:
+//   Gert Driesen
+//
+// (C) 2005 Novell
+//
+
+using System.Xml.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.XmlSerialization
+{
+       [TestFixture]
+       public class XmlTextAttributeTests
+       {
+               [Test]
+               public void DataTypeDefault ()
+               {
+                       XmlTextAttribute attr = new XmlTextAttribute ();
+                       Assert.AreEqual (string.Empty, attr.DataType, "#1");
+
+                       attr.DataType = null;
+                       Assert.AreEqual (string.Empty, attr.DataType, "#2");
+               }
+
+               [Test]
+               public void TypeDefault ()
+               {
+                       XmlTextAttribute attr = new XmlTextAttribute ();
+                       Assert.IsNull (attr.Type);
+               }
+       }
+}