using System;
using System.Collections;
+using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using NUnit.Framework;
-#if NET_2_0
using System.Collections.Generic;
-#endif
using MonoTests.System.Xml.TestClasses;
}
[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]
-#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]
-#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]
-#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[]));
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]
-#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]
-#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]
-#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]
-#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");
}
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]
-#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]
-#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]
-#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));
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));
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]
-#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));
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
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]
-#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));
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));
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");
}
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;
new XmlSerializer (typeof(WrongChoices));
}
-#if NET_2_0
+ [Test]
+ public void XmlArrayOnByteArray ()
+ {
+ new XmlSerializer (typeof (XmlArrayOnByteArrayType));
+ }
+
[Test]
public void ImportNullableInt ()
{
new XmlSerializer (typeof (List<int>).GetGenericTypeDefinition ());
}
-#endif
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlSchemaProviderMissingMethod ()
+ {
+ new XmlSerializer (typeof (XmlSchemaProviderMissingMethodType));
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlSchemaProviderMethodNonStatic ()
+ {
+ new XmlSerializer (typeof (XmlSchemaProviderNonStaticType));
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void XmlSchemaProviderMethodIncorrectReturn ()
+ {
+ new XmlSerializer (typeof (XmlSchemaProviderIncorrectReturnType));
+ }
+
+ [Test]
+ public void XmlSchemaProviderAndDefaultNamespace ()
+ {
+ XmlTypeMapping tm = new XmlReflectionImporter ("urn:bar").ImportTypeMapping (typeof (XmlSchemaProviderAndDefaultNamespaceType));
+ Assert.AreEqual ("foo", tm.ElementName, "#1");
+ Assert.AreEqual ("foo", tm.XsdTypeName, "#2");
+ Assert.AreEqual ("urn:bar", tm.Namespace, "#3");
+ Assert.AreEqual ("urn:foo", tm.XsdTypeNamespace);
+ }
+
+ [Test]
+ public void ImportGenericICollectionWrapped ()
+ {
+ new XmlSerializer (typeof (MyCollection));
+ }
+
+ [Test]
+ public void Bug704813Type ()
+ {
+ var xs = new XmlSerializer (typeof (Bug704813Type));
+ xs.Serialize (TextWriter.Null, new Bug704813Type ());
+ }
+
+ [Test]
+ public void Bug708178Type()
+ {
+ string file = Path.Combine (Path.GetTempPath (), "Bug708178Type.xml");
+ XmlSerializer xmlSerializer = new XmlSerializer (typeof(Bug708178Type));
+ Bug708178Type bugType = new Bug708178Type ();
+ bugType.Foo.Add ("test");
+ Assert.AreEqual (1, bugType.Foo.Count);
+
+ //xml Serialize
+ TextWriter WriteFileStream = new StreamWriter (file, false);
+ xmlSerializer.Serialize (WriteFileStream, bugType);
+ WriteFileStream.Close ();
+
+ //xml Deserialize
+ FileStream ReadFileStream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read);
+ Bug708178Type bugTypeReload = (Bug708178Type)xmlSerializer.Deserialize (ReadFileStream);
+
+ //should have deserialized the relationship
+ Assert.AreEqual(1, bugTypeReload.Foo.Count);
+ }
public class Employee : IXmlSerializable
{
private IEnumerator _baseEnumerator;
}
-#if NET_2_0
+ public class XmlArrayOnByteArrayType
+ {
+ [XmlArray]
+ [XmlArrayItem ("Byte", IsNullable =false)]
+ public byte [] Args;
+ }
+
public class NullableContainer
{
[XmlElement (IsNullable = true)]
set { this.value = value; }
}
}
-#endif
+
+ [XmlSchemaProvider ("GetXsdType")]
+ public class XmlSchemaProviderMissingMethodType : IXmlSerializable
+ {
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public void WriteXml (XmlWriter writer)
+ {
+ }
+
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+ }
+
+ [XmlSchemaProvider ("GetXsdType")]
+ public class XmlSchemaProviderNonStaticType : IXmlSerializable
+ {
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public void WriteXml (XmlWriter writer)
+ {
+ }
+
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+
+ public object GetXsdType ()
+ {
+ return null;
+ }
+ }
+
+ [XmlSchemaProvider ("GetXsdType")]
+ public class XmlSchemaProviderIncorrectReturnType : IXmlSerializable
+ {
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public void WriteXml (XmlWriter writer)
+ {
+ }
+
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+
+ public static object GetXsdType ()
+ {
+ return null;
+ }
+ }
+
+ [XmlSchemaProvider ("GetXsd")]
+ public class XmlSchemaProviderAndDefaultNamespaceType : IXmlSerializable
+ {
+ public static XmlQualifiedName GetXsd (XmlSchemaSet xss)
+ {
+ XmlSchema xs = new XmlSchema ();
+ xs.TargetNamespace = "urn:foo";
+ XmlSchemaComplexType ct = new XmlSchemaComplexType ();
+ ct.Name = "foo";
+ xs.Items.Add (ct);
+ xss.Add (xs);
+ return new XmlQualifiedName ("foo", "urn:foo");
+ }
+
+ public void WriteXml (XmlWriter write)
+ {
+ }
+
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+ }
+
+ public class MyCollection : ICollection<string>
+ {
+ public int Count { get { return 0; } }
+
+ public bool IsReadOnly { get { return false; } }
+
+ public void Add (string s)
+ {
+ }
+
+ public void Clear ()
+ {
+ }
+
+ public bool Contains (string item)
+ {
+ return false;
+ }
+
+ public void CopyTo (string [] array, int arrayIndex)
+ {
+ }
+
+ public IEnumerator<string> GetEnumerator ()
+ {
+ throw new Exception ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ public bool Remove (string item)
+ {
+ return false;
+ }
+ }
+
+ public class Bug594490Class
+ {
+ [XmlAttribute ("xml:lang")]
+ public string GroupName;
+ }
+
+ [Test]
+ public void Bug594490_SerializationOfXmlLangAttribute ()
+ {
+ var serializer = new XmlSerializer (typeof(Bug594490Class));
+
+ using (var writer = new StringWriter ()) {
+ var obj = new Bug594490Class ();
+
+ obj.GroupName = "hello world";
+
+ serializer.Serialize (writer, obj);
+ writer.Close ();
+
+ Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>
+<Bug594490Class xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xml:lang=""hello world"" />",
+ writer.ToString (),
+ "Novell bug #594490 (https://bugzilla.novell.com/show_bug.cgi?id=594490) not fixed.");
+ }
+ }
+
+ /*
+ * The following code was generated from Microsoft's xsd.exe with the /classes switch.
+ * It only includes the relevent details but was based on the following namespaces:
+ * urn:oasis:names:tc:SAML:2.0:protocol
+ * urn:oasis:names:tc:SAML:2.0:assertion
+ * http://www.w3.org/2000/09/xmldsig#
+ * http://www.w3.org/2001/04/xmlenc
+ */
+
+ [XmlTypeAttribute (Namespace = "urn:oasis:names:tc:SAML:2.0:protocol")]
+ [XmlRootAttribute ("RequestedAuthnContext", Namespace = "urn:oasis:names:tc:SAML:2.0:protocol", IsNullable = false)]
+ public class RequestedAuthnContext
+ {
+ string[] items;
+ ItemsChoice7[] itemsElementName;
+
+ [XmlElementAttribute ("AuthnContextClassRef", typeof (string), Namespace = "urn:oasis:names:tc:SAML:2.0:assertion", DataType = "anyURI")]
+ [XmlElementAttribute ("AuthnContextDeclRef", typeof (string), Namespace = "urn:oasis:names:tc:SAML:2.0:assertion", DataType = "anyURI")]
+ [XmlChoiceIdentifierAttribute ("ItemsElementName")]
+ public string[] Items {
+ get { return this.items; }
+ set { this.items = value; }
+ }
+
+ [XmlElementAttribute ("ItemsElementName")]
+ [XmlIgnoreAttribute ()]
+ public ItemsChoice7[] ItemsElementName {
+ get { return this.itemsElementName; }
+ set { this.itemsElementName = value; }
+ }
+ }
+
+ [XmlTypeAttribute (Namespace = "urn:oasis:names:tc:SAML:2.0:protocol", IncludeInSchema = false)]
+ public enum ItemsChoice7 {
+ [XmlEnumAttribute ("urn:oasis:names:tc:SAML:2.0:assertion:AuthnContextClassRef")]
+ AuthnContextClassRef,
+ [XmlEnumAttribute ("urn:oasis:names:tc:SAML:2.0:assertion:AuthnContextDeclRef")]
+ AuthnContextDeclRef,
+ }
+ // End snippet from xsd.exe
+
+ [Test]
+ public void FullyQualifiedName_XmlEnumAttribute ()
+ {
+ var serializer = new XmlSerializer (typeof (RequestedAuthnContext));
+ }
}
}