Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-02-11 21:04:40 +0300
committerSebastien Pouliot <sebastien@ximian.com>2004-02-11 21:04:40 +0300
commite8ce970287ee81ce7d38d72fe6f179532d4b6128 (patch)
treea92ebff6cd460a28f546f50f2f1f63ba89d871aa /mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
parentceb3b59c94a031a5096589dc45f4e70785896969 (diff)
2004-02-11 Sebastien Pouliot <sebastien@ximian.com>
* ReferenceTest.cs: Tests fixed if XML is different (but equivalent) to MS implementation. * SignatureTest.cs: Tests fixed if XML is different (but equivalent) to MS implementation. * XmlDsigBase64TransformTest.cs: New UnprotectedGetInnerXml class to get results from the protected GetInnerXml. No more convertion to arrays. * XmlDsigC14NTransformTest.cs: New UnprotectedGetInnerXml class to get results from the protected GetInnerXml. Fixed input/output typo. Tests fixed if XML is different (but equivalent) to MS implementation. * XmlDsigC14NWithCommentsTransformTest.cs: New UnprotectedGetInnerXml class to get results from the protected GetInnerXml. Fixed input/output typo. * XmlDsigXPathTransformTest.cs: New. Unit tests XmlDsigXPathTransform. * XmlDsigXsltTransformTest.cs: New UnprotectedGetInnerXml class to get results from the protected GetInnerXml. Fixed input/output typo. svn path=/trunk/mcs/; revision=22984
Diffstat (limited to 'mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs')
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs46
1 files changed, 30 insertions, 16 deletions
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
index c762cbc7a58..150f263bbcf 100644
--- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
@@ -2,9 +2,10 @@
// XmlDsigXsltTransformTest.cs - NUnit Test Cases for XmlDsigXsltTransform
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2004 Novell (http://www.novell.com)
//
using System;
@@ -19,15 +20,24 @@ using NUnit.Framework;
namespace MonoTests.System.Security.Cryptography.Xml {
+ // Note: GetInnerXml is protected in XmlDsigXsltTransform making it
+ // difficult to test properly. This class "open it up" :-)
+ public class UnprotectedXmlDsigXsltTransform : XmlDsigXsltTransform {
+
+ public XmlNodeList UnprotectedGetInnerXml () {
+ return base.GetInnerXml ();
+ }
+ }
+
[TestFixture]
public class XmlDsigXsltTransformTest : Assertion {
- protected XmlDsigXsltTransform transform;
+ protected UnprotectedXmlDsigXsltTransform transform;
[SetUp]
protected void SetUp ()
{
- transform = new XmlDsigXsltTransform ();
+ transform = new UnprotectedXmlDsigXsltTransform ();
}
[Test]
@@ -57,13 +67,20 @@ namespace MonoTests.System.Security.Cryptography.Xml {
Assert ("Output #", (output.Length == 1));
// check presence of every supported output types
bool ostream = false;
- foreach (Type t in input) {
+ foreach (Type t in output) {
if (t.ToString () == "System.IO.Stream")
ostream = true;
}
Assert ("Output Stream", ostream);
}
+ [Test]
+ public void GetInnerXml ()
+ {
+ XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
+ AssertNull ("Default InnerXml", xnl);
+ }
+
private string Stream2Array (Stream s)
{
StringBuilder sb = new StringBuilder ();
@@ -76,7 +93,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
}
[Test]
- // can't use ExpectedException as it doesn't have a constructor with 0 parameters
+ // can't use ExpectedException as XsltCompileException doesn't have a constructor with 0 parameters
// [ExpectedException (typeof (XsltCompileException))]
public void InvalidXslt ()
{
@@ -115,7 +132,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
string output = Stream2Array (s);
}
- private XmlDocument GetDoc ()
+ private XmlDocument GetXslDoc ()
{
string test = "<Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\">";
test += "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns=\"http://www.w3.org/TR/xhtml1/strict\" version=\"1.0\">";
@@ -133,7 +150,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
[Ignore ("not working")]
public void LoadInputAsXmlDocument ()
{
- XmlDocument doc = GetDoc ();
+ XmlDocument doc = GetXslDoc ();
transform.LoadInput (doc);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2Array (s);
@@ -143,7 +160,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
[Ignore ("not working")]
public void LoadInputAsXmlNodeList ()
{
- XmlDocument doc = GetDoc ();
+ XmlDocument doc = GetXslDoc ();
transform.LoadInput (doc.ChildNodes);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2Array (s);
@@ -153,7 +170,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
[Ignore ("not working")]
public void LoadInputAsStream ()
{
- XmlDocument doc = GetDoc ();
+ XmlDocument doc = GetXslDoc ();
MemoryStream ms = new MemoryStream ();
doc.Save (ms);
ms.Position = 0;
@@ -173,20 +190,17 @@ namespace MonoTests.System.Security.Cryptography.Xml {
[Test]
public void LoadInnerXml ()
{
- string value = "<Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" />";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (value);
-
+ XmlDocument doc = GetXslDoc ();
transform.LoadInnerXml (doc.ChildNodes);
- // note: GetInnerXml is protected so we can't AssertEquals :-(
- // unless we use reflection (making it a lot more complicated)
+ XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
+ AssertEquals ("LoadInnerXml", doc.ChildNodes, xnl);
}
[Test]
[Ignore ("not working")]
public void Load2 ()
{
- XmlDocument doc = GetDoc ();
+ XmlDocument doc = GetXslDoc ();
transform.LoadInnerXml (doc.ChildNodes);
transform.LoadInput (doc);
Stream s = (Stream) transform.GetOutput ();