2004-05-05 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 5 May 2004 03:51:51 +0000 (03:51 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 5 May 2004 03:51:51 +0000 (03:51 -0000)
* XmlDsigBase64Transform.cs : LoadInputAsXmlNodeList() is testable.
* XmlDsigC14NTransformTest.cs : Ignore LoadInputAsXmlNodeList(); that
  test premises incorrect namespace handling.
* XmlDsigXPathTransformTest.cs : Removed some FIXMEs (counting node
  will give more expected results),
  plus some noise on FunctionHereObsolete().

svn path=/trunk/mcs/; revision=26732

mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXPathTransformTest.cs

index d298a0ae31f0005d44c6e436cdf7a40cdf4e3536..cacfb8088dec81530db1a95f70a6d13399e1b5db 100644 (file)
@@ -1,3 +1,12 @@
+2004-05-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XmlDsigBase64Transform.cs : LoadInputAsXmlNodeList() is testable.
+       * XmlDsigC14NTransformTest.cs : Ignore LoadInputAsXmlNodeList(); that
+         test premises incorrect namespace handling.
+       * XmlDsigXPathTransformTest.cs : Removed some FIXMEs (counting node
+         will give more expected results),
+         plus some noise on FunctionHereObsolete().
+
 2004-03-26  Atsushi Enomoto  <atsushi@ximian.com>
 
        * Added XmlDsigEnvelopedSignatureTransformTest.cs.
index e77a7d18cb414e2015c554a998fa70e3aad743be..2238f0b598533ca7ee36e70b2ca3c0cff9245b70 100644 (file)
@@ -121,14 +121,14 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                }
 
                [Test]
-               [Ignore ("LAMESPEC or BUG but this returns nothing with MS implementation ???")]
                public void LoadInputAsXmlNodeList () 
                {
                        XmlDocument doc = GetDoc ();
                        transform.LoadInput (doc.ChildNodes);
                        Stream s = (Stream) transform.GetOutput ();
                        string output = Stream2String (s);
-                       AssertEquals ("XmlChildNodes", String.Empty, output); // ???
+                       // Note that ChildNodes does not contain the text node.
+                       AssertEquals ("XmlChildNodes", String.Empty, output);
                }
 
                [Test]
index 82e8561a90eba30616f2ced8d4e86b38fb07a095..2ead6f5dc6ffa5d9895b2913fb88a35096e6da32 100644 (file)
@@ -136,6 +136,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                }
 
                [Test]
+               [Ignore ("MS.NET incorrectly ignores the element's namespace that should be in the output (note that namespace specification on an element to represent the element's namespace URI is not a 'namespace node' that should be specified separately in XPath expression)")]
                public void LoadInputAsXmlNodeList () 
                {
                        XmlDocument doc = GetDoc ();
@@ -188,7 +189,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        XmlDocument doc = new XmlDocument();
                        object o = transform.GetOutput (doc.GetType ());
                }
-               
+
                [Test]
                public void C14NSpecExample1 ()
                {
index 3f107473b54dc1de173beb2d51d205a8f8cb6e42..c2a8bcff5e35e2f8d03833050789a6c5ab3360e6 100755 (executable)
@@ -81,6 +81,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                                if (expected [i].OuterXml != actual [i].OuterXml)
                                        Fail (msg + " [" + i + "] expected " + expected[i].OuterXml + " bug got " + actual[i].OuterXml);
                        }
+                       AssertEquals (expected.Count, actual.Count);
                }
 
                [Test]
@@ -129,8 +130,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        XmlNodeList inner = InnerXml ("//*/title");
                        transform.LoadInnerXml (inner);
                        XmlNodeList xnl = (XmlNodeList) transform.GetOutput ();
-                       // FIXME: This cannot be the *right* result - I must be missing something :(
-                       AssertEquals ("XPath result", doc.ChildNodes, xnl);
+                       AssertEquals (47, xnl.Count);
                }
 
                [Test]
@@ -151,8 +151,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        XmlNodeList inner = InnerXml ("//*/title");
                        transform.LoadInnerXml (inner);
                        XmlNodeList xnl = (XmlNodeList) transform.GetOutput ();
-                       // FIXME: This cannot be the *right* result - I must be missing something :(
-                       AssertEquals ("XPath result", doc.ChildNodes, xnl);
+                       AssertEquals (47, xnl.Count);
                }
 
                [Test]
@@ -177,8 +176,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        XmlNodeList inner = InnerXml ("//*/title");
                        transform.LoadInnerXml (inner);
                        XmlNodeList xnl = (XmlNodeList) transform.GetOutput ();
-                       // FIXME: This cannot be the *right* result - I must be missing something :(
-                       AssertEquals ("XPath result", doc.ChildNodes, xnl);
+                       AssertEquals (47, xnl.Count);
                }
 
                [Test]
@@ -247,20 +245,43 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                }
 
                [Test]
-               [Ignore ("MS.NET looks incorrect, or something incorrect in this test code")]
-               public void FunctionHere ()
+               [Ignore ("MS.NET looks incorrect, or something incorrect in this test code; It turned out nothing to do with function here()")]
+               public void FunctionHereObsolete ()
                {
                        XmlDsigXPathTransform t = new XmlDsigXPathTransform ();
                        XmlDocument xpdoc = new XmlDocument ();
                        string ns = "http://www.w3.org/2000/09/xmldsig#";
-                       string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'>here()</XPath>";
+//                     string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'>here()</XPath>";
+                       string xpath = "<XPath xmlns='" + ns + "' xmlns:x='urn:foo'></XPath>";
                        xpdoc.LoadXml (xpath);
                        t.LoadInnerXml (xpdoc.ChildNodes);
                        XmlDocument doc = new XmlDocument ();
-                       doc.LoadXml ("<element xmlns='urn:foo'><foo><bar>test</bar></foo></element>");
+
+                       doc.LoadXml ("<element a='b'><foo><bar>test</bar></foo></element>");
                        t.LoadInput (doc);
                        XmlNodeList nl = (XmlNodeList) t.GetOutput ();
                        AssertEquals (0, nl.Count);
+
+                       doc.LoadXml ("<element xmlns='urn:foo'><foo><bar>test</bar></foo></element>");
+                       t.LoadInput (doc);
+                       nl = (XmlNodeList) t.GetOutput ();
+                       AssertEquals (1, nl.Count);
+
+                       doc.LoadXml ("<element xmlns='urn:foo'><foo xmlns='urn:bar'><bar>test</bar></foo></element>");
+                       t.LoadInput (doc);
+                       nl = (XmlNodeList) t.GetOutput ();
+                       AssertEquals (2, nl.Count);
+
+                       doc.LoadXml ("<element xmlns='urn:foo' xmlns:x='urn:x'><foo xmlns='urn:bar'><bar>test</bar></foo></element>");
+                       t.LoadInput (doc);
+                       nl = (XmlNodeList) t.GetOutput ();
+                       AssertEquals (3, nl.Count);
+
+                       doc.LoadXml ("<envelope><Signature xmlns='http://www.w3.org/2000/09/xmldsig#'><XPath>blah</XPath></Signature></envelope>");
+                       t.LoadInput (doc);
+                       nl = (XmlNodeList) t.GetOutput ();
+                       AssertEquals (1, nl.Count);
+                       AssertEquals (XmlNodeType.Attribute, nl [0].NodeType);
                }
        }
 }