}
// 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]
}
[Test]
- [Category ("NotWorking")]
+ [Category ("MobileNotWorking")]
public void TestSerializeEnumeration_FromValue_Encoded ()
{
SerializeEncoded ((int) SimpleEnumeration.SECOND, typeof (SimpleEnumeration));
}
[Test]
- [Category ("NotWorking")]
+ [Category ("MobileNotWorking")]
public void TestSerializeEnumDefaultValue_Encoded ()
{
SerializeEncoded (new EnumDefaultValue ());
}
[Test]
- [Category ("NotDotNet")] // MS bug
+ [Category ("NotWorking")] // MS bug
public void TestSerializeField_Encoded ()
{
Field_Encoded f = new Field_Encoded ();
XmlSchema.Namespace, XmlSchema.InstanceNamespace, AnotherNamespace,
ANamespace), sw.ToString (), "#3");
}
-
+
+ [Test]
+ public void TestRoundTripSerializeOptionalValueTypeContainer ()
+ {
+ var source = new OptionalValueTypeContainer ();
+ source.IsEmpty = true;
+ source.IsEmptySpecified = true;
+ var ser = new XmlSerializer (typeof (OptionalValueTypeContainer));
+ string xml;
+ using (var t = new StringWriter ()) {
+ ser.Serialize (t, source);
+ xml = t.ToString();
+ }
+ using (var s = new StringReader (xml)) {
+ var obj = (OptionalValueTypeContainer) ser.Deserialize(s);
+ Assert.AreEqual (source.IsEmpty, obj.IsEmpty, "#1");
+ Assert.AreEqual (source.IsEmptySpecified, obj.IsEmptySpecified, "#2");
+ }
+ }
+
[Test]
public void TestSerializePlainContainer ()
{
}
[Test]
- [Category ("NotWorking")] // SerializationCodeGenerator outputs wrong xsi:type for flagencoded in #C1
public void TestSerializeDefaultValueAttribute_Encoded ()
{
SoapAttributeOverrides overrides = new SoapAttributeOverrides ();
[Test]
[ExpectedException (typeof (InvalidOperationException))]
- [Category ("NotWorking")]
+ [Category ("MobileNotWorking")]
public void TestSerializeXmlNodeArrayIncludesAttribute ()
{
XmlDocument doc = new XmlDocument ();
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 ()
}
[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));
Assert.AreEqual ("<:ErrorneousGetSchema></>", Infoset (sw.ToString ()));
}
+ [Test]
public void DateTimeRoundtrip ()
{
// bug #337729
}
[Test]
- [Category("NotDotNet")]
+ [Category("NotWorking")]
public void ShouldSerializeGeneric ()
{
var ser = new XmlSerializer (typeof (ClassWithShouldSerializeGeneric));
generationThreshold.SetValue (null, generationThresholdOld);
generatorFallback.SetValue (null, generatorFallbackOld);
}
+ }
#region XmlInclude on abstract class test classes
- [XmlType]
- public class ContainerTypeForTest
- {
- [XmlElement ("XmlFirstType", typeof (FirstDerivedTypeForTest))]
- [XmlElement ("XmlIntermediateType", typeof (IntermediateTypeForTest))]
- [XmlElement ("XmlSecondType", typeof (SecondDerivedTypeForTest))]
- public AbstractTypeForTest MemberToUseInclude { get; set; }
- }
-
- [XmlInclude (typeof (FirstDerivedTypeForTest))]
- [XmlInclude (typeof (IntermediateTypeForTest))]
- [XmlInclude (typeof (SecondDerivedTypeForTest))]
- public abstract class AbstractTypeForTest
- {
- }
+ [XmlType]
+ public class ContainerTypeForTest
+ {
+ [XmlElement ("XmlSecondType", typeof (SecondDerivedTypeForTest))]
+ [XmlElement ("XmlIntermediateType", typeof (IntermediateTypeForTest))]
+ [XmlElement ("XmlFirstType", typeof (FirstDerivedTypeForTest))]
+ public AbstractTypeForTest MemberToUseInclude { get; set; }
+ }
- public class IntermediateTypeForTest : AbstractTypeForTest
- {
- [XmlAttribute (AttributeName = "intermediate")]
- public bool IntermediateMember { get; set; }
- }
+ [XmlInclude (typeof (SecondDerivedTypeForTest))]
+ [XmlInclude (typeof (IntermediateTypeForTest))]
+ [XmlInclude (typeof (FirstDerivedTypeForTest))]
+ public abstract class AbstractTypeForTest
+ {
+ }
- public class FirstDerivedTypeForTest : AbstractTypeForTest
- {
- public string FirstMember { get; set; }
- }
+ public class IntermediateTypeForTest : AbstractTypeForTest
+ {
+ [XmlAttribute (AttributeName = "intermediate")]
+ public bool IntermediateMember { get; set; }
+ }
- public class SecondDerivedTypeForTest : IntermediateTypeForTest
- {
- public string SecondMember { get; set; }
- }
-#endregion
+ public class FirstDerivedTypeForTest : AbstractTypeForTest
+ {
+ public string FirstMember { get; set; }
+ }
+ public class SecondDerivedTypeForTest : IntermediateTypeForTest
+ {
+ public string SecondMember { get; set; }
}
+#endregion
}