Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -44,6 +44,7 @@ namespace MonoTests.System.XmlSerialization
[Test]
[NUnit.Framework.Category ("NotDotNet")] // MS.NET results in compilation error (probably it generates bogus source.)
[NUnit.Framework.Category ("MobileNotWorking")]
public void ReadLiteral ()
{
XmlSerializer ss = new XmlSerializer (GetLiteralTypeMapping ());
@@ -286,17 +287,17 @@ namespace MonoTests.System.XmlSerialization
AssertionHelper.AssertEqualsArray ("t.ttList", exp.ttList.ToArray(), t.ttList.ToArray());
Assert.IsNotNull (t.RoList, "t.RoList");
Assert.AreEqual (exp.RoList.Count, t.RoList.Count, "t.RoList.Count");
for (int n=0; n<exp.RoList.Count; n++)
// Assert.AreEqual (exp.RoList.Count, t.RoList.Count, "t.RoList.Count");
for (int n=0; n<t.RoList.Count; n++)
TestPart.AssertEquals ("t.RoList " + n, (TestPart)exp.RoList[n], (TestPart)t.RoList[n]);
Assert.AreEqual (exp.struc.aa, t.struc.aa, "t.struc.aa");
Assert.AreSame (exp.struc.cc, t.struc.cc, "t.struc.cc");
Assert.IsNotNull (t.multiList, "t.multiList");
Assert.AreEqual (exp.multiList.Length, t.multiList.Length, "t.multiList.Count");
for (int n=0; n<exp.multiList.Length; n++)
AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray());
Assert.IsNull (t.multiList, "t.multiList");
// Assert.AreEqual (exp.multiList.Length, t.multiList.Length, "t.multiList.Count");
// for (int n=0; n<exp.multiList.Length; n++)
// AssertionHelper.AssertEqualsArray ("t.multiList " + n, exp.multiList[n].ToArray(), t.multiList[n].ToArray());
Assert.AreEqual (exp.defElem, t.defElem, "t.defElem");
Assert.AreEqual (exp.defAttr, t.defAttr, "t.defAttr");
@@ -305,18 +306,18 @@ namespace MonoTests.System.XmlSerialization
Assert.AreEqual (exp.attqname, t.attqname, "t.attqname");
Assert.IsNotNull (t.dbscontainer, "t.dbscontainer");
DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer;
DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer;
Assert.IsNotNull (tdbca, "t.dbscontainer.at");
Assert.IsNull (t.dbscontainer, "t.dbscontainer");
// DblStringContainer tdbca = t.dbscontainer.at as DblStringContainer;
// DblStringContainer expdbca = exp.dbscontainer.at as DblStringContainer;
// Assert.IsNotNull (tdbca, "t.dbscontainer.at");
Assert.IsNotNull (tdbca, "t.dbscontainer.dbca");
AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring);
// Assert.IsNotNull (tdbca, "t.dbscontainer.dbca");
// AssertionHelper.AssertEqualsArray ("t.dbscontainer.at.doublestring", expdbca.doublestring, tdbca.doublestring);
AnotherTestPart tat = tdbca.at as AnotherTestPart;
AnotherTestPart expat = expdbca.at as AnotherTestPart;
Assert.IsNotNull (tat, "t.dbscontainer.dbca.at");
Assert.AreEqual (expat.lo, tat.lo, "t.dbscontainer.dbca.at.lo");
// AnotherTestPart tat = tdbca.at as AnotherTestPart;
// AnotherTestPart expat = expdbca.at as AnotherTestPart;
// Assert.IsNotNull (tat, "t.dbscontainer.dbca.at");
// Assert.AreEqual (expat.lo, tat.lo, "t.dbscontainer.dbca.at.lo");
}
void CheckParts (string id, TestPart[] exp, TestPart[] parts)
@@ -514,7 +515,7 @@ namespace MonoTests.System.XmlSerialization
}
[SoapIgnore]
// [XmlIgnore]
[XmlIgnore] // Causes NRE in System.Xml.Serialization.CodeGenerator.GetVariableType (System.Object var)
public ArrayList[] multiList;
[SoapIgnore]

View File

@@ -163,7 +163,8 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("NotDotNet")]
[Category ("MobileNotWorking")]
[ExpectedException (typeof (InvalidOperationException))]
public void DeserializeArrayReferences ()
{
string s = "<Sample xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
@@ -248,7 +249,6 @@ namespace MonoTests.System.XmlSerialization
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");
@@ -257,7 +257,6 @@ namespace MonoTests.System.XmlSerialization
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");
@@ -819,7 +818,7 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category ("MobileNotWorking")]
public void TestDeserializeObjectWithReadonlyNulCollection ()
{
string s3 = "";
@@ -830,7 +829,8 @@ namespace MonoTests.System.XmlSerialization
s3 += " </Collection1>";
s3 += "</Container>";
Deserialize (typeof (ObjectWithReadonlyNulCollection), s3);
var obj = (ObjectWithReadonlyNulCollection) Deserialize (typeof (ObjectWithReadonlyNulCollection), s3);
Assert.IsNull (obj.Collection1);
}
[Test]
@@ -1060,7 +1060,7 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("NotDotNet")] // MS.NET results in compilation error (probably it generates bogus source.)
[Category ("NotWorking")] // MS.NET results in compilation error (probably it generates bogus source.)
public void TestDeserialize_Field_Encoded ()
{
Field_Encoded f = null;
@@ -1547,11 +1547,12 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("MobileNotWorking")]
public void NotExactDateParse ()
{
XmlSerializer xs = new XmlSerializer (typeof (NotExactDateParseClass));
NotExactDateParseClass o = (NotExactDateParseClass) xs.Deserialize (new StringReader ("<NotExactDateParseClass xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SomeDate xsi:type=\"xsd:date\">2012-02-05-09:00</SomeDate></NotExactDateParseClass>"));
Assert.AreEqual (new DateTime (2012,2,5), o.SomeDate);
Assert.AreEqual (new DateTime (2012,2,5,9,0,0,DateTimeKind.Utc), o.SomeDate.ToUniversalTime ());
}

View File

@@ -20,15 +20,12 @@ namespace MonoTests.System.XmlSerialization
public class SoapAttributesTests
{
[Test]
// in .NET 2.0, SoapDefaultValue should be null by default, but we need
// more tests before making this change
[Category ("NotDotNet")]
[Category ("MobileNotWorking")]
public void Defaults ()
{
SoapAttributes atts = new SoapAttributes ();
Assert.IsNull (atts.SoapAttribute, "#1");
Assert.IsNotNull (atts.SoapDefaultValue, "#2");
Assert.AreEqual (DBNull.Value, atts.SoapDefaultValue, "#3");
Assert.IsNull (atts.SoapDefaultValue, "#2");
Assert.IsNull (atts.SoapElement, "#4");
Assert.IsNull (atts.SoapEnum, "#5");
Assert.AreEqual (false, atts.SoapIgnore, "#6");

View File

@@ -62,6 +62,7 @@ namespace MonoTests.System.XmlSerialization
// Testcases.
[Test]
[Category ("MobileNotWorking")]
public void NewXmlAttributes ()
{
// seems not different from Type specified ctor().
@@ -74,9 +75,7 @@ namespace MonoTests.System.XmlSerialization
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.IsNull (atts.XmlDefaultValue, "#9");
Assert.IsNotNull (atts.XmlElements, "#11");
Assert.AreEqual (0, atts.XmlElements.Count, "#12");
Assert.IsNull (atts.XmlEnum, "#13");

View File

@@ -2053,7 +2053,7 @@ namespace MonoTests.System.XmlSerialization
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"" />",
<Bug594490Class xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xml:lang=""hello world"" />",
writer.ToString (),
"Novell bug #594490 (https://bugzilla.novell.com/show_bug.cgi?id=594490) not fixed.");
}

View File

@@ -455,7 +455,7 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Ignore ("Additional namespace prefixes are added")]
[Category ("MobileNotWorking")]
public void TestWritePotentiallyReferencingElement ()
{
XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
@@ -497,13 +497,6 @@ namespace MonoTests.System.XmlSerialization
"</q3:Array>", XmlSchemaNamespace, SoapEncodingNamespace), xsw.Content, "#5");
}
[Test]
public void TestWriteSerializable()
{
// FIXME
//Assert.AreEqual (, "");
}
[Test]
public void TestWriteStartDocument()
{
@@ -836,7 +829,6 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("NotWorking")] // enum name is output instead of integral value
public void TestWriteTypedPrimitive_Enum ()
{
XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
@@ -884,7 +876,6 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("NotWorking")] // InvalidOperationException is thrown
public void TestWriteTypedPrimitive_Enum_XsiType ()
{
XmlSerializarionWriterTester xsw = new XmlSerializarionWriterTester ();
@@ -1567,9 +1558,10 @@ namespace MonoTests.System.XmlSerialization
}
[Test]
[Category ("MobileNotWorking")]
public void TestNullableDatesAndTimes ()
{
DateTime dt = new DateTime (2012, 1, 3, 10, 0, 0, 0);
DateTime dt = new DateTime (2012, 1, 3, 10, 0, 0, 0, DateTimeKind.Utc);
var d = new NullableDatesAndTimes () {
MyTime = dt,
@@ -1583,12 +1575,30 @@ namespace MonoTests.System.XmlSerialization
ser.Serialize (sw, d);
string str = sw.ToString ();
Assert.IsTrue (str.IndexOf ("<MyTime>10:00:00</MyTime>") != -1, "Time");
Assert.IsTrue (str.IndexOf ("<MyTimeNullable>10:00:00</MyTimeNullable>") != -1, "Nullable Time");
Assert.IsTrue (str.IndexOf ("<MyDate>2012-01-03</MyDate>") != -1, "Date");
Assert.IsTrue (str.IndexOf ("<MyDateNullable>2012-01-03</MyDateNullable>") != -1, "Nullable Datwe");
str = RemoveTZ (str, "MyTime");
str = RemoveTZ (str, "MyTimeNullable");
var expected =
"<?xml version=\"1.0\" encoding=\"utf-16\"?>" + Environment.NewLine +
"<root xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + Environment.NewLine +
" <MyTime>10:00:00.0000000$TZ$</MyTime>" + Environment.NewLine +
" <MyTimeNullable>10:00:00.0000000$TZ$</MyTimeNullable>" + Environment.NewLine +
" <MyDate>2012-01-03</MyDate>" + Environment.NewLine +
" <MyDateNullable>2012-01-03</MyDateNullable>" + Environment.NewLine +
"</root>";
Assert.AreEqual (expected, str);
}
static string RemoveTZ (string str, string tag)
{
var st = str.IndexOf ("<" + tag + ">");
var et = str.IndexOf ("</" + tag + ">");
if (st < 0 || et < 0)
return str;
var start = str.IndexOfAny (new [] { '+', '-' }, st, et - st);
return str.Substring (0, start) + "$TZ$" + str.Substring (et, str.Length - et);
}
}
}

View File

@@ -465,7 +465,7 @@ namespace MonoTests.System.Xml.TestClasses
public ArrayList list2;
public MyList list3;
// public MyList list3;
public string[] list4;

View File

@@ -1 +1 @@
dd9daa2f49ee069b61b98e305123c007a3f827ae
4e51eceae03b32f848de53e915a039f8bb497709