2007-09-25 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / Test / System.Xml.Serialization / XmlReflectionImporterTests.cs
index cdee4db015c10430c5707e8dbe6ec6134f14c7f2..6e2778957378b44178f77d4a56e99c8a851f09b2 100644 (file)
@@ -1538,6 +1538,12 @@ namespace MonoTests.System.XmlSerialization
                        new XmlSerializer (typeof(WrongChoices));
                }
 
+               [Test]
+               public void XmlArrayOnByteArray ()
+               {
+                       new XmlSerializer (typeof (XmlArrayOnByteArrayType));
+               }
+
 #if NET_2_0
 
                [Test]
@@ -1584,6 +1590,27 @@ namespace MonoTests.System.XmlSerialization
                {
                        new XmlSerializer (typeof (List<int>).GetGenericTypeDefinition ());
                }
+
+               [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));
+               }
 #endif
 
                public class Employee : IXmlSerializable
@@ -2052,6 +2079,13 @@ namespace MonoTests.System.XmlSerialization
                        private IEnumerator _baseEnumerator;
                }
 
+               public class XmlArrayOnByteArrayType
+               {
+                       [XmlArray]
+                       [XmlArrayItem ("Byte", IsNullable =false)]
+                       public byte [] Args;
+               }
+
 #if NET_2_0
                public class NullableContainer
                {
@@ -2068,6 +2102,67 @@ namespace MonoTests.System.XmlSerialization
                                set { this.value = value; }
                        }
                }
+
+               [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;
+                       }
+               }
 #endif
        }
 }