X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.XML%2FTest%2FSystem.Xml%2FXmlReaderCommonTests.cs;h=dc7c4bc113f8e798b6462d0442503a4a80de18a8;hb=157d75c6a9042357b887b49feac6e95598eb1a8e;hp=99780c008395e28cd019bdd79f4d3032a8b1d2fe;hpb=699e59742843044f6efa1726b7cb64f19d909e64;p=mono.git
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
index 99780c00839..dc7c4bc113f 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
@@ -62,10 +62,14 @@ namespace MonoTests.System.Xml
Assert ("Read() return value", xmlReader.Read ());
Assert ("ReadState", xmlReader.ReadState == ReadState.Interactive);
Assert ("!EOF", !xmlReader.EOF);
- AssertNodeValues (xmlReader, nodeType, depth, isEmptyElement, name, prefix, localName, namespaceURI, value, attributeCount);
+ AssertNodeValues ("", xmlReader, nodeType, depth,
+ isEmptyElement, name, prefix, localName,
+ namespaceURI, value, value != String.Empty,
+ attributeCount, attributeCount > 0);
}
private void AssertNodeValues (
+ string label,
XmlReader xmlReader,
XmlNodeType nodeType,
int depth,
@@ -77,10 +81,14 @@ namespace MonoTests.System.Xml
string value,
int attributeCount)
{
- AssertNodeValues (xmlReader, nodeType, depth, isEmptyElement, name, prefix, localName, namespaceURI, value, value != String.Empty, attributeCount, attributeCount > 0);
+ AssertNodeValues (label, xmlReader, nodeType, depth,
+ isEmptyElement, name, prefix, localName,
+ namespaceURI, value, value != String.Empty,
+ attributeCount, attributeCount > 0);
}
private void AssertNodeValues (
+ string label,
XmlReader xmlReader,
XmlNodeType nodeType,
int depth,
@@ -94,26 +102,27 @@ namespace MonoTests.System.Xml
int attributeCount,
bool hasAttributes)
{
- AssertEquals ("NodeType", nodeType, xmlReader.NodeType);
- AssertEquals ("IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
+ label = String.Concat (label, "(", xmlReader.GetType ().Name, ")");
+ AssertEquals (label + ": NodeType", nodeType, xmlReader.NodeType);
+ AssertEquals (label + ": IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
- AssertEquals ("name", name, xmlReader.Name);
+ AssertEquals (label + ": name", name, xmlReader.Name);
- AssertEquals ("prefix", prefix, xmlReader.Prefix);
+ AssertEquals (label + ": prefix", prefix, xmlReader.Prefix);
- AssertEquals ("localName", localName, xmlReader.LocalName);
+ AssertEquals (label + ": localName", localName, xmlReader.LocalName);
- AssertEquals ("namespaceURI", namespaceURI, xmlReader.NamespaceURI);
+ AssertEquals (label + ": namespaceURI", namespaceURI, xmlReader.NamespaceURI);
- AssertEquals ("Depth", depth, xmlReader.Depth);
+ AssertEquals (label + ": Depth", depth, xmlReader.Depth);
- AssertEquals ("hasValue", hasValue, xmlReader.HasValue);
+ AssertEquals (label + ": hasValue", hasValue, xmlReader.HasValue);
- AssertEquals ("Value", value, xmlReader.Value);
+ AssertEquals (label + ": Value", value, xmlReader.Value);
- AssertEquals ("hasAttributes", hasAttributes, xmlReader.HasAttributes);
+ AssertEquals (label + ": hasAttributes", hasAttributes, xmlReader.HasAttributes);
- AssertEquals ("attributeCount", attributeCount, xmlReader.AttributeCount);
+ AssertEquals (label + ": attributeCount", attributeCount, xmlReader.AttributeCount);
}
private void AssertAttribute (
@@ -170,7 +179,6 @@ namespace MonoTests.System.Xml
document.LoadXml (xml);
xnr = new XmlNodeReader (document);
method (xnr);
-
#if NET_2_0
/*
// XPathNavigatorReader tests
@@ -233,6 +241,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("NotDotNet")]
public void ReadAttributeValue ()
{
RunTest ("", new TestMethod (ReadAttributeValue));
@@ -244,14 +253,18 @@ namespace MonoTests.System.Xml
Assert (reader.MoveToFirstAttribute ());
// It looks like that MS.NET shows AttributeCount and
// HasAttributes as the same as element node!
- this.AssertNodeValues (reader, XmlNodeType.Attribute,
+ this.AssertNodeValues ("#1",
+ reader, XmlNodeType.Attribute,
1, false, "attr", "", "attr", "", "", true, 1, true);
Assert (reader.ReadAttributeValue ());
- // MS.NET XmlTextReader fails. Its Prefix returns null instead of "".
- this.AssertNodeValues (reader, XmlNodeType.Text,
+ // MS.NET XmlTextReader fails. Its Prefix returns
+ // null instead of "". It is fixed in MS.NET 2.0.
+ this.AssertNodeValues ("#2",
+ reader, XmlNodeType.Text,
2, false, "", "", "", "", "", true, 1, true);
Assert (reader.MoveToElement ());
- this.AssertNodeValues (reader, XmlNodeType.Element,
+ this.AssertNodeValues ("#3",
+ reader, XmlNodeType.Element,
0, true, "root", "", "root", "", "", false, 1, true);
}
@@ -1202,6 +1215,7 @@ namespace MonoTests.System.Xml
Assert (xmlReader.MoveToElement ());
AssertNodeValues (
+ "#1",
xmlReader, // xmlReader
XmlNodeType.Element, // nodeType
0, //depth
@@ -1218,7 +1232,8 @@ namespace MonoTests.System.Xml
}
[Test]
- [Ignore ("XmlNodeReader never moves to xml declaration.")]
+// [Category ("NotDotNet")] // MS XmlNodeReader never moves to xml declaration.
+ [Ignore ("Too inconsistent reference implementations to determine which is correct behavior.")]
public void MoveToXmlDeclAttributes ()
{
string xml = "";
@@ -1228,7 +1243,7 @@ namespace MonoTests.System.Xml
public void MoveToXmlDeclAttributes (XmlReader xmlReader)
{
xmlReader.Read ();
- this.AssertNodeValues (xmlReader,
+ this.AssertNodeValues ("#1", xmlReader,
XmlNodeType.XmlDeclaration,
0,
false,
@@ -1238,10 +1253,11 @@ namespace MonoTests.System.Xml
String.Empty,
"version=\"1.0\" standalone=\"yes\"",
2);
- xmlReader.MoveToFirstAttribute ();
- this.AssertNodeValues (xmlReader,
+ Assert ("MoveToFirstAttribute",
+ xmlReader.MoveToFirstAttribute ());
+ this.AssertNodeValues ("#2", xmlReader,
XmlNodeType.Attribute,
- 1,
+ 0, // FIXME: might be 1
false,
"version",
String.Empty,
@@ -1250,20 +1266,20 @@ namespace MonoTests.System.Xml
"1.0",
2);
xmlReader.ReadAttributeValue ();
- this.AssertNodeValues (xmlReader,
+ this.AssertNodeValues ("#3", xmlReader,
XmlNodeType.Text,
- 2,
+ 1, // FIXME might be 2
false,
String.Empty,
+ null, // FIXME: should be String.Empty,
String.Empty,
- String.Empty,
- String.Empty,
+ null, // FIXME: should be String.Empty,
"1.0",
2);
xmlReader.MoveToNextAttribute ();
- this.AssertNodeValues (xmlReader,
+ this.AssertNodeValues ("#4", xmlReader,
XmlNodeType.Attribute,
- 1,
+ 0, // FIXME: might be 1
false,
"standalone",
String.Empty,
@@ -1272,14 +1288,14 @@ namespace MonoTests.System.Xml
"yes",
2);
xmlReader.ReadAttributeValue ();
- this.AssertNodeValues (xmlReader,
+ this.AssertNodeValues ("#5", xmlReader,
XmlNodeType.Text,
- 2,
+ 1, // FIXME: might be 2
false,
String.Empty,
+ null, // FIXME: should be String.Empty,
String.Empty,
- String.Empty,
- String.Empty,
+ null, // FIXME: should be String.Empty,
"yes",
2);
}
@@ -1307,6 +1323,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("NotDotNet")]
public void IndexerAndAttributes ()
{
string xml = @"";