Merge pull request #3968 from BrzVlad/fix-monitor-exception
[mono.git] / mcs / class / System.XML / Test / System.Xml.Serialization / XmlSerializerTests.cs
index 70f5591eadcf4decb05d151384e3fd8a88704669..61835e709a09541daa56c89b501efc256c0ba3c1 100644 (file)
@@ -161,14 +161,12 @@ namespace MonoTests.System.XmlSerialization
                }
 
                // test constructors
-#if USE_VERSION_1_1    // It doesn't pass on MS.NET 1.1.
                [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
                public void TestConstructor()
                {
                        XmlSerializer ser = new XmlSerializer (null, "");
                }
-#else
-#endif
 
                // test basic types ////////////////////////////////////////////////////////
                [Test]
@@ -278,7 +276,7 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("MobileNotWorking")]
                public void TestSerializeEnumeration_FromValue_Encoded ()
                {
                        SerializeEncoded ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));
@@ -376,7 +374,7 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("MobileNotWorking")]
                public void TestSerializeEnumDefaultValue_Encoded ()
                {
                        SerializeEncoded (new EnumDefaultValue ());
@@ -729,7 +727,7 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [Category ("NotDotNet")] // MS bug
+               [Category ("NotWorking")] // MS bug
                public void TestSerializeField_Encoded ()
                {
                        Field_Encoded f = new Field_Encoded ();
@@ -1554,7 +1552,6 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [Category ("NotWorking")] // SerializationCodeGenerator outputs wrong xsi:type for flagencoded in #C1
                public void TestSerializeDefaultValueAttribute_Encoded ()
                {
                        SoapAttributeOverrides overrides = new SoapAttributeOverrides ();
@@ -1752,7 +1749,7 @@ namespace MonoTests.System.XmlSerialization
 
                [Test]
                [ExpectedException (typeof (InvalidOperationException))]
-               [Category ("NotWorking")]
+               [Category ("MobileNotWorking")]
                public void TestSerializeXmlNodeArrayIncludesAttribute ()
                {
                        XmlDocument doc = new XmlDocument ();
@@ -1940,6 +1937,17 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (Infoset (res), WriterText);
                }
 
+               [Test] // Covers #36829
+               public void TestSubclassElementList ()
+               {
+                       var o = new SubclassTestList () { Items = new List<object> () { new SubclassTestSub () } };
+                       Serialize (o);
+
+                       string res = "<SubclassTestList xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+                       res += "<b xsi:type=\"SubclassTestSub\"/></SubclassTestList>";
+                       Assert.AreEqual (Infoset (res), WriterText);
+               }
+
                [Test]
                [ExpectedException (typeof (InvalidOperationException))]
                public void TestArrayAttributeWithWrongDataType ()
@@ -2235,14 +2243,14 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
+               [Category ("MobileNotWorking")]
                public void XmlArrayAttributeUnqualifiedWithNamespace ()
                {
                        new XmlSerializer (typeof (XmlArrayUnqualifiedWithNamespace));
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
+               [Category ("MobileNotWorking")]
                public void XmlArrayItemAttributeUnqualifiedWithNamespace ()
                {
                        new XmlSerializer (typeof (XmlArrayItemUnqualifiedWithNamespace));
@@ -2313,6 +2321,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual ("<:ErrorneousGetSchema></>", Infoset (sw.ToString ()));
                }
 
+               [Test]
                public void DateTimeRoundtrip ()
                {
                        // bug #337729
@@ -3358,7 +3367,7 @@ namespace MonoTests.System.XmlSerialization
                }
 
                [Test]
-               [Category("NotDotNet")]
+               [Category("NotWorking")]
                public void ShouldSerializeGeneric ()
                {
                        var ser = new XmlSerializer (typeof (ClassWithShouldSerializeGeneric));
@@ -3514,15 +3523,15 @@ namespace MonoTests.System.XmlSerialization
        [XmlType]
        public class ContainerTypeForTest
        {
-               [XmlElement ("XmlFirstType", typeof (FirstDerivedTypeForTest))]
-               [XmlElement ("XmlIntermediateType", typeof (IntermediateTypeForTest))]
                [XmlElement ("XmlSecondType", typeof (SecondDerivedTypeForTest))]
+               [XmlElement ("XmlIntermediateType", typeof (IntermediateTypeForTest))]
+               [XmlElement ("XmlFirstType", typeof (FirstDerivedTypeForTest))]
                public AbstractTypeForTest MemberToUseInclude { get; set; }
        }
 
-       [XmlInclude (typeof (FirstDerivedTypeForTest))]
-       [XmlInclude (typeof (IntermediateTypeForTest))]
        [XmlInclude (typeof (SecondDerivedTypeForTest))]
+       [XmlInclude (typeof (IntermediateTypeForTest))]
+       [XmlInclude (typeof (FirstDerivedTypeForTest))]
        public abstract class AbstractTypeForTest
        {
        }
@@ -3543,5 +3552,4 @@ namespace MonoTests.System.XmlSerialization
                public string SecondMember { get; set; }
        }
 #endregion
-
 }