Hi,

The attached patch provides some trivial fixes for XmlDsig transforms in
System.Security, and adds/improves unit tests.

Let me know if this is ok to commit.

Gert

Index: Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs	(working copy)
@@ -23,8 +23,17 @@
 
 	// Note: GetInnerXml is protected in XmlDsigXsltTransform making it
 	// difficult to test properly. This class "open it up" :-)
-	public class UnprotectedXmlDsigXsltTransform : XmlDsigXsltTransform {
+	public class UnprotectedXmlDsigXsltTransform : XmlDsigXsltTransform
+	{
+		public UnprotectedXmlDsigXsltTransform ()
+		{
+		}
 
+		public UnprotectedXmlDsigXsltTransform (bool includeComments)
+			: base (includeComments)
+		{
+		}
+
 		public XmlNodeList UnprotectedGetInnerXml () {
 			return base.GetInnerXml ();
 		}
@@ -36,14 +45,28 @@
 		protected UnprotectedXmlDsigXsltTransform transform;
 
 		[SetUp]
-		protected void SetUp () 
+		protected void SetUp ()
 		{
 			transform = new UnprotectedXmlDsigXsltTransform ();
 		}
 
-		[Test]
-		public void Properties () 
+		[Test] // ctor ()
+		public void Constructor1 ()
 		{
+			CheckProperties (transform);
+		}
+
+		[Test] // ctor (Boolean)
+		public void Constructor2 ()
+		{
+			transform = new UnprotectedXmlDsigXsltTransform (true);
+			CheckProperties (transform);
+			transform = new UnprotectedXmlDsigXsltTransform (false);
+			CheckProperties (transform);
+		}
+
+		void CheckProperties (XmlDsigXsltTransform transform)
+		{
 			AssertEquals ("Algorithm", "http://www.w3.org/TR/1999/REC-xslt-19991116";, transform.Algorithm);
 
 			Type[] input = transform.InputTypes;

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/ChangeLog
===================================================================
--- Test/System.Security.Cryptography.Xml/ChangeLog	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2008-08-09  Gert Driesen  <[EMAIL PROTECTED]>
+
+	* XmlDsigXsltTranformTest.cs: Added test for .ctor (bool).
+	* XmlDsigEnvelopedTransformTest.cs: Added test for .ctor (bool). Use
+	Assert class. Improved properties tests.
+	* XmlDsigC14TransformTest.cs: Added test for .ctor (bool).
+	* XmlDsigExcC14NTransformTest.cs: Added .ctor tests and added asserts
+	IncludsiveNamespacesPrefixList
+	* XmlDsigExcC14NWithCommentsTransformTest.cs: Added basic .ctor and
+	properties tests.
+	* XmlDsigC14NWithCommentsTransformTest.cs: Fixed line endings.
+	* XmlLicenseTransformTest.cs: Added basic .ctor and properties tests.
+
 2008-05-25  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
 	* XmlDsigBase64TransformTest.cs: Add test case for InputTypes
Index: Test/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransformTest.cs	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransformTest.cs	(working copy)
@@ -21,79 +21,103 @@
 
 	// Note: GetInnerXml is protected in XmlDsigEnvelopedSignatureTransform making it
 	// difficult to test properly. This class "open it up" :-)
-	public class UnprotectedXmlDsigEnvelopedSignatureTransform : XmlDsigEnvelopedSignatureTransform {
+	public class UnprotectedXmlDsigEnvelopedSignatureTransform : XmlDsigEnvelopedSignatureTransform
+	{
+		public UnprotectedXmlDsigEnvelopedSignatureTransform ()
+		{
+		}
 
-		public XmlNodeList UnprotectedGetInnerXml () 
+		public UnprotectedXmlDsigEnvelopedSignatureTransform (bool includeComments)
+			: base (includeComments)
 		{
+		}
+
+		public XmlNodeList UnprotectedGetInnerXml ()
+		{
 			return base.GetInnerXml ();
 		}
 	}
 
 	[TestFixture]
-	public class XmlDsigEnvelopedSignatureTransformTest : Assertion {
+	public class XmlDsigEnvelopedSignatureTransformTest
+	{
+		private UnprotectedXmlDsigEnvelopedSignatureTransform transform;
 
-		protected UnprotectedXmlDsigEnvelopedSignatureTransform transform;
-
 		[SetUp]
-		protected void SetUp () 
+		public void SetUp ()
 		{
 			transform = new UnprotectedXmlDsigEnvelopedSignatureTransform ();
 		}
 
-		[Test]
-		public void Properties () 
+		[Test] // ctor ()
+		public void Constructor1 ()
 		{
-			AssertEquals ("Algorithm", "http://www.w3.org/2000/09/xmldsig#enveloped-signature";, transform.Algorithm);
+			CheckProperties (transform);
+		}
 
-			Type[] input = transform.InputTypes;
-			AssertEquals ("Input Length", 3, input.Length);
+		[Test] // ctor (Boolean)
+		public void Constructor2 ()
+		{
+			transform = new UnprotectedXmlDsigEnvelopedSignatureTransform (true);
+			CheckProperties (transform);
+			transform = new UnprotectedXmlDsigEnvelopedSignatureTransform (false);
+			CheckProperties (transform);
+		}
+
+		void CheckProperties (XmlDsigEnvelopedSignatureTransform transform)
+		{
+			Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#enveloped-signature";,
+				transform.Algorithm, "Algorithm");
+
+			Type [] input = transform.InputTypes;
+			Assert.AreEqual (3, input.Length, "Input Length");
 			// check presence of every supported input types
 			bool istream = false;
 			bool ixmldoc = false;
 			bool ixmlnl = false;
 			foreach (Type t in input) {
-				if (t.ToString () == "System.Xml.XmlDocument")
+				if (t == typeof (XmlDocument))
 					ixmldoc = true;
-				if (t.ToString () == "System.Xml.XmlNodeList")
+				if (t == typeof (XmlNodeList))
 					ixmlnl = true;
+				if (t == typeof (Stream))
+					istream = true;
 			}
-			Assert ("No Input Stream", !istream);
-			Assert ("Input XmlDocument", ixmldoc);
-			Assert ("Input XmlNodeList", ixmlnl);
+			Assert.IsTrue (istream, "Input Stream");
+			Assert.IsTrue (ixmldoc, "Input XmlDocument");
+			Assert.IsTrue (ixmlnl, "Input XmlNodeList");
 
-			Type[] output = transform.OutputTypes;
-			AssertEquals ("Output Length", 2, output.Length);
+			Type [] output = transform.OutputTypes;
+			Assert.AreEqual (2, output.Length, "Output Length");
 			// check presence of every supported output types
 			bool oxmlnl = false;
 			bool oxmldoc = false;
 			foreach (Type t in output) {
-				if (t == null)
-					throw new InvalidOperationException ();
-				if (t.ToString () == "System.Xml.XmlNodeList")
+				if (t == typeof (XmlNodeList))
 					oxmlnl = true;
-				if (t.ToString () == "System.Xml.XmlDocument")
+				if (t == typeof (XmlDocument))
 					oxmldoc = true;
 			}
-			Assert ("Output XmlNodeList", oxmlnl);
-			Assert ("Output XmlDocument", oxmldoc);
+			Assert.IsTrue (oxmlnl, "Output XmlNodeList");
+			Assert.IsTrue (oxmldoc, "Output XmlDocument");
 		}
 
-		protected void AssertEquals (string msg, XmlNodeList expected, XmlNodeList actual) 
+		void AssertEquals (XmlNodeList expected, XmlNodeList actual, string msg)
 		{
-			for (int i=0; i < expected.Count; i++) {
+			for (int i = 0; i < expected.Count; i++) {
 				if (expected [i].OuterXml != actual [i].OuterXml)
-					Fail (msg + " [" + i + "] expected " + expected[i].OuterXml + " bug got " + actual[i].OuterXml);
+					Assert.Fail (msg + " [" + i + "] expected " + expected [i].OuterXml + " bug got " + actual [i].OuterXml);
 			}
 		}
 
 		[Test]
-		public void GetInnerXml () 
+		public void GetInnerXml ()
 		{
 			// Always returns null
-			AssertNull (transform.UnprotectedGetInnerXml ());
+			Assert.IsNull (transform.UnprotectedGetInnerXml ());
 		}
 
-		private XmlDocument GetDoc () 
+		XmlDocument GetDoc ()
 		{
 			string dsig = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\";><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"; /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#dsa-sha1\"; /><Reference URI=\"\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"; /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"; /><DigestValue>fdy6S2NLpnT4fMdokUHSHsmpcvo=</DigestValue></Reference></Signature>";
 			string test = "<Envelope> " + dsig + " </Envelope>";
@@ -108,7 +132,7 @@
 			XmlDocument doc = GetDoc ();
 			transform.LoadInput (doc);
 			object o = transform.GetOutput ();
-			AssertEquals ("EnvelopedSignature result", doc, o);
+			Assert.AreEqual (doc, o, "EnvelopedSignature result");
 		}
 
 		[Test]
@@ -117,7 +141,7 @@
 			XmlDocument doc = GetDoc ();
 			transform.LoadInput (doc.ChildNodes);
 			XmlNodeList xnl = (XmlNodeList) transform.GetOutput ();
-			AssertEquals ("EnvelopedSignature result", doc.ChildNodes, xnl);
+			AssertEquals (doc.ChildNodes, xnl, "EnvelopedSignature result");
 		}
 	}
 }

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs	(working copy)
@@ -33,9 +33,29 @@
 
 	// Note: GetInnerXml is protected in XmlDsigExcC14NTransform making it
 	// difficult to test properly. This class "open it up" :-)
-	public class UnprotectedXmlDsigExcC14NTransform : XmlDsigExcC14NTransform {
+	public class UnprotectedXmlDsigExcC14NTransform : XmlDsigExcC14NTransform
+	{
+		public UnprotectedXmlDsigExcC14NTransform ()
+		{
+		}
 
-		public XmlNodeList UnprotectedGetInnerXml () {
+		public UnprotectedXmlDsigExcC14NTransform (bool includeComments)
+			: base (includeComments)
+		{
+		}
+
+		public UnprotectedXmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList)
+			: base (inclusiveNamespacesPrefixList)
+		{
+		}
+
+		public UnprotectedXmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)
+			: base (includeComments, inclusiveNamespacesPrefixList)
+		{
+		}
+
+		public XmlNodeList UnprotectedGetInnerXml ()
+		{
 			return base.GetInnerXml ();
 		}
 	}
@@ -63,11 +83,83 @@
 			catch {}
 		}
 
-		[Test]
-		public void Properties () 
+		[Test] // ctor ()
+		public void Constructor1 ()
 		{
 			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+		}
 
+		[Test] // ctor (Boolean)
+		public void Constructor2 ()
+		{
+			transform = new UnprotectedXmlDsigExcC14NTransform (true);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (false);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+		}
+
+		[Test] // ctor (String)
+		public void Constructor3 ()
+		{
+			transform = new UnprotectedXmlDsigExcC14NTransform (null);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (string.Empty);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", string.Empty, transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform ("#default xsd");
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", "#default xsd", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+		}
+
+		[Test] // ctor (Boolean, String)
+		public void Constructor4 ()
+		{
+			transform = new UnprotectedXmlDsigExcC14NTransform (true, null);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (true, string.Empty);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", string.Empty, transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (true, "#default xsd");
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", "#default xsd", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (false, null);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertNull ("InclusiveNamespacesPrefixList", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (false, string.Empty);
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", string.Empty, transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigExcC14NTransform (false, "#default xsd");
+			AssertEquals ("Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#";, transform.Algorithm);
+			AssertEquals ("InclusiveNamespacesPrefixList", "#default xsd", transform.InclusiveNamespacesPrefixList);
+			CheckProperties (transform);
+		}
+
+		void CheckProperties (XmlDsigExcC14NTransform transform)
+		{
 			Type[] input = transform.InputTypes;
 			Assert ("Input #", (input.Length == 3));
 			// check presence of every supported input types
@@ -168,7 +260,7 @@
 
 		[Test]
 #if NET_2_0
-		[Category ("NotDotNet")]
+		[Category ("NotDotNet")]
 		// see LoadInputAsXmlNodeList2 description
 #endif
 		public void LoadInputAsXmlNodeList () 

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs	(working copy)
@@ -22,8 +22,17 @@
 
 	// Note: GetInnerXml is protected in XmlDsigC14NTransform making it
 	// difficult to test properly. This class "open it up" :-)
-	public class UnprotectedXmlDsigC14NTransform : XmlDsigC14NTransform {
+	public class UnprotectedXmlDsigC14NTransform : XmlDsigC14NTransform
+	{
+		public UnprotectedXmlDsigC14NTransform ()
+		{
+		}
 
+		public UnprotectedXmlDsigC14NTransform (bool includeComments)
+			: base (includeComments)
+		{
+		}
+
 		public XmlNodeList UnprotectedGetInnerXml () {
 			return base.GetInnerXml ();
 		}
@@ -52,11 +61,27 @@
 			catch {}
 		}
 
-		[Test]
-		public void Properties () 
+		[Test] // ctor ()
+		public void Constructor1 ()
 		{
 			AssertEquals ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";, transform.Algorithm);
+			CheckProperties (transform);
+		}
 
+		[Test] // ctor (Boolean)
+		public void Constructor2 ()
+		{
+			transform = new UnprotectedXmlDsigC14NTransform (true);
+			AssertEquals ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";, transform.Algorithm);
+			CheckProperties (transform);
+
+			transform = new UnprotectedXmlDsigC14NTransform (false);
+			AssertEquals ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";, transform.Algorithm);
+			CheckProperties (transform);
+		}
+
+		void CheckProperties (XmlDsigC14NTransform transform)
+		{
 			Type[] input = transform.InputTypes;
 			Assert ("Input #", (input.Length == 3));
 			// check presence of every supported input types
@@ -139,7 +164,7 @@
 
 		[Test]
 #if NET_2_0
-		[Category ("NotDotNet")]
+		[Category ("NotDotNet")]
 		// see LoadInputAsXmlNodeList2 description
 #endif
 		public void LoadInputAsXmlNodeList () 

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs	(revision 110022)
+++ Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs	(working copy)
@@ -5,13 +5,13 @@
 // Author:
 //	Sebastien Pouliot <[EMAIL PROTECTED]>
 //
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 
 using System;
-using System.IO;
-using System.Security;
+using System.IO;
+using System.Security;
 using System.Security.Cryptography.Xml;
 using System.Text;
 using System.Xml;
@@ -127,25 +127,25 @@
 			string res = ExecuteXmlDSigC14NTransform (C14NSpecExample1Input, true);
 			AssertEquals ("Example 1 from c14n spec - PIs, Comments, and Outside of Document Element (with comments)", 
 				        C14NSpecExample1Output, res);
-	        }
-
-		[Test]
-#if NET_2_0
-		[ExpectedException (typeof (SecurityException))]
-#endif
-		public void C14NSpecExample1_WithoutResolver ()
-		{
-			using (StreamWriter sw = new StreamWriter ("doc.dtd", false, Encoding.ASCII)) {
-				sw.Write ("<!-- presence, not content, required -->");
-				sw.Close ();
-			}
-#if NET_2_0
-			if (!SecurityManager.SecurityEnabled)
-				NUnit.Framework.Assert.Ignore ("SecurityManager isn't enabled.");
-#endif
-			string res = ExecuteXmlDSigC14NTransform (C14NSpecExample1Input, false);
-			AssertEquals ("Example 1 from c14n spec - PIs, Comments, and Outside of Document Element (with comments)",
-					C14NSpecExample1Output, res);
+	        }
+
+		[Test]
+#if NET_2_0
+		[ExpectedException (typeof (SecurityException))]
+#endif
+		public void C14NSpecExample1_WithoutResolver ()
+		{
+			using (StreamWriter sw = new StreamWriter ("doc.dtd", false, Encoding.ASCII)) {
+				sw.Write ("<!-- presence, not content, required -->");
+				sw.Close ();
+			}
+#if NET_2_0
+			if (!SecurityManager.SecurityEnabled)
+				NUnit.Framework.Assert.Ignore ("SecurityManager isn't enabled.");
+#endif
+			string res = ExecuteXmlDSigC14NTransform (C14NSpecExample1Input, false);
+			AssertEquals ("Example 1 from c14n spec - PIs, Comments, and Outside of Document Element (with comments)",
+					C14NSpecExample1Output, res);
 		}
 
 	        [Test]
@@ -210,8 +210,8 @@
 			vreader.ValidationType = ValidationType.None;
 			vreader.EntityHandling = EntityHandling.ExpandCharEntities;
 			doc.Load (vreader);
-#if NET_2_0
-			if (resolver)
+#if NET_2_0
+			if (resolver)
 				transform.Resolver = new XmlUrlResolver ();
 #endif
 			transform.LoadInput (doc);

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs	(revision 0)
+++ Test/System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs	(revision 0)
@@ -0,0 +1,146 @@
+//
+// XmlDsigExcC14NWithCommentsTransformTest.cs - NUnit Test Cases for
+// XmlDsigExcC14NWithCommentsTransform
+//
+// Author:
+//  original:
+//	Sebastien Pouliot <[EMAIL PROTECTED]>
+//	Aleksey Sanin ([EMAIL PROTECTED])
+//  this file:
+//	Gert Driesen <[EMAIL PROTECTED]>
+//
+// (C) 2003 Aleksey Sanin ([EMAIL PROTECTED])
+// (C) 2004 Novell (http://www.novell.com)
+// (C) 2008 Gert Driesen
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography.Xml
+{
+	public class UnprotectedXmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NWithCommentsTransform
+	{
+		public UnprotectedXmlDsigExcC14NWithCommentsTransform ()
+		{
+		}
+
+		public UnprotectedXmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)
+			: base (inclusiveNamespacesPrefixList)
+		{
+		}
+
+		public XmlNodeList UnprotectedGetInnerXml ()
+		{
+			return base.GetInnerXml ();
+		}
+	}
+
+	[TestFixture]
+	public class XmlDsigExcC14NWithCommentsTransformTest
+	{
+		private UnprotectedXmlDsigExcC14NWithCommentsTransform transform;
+
+		[SetUp]
+		public void SetUp ()
+		{
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
+		}
+
+		[Test] // ctor ()
+		public void Constructor1 ()
+		{
+			CheckProperties (transform);
+			Assert.IsNull (transform.InclusiveNamespacesPrefixList);
+		}
+
+		[Test] // ctor (Boolean)
+		public void Constructor2 ()
+		{
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform (null);
+			CheckProperties (transform);
+			Assert.IsNull (transform.InclusiveNamespacesPrefixList);
+
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform (string.Empty);
+			CheckProperties (transform);
+			Assert.AreEqual (string.Empty, transform.InclusiveNamespacesPrefixList);
+
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ("#default xsd");
+			CheckProperties (transform);
+			Assert.AreEqual ("#default xsd", transform.InclusiveNamespacesPrefixList);
+		}
+
+		void CheckProperties (XmlDsigExcC14NWithCommentsTransform transform)
+		{
+			Assert.AreEqual ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments";,
+				transform.Algorithm, "Algorithm");
+
+			Type[] input = transform.InputTypes;
+			Assert.AreEqual (3, input.Length, "Input #");
+			// check presence of every supported input types
+			bool istream = false;
+			bool ixmldoc = false;
+			bool ixmlnl = false;
+			foreach (Type t in input) {
+				if (t == typeof (Stream))
+					istream = true;
+				if (t == typeof (XmlDocument))
+					ixmldoc = true;
+				if (t == typeof (XmlNodeList))
+					ixmlnl = true;
+			}
+			Assert.IsTrue (istream, "Input Stream");
+			Assert.IsTrue (ixmldoc, "Input XmlDocument");
+			Assert.IsTrue (ixmlnl, "Input XmlNodeList");
+
+			Type[] output = transform.OutputTypes;
+			Assert.AreEqual (1, output.Length, "Output #");
+			Assert.AreEqual (typeof (Stream), output [0], "Output Type");
+		}
+
+		[Test]
+		public void InputTypes ()
+		{
+			Type [] input = transform.InputTypes;
+			input [0] = null;
+			input [1] = null;
+			input [2] = null;
+			// property does not return a clone
+			foreach (Type t in transform.InputTypes)
+				Assert.IsNull (t);
+
+			// it's not a static array
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
+			foreach (Type t in transform.InputTypes)
+				Assert.IsNotNull (t);
+		}
+
+		[Test]
+		public void GetInnerXml ()
+		{
+			XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
+			Assert.IsNull (xnl, "Default InnerXml");
+		}
+
+		[Test]
+		public void OutputTypes ()
+		{
+			// property does not return a clone
+			transform.OutputTypes [0] = null;
+			Assert.IsNull (transform.OutputTypes [0]);
+
+			// it's not a static array
+			transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
+			Assert.IsNotNull (transform.OutputTypes [0]);
+		}
+	}
+}
+
+#endif

Property changes on: Test/System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: Test/System.Security.Cryptography.Xml/XmlLicenseTransformTest.cs
===================================================================
--- Test/System.Security.Cryptography.Xml/XmlLicenseTransformTest.cs	(revision 0)
+++ Test/System.Security.Cryptography.Xml/XmlLicenseTransformTest.cs	(revision 0)
@@ -0,0 +1,96 @@
+//
+// XmlLicenseTransformTest.cs - NUnit Test Cases for XmlLicenseTransform
+//
+// Author:
+//  original:
+//	Sebastien Pouliot <[EMAIL PROTECTED]>
+//	Aleksey Sanin ([EMAIL PROTECTED])
+//  this file:
+//	Gert Driesen <[EMAIL PROTECTED]>
+//
+// (C) 2003 Aleksey Sanin ([EMAIL PROTECTED])
+// (C) 2004 Novell (http://www.novell.com)
+// (C) 2008 Gert Driesen
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography.Xml
+{
+	public class UnprotectedXmlLicenseTransform : XmlLicenseTransform
+	{
+		public XmlNodeList UnprotectedGetInnerXml ()
+		{
+			return base.GetInnerXml ();
+		}
+	}
+
+	[TestFixture]
+	public class XmlLicenseTransformTest
+	{
+		private UnprotectedXmlLicenseTransform transform;
+
+		[SetUp]
+		public void SetUp ()
+		{
+			transform = new UnprotectedXmlLicenseTransform ();
+		}
+
+		[Test] // ctor ()
+		public void Constructor1 ()
+		{
+			Assert.AreEqual ("urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform",
+				transform.Algorithm, "Algorithm");
+			Assert.IsNull (transform.Decryptor, "Decryptor");
+
+			Type[] input = transform.InputTypes;
+			Assert.AreEqual (1, input.Length, "Input #");
+			Assert.AreEqual (typeof (XmlDocument), input [0], "Input Type");
+
+			Type[] output = transform.OutputTypes;
+			Assert.AreEqual (1, output.Length, "Output #");
+			Assert.AreEqual (typeof (XmlDocument), output [0], "Output Type");
+		}
+
+		[Test]
+		public void InputTypes ()
+		{
+			// property does not return a clone
+			transform.InputTypes [0] = null;
+			Assert.IsNull (transform.InputTypes [0]);
+
+			// it's not a static array
+			transform = new UnprotectedXmlLicenseTransform ();
+			Assert.IsNotNull (transform.InputTypes [0]);
+		}
+
+		[Test]
+		public void GetInnerXml ()
+		{
+			XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
+			Assert.IsNull (xnl, "Default InnerXml");
+		}
+
+		[Test]
+		public void OutputTypes ()
+		{
+			// property does not return a clone
+			transform.OutputTypes [0] = null;
+			Assert.IsNull (transform.OutputTypes [0], "#1");
+
+			// it's not a static array
+			transform = new UnprotectedXmlLicenseTransform ();
+			Assert.IsNotNull (transform.OutputTypes [0], "#2");
+		}
+	}
+}
+
+#endif

Property changes on: Test/System.Security.Cryptography.Xml/XmlLicenseTransformTest.cs
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs	(working copy)
@@ -55,7 +55,7 @@
 		public XmlDsigXsltTransform (bool includeComments) 
 		{
 			comments = includeComments;
-			Algorithm = "http://www.w3.org/TR/1999/REC-xslt-19991116";;
+			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXsltTransform;
 		}
 
 		public override Type [] InputTypes {

Property changes on: System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlSignature.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlSignature.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlSignature.cs	(working copy)
@@ -105,6 +105,7 @@
 			public const string XmlDsigExcC14NTransform = "http://www.w3.org/2001/10/xml-exc-c14n#";;
 			public const string XmlDsigExcC14NWithCommentsTransform = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";;
 			public const string XmlDecryptionTransform = "http://www.w3.org/2002/07/decrypt#XML";;
+			public const string XmlLicenseTransform = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
 #endif
 		}
 

Property changes on: System.Security.Cryptography.Xml/XmlSignature.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs	(working copy)
@@ -50,12 +50,12 @@
 		private Stream s;
 		private string inclusiveNamespacesPrefixList;
 		
-		public XmlDsigExcC14NTransform ()	
+		public XmlDsigExcC14NTransform ()
 			: this (false, null)
 		{
 		}
 
-		public XmlDsigExcC14NTransform (bool includeComments) 
+		public XmlDsigExcC14NTransform (bool includeComments)
 			: this (includeComments, null)
 		{
 		}
@@ -67,7 +67,11 @@
 
 		public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)
 		{
-			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform;
+			if (includeComments)
+				Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform;
+			else
+				Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform;
+			this.inclusiveNamespacesPrefixList = inclusiveNamespacesPrefixList;
 			canonicalizer = new XmlCanonicalizer (includeComments, true, PropagatedNamespaces);
 		}
 

Property changes on: System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs	(working copy)
@@ -33,9 +33,8 @@
 
 	public class XmlDsigC14NWithCommentsTransform : XmlDsigC14NTransform {
 
-		public XmlDsigC14NWithCommentsTransform() : base (true) 
+		public XmlDsigC14NWithCommentsTransform() : base (true)
 		{
-			Algorithm = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";;
 		}
 	}
 }

Property changes on: System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs	(working copy)
@@ -45,7 +45,7 @@
 
 		public XmlDsigBase64Transform () 
 		{
-			Algorithm = "http://www.w3.org/2000/09/xmldsig#base64";;
+			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigBase64Transform;
 		}
 
 		public override Type[] InputTypes {

Property changes on: System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/ChangeLog
===================================================================
--- System.Security.Cryptography.Xml/ChangeLog	(revision 110022)
+++ System.Security.Cryptography.Xml/ChangeLog	(working copy)
@@ -1,3 +1,23 @@
+2008-08-08  Gert Driesen  <[EMAIL PROTECTED]>
+
+	* XmlDsigBase64Transform.cs: Use constant for Algorithm namespace.
+	* XmlDsigExcC14NTransform.cs: Fixed ctors to use WithComments
+	algorithm if includeComments is true. Assign includeNamespacesPrefixList
+	to instance field.
+	* XmlDsigExcC14NWithCommentsTransform.cs: Remove unnecessary
+	assignment to Algorithm now that base ctor is fixed.
+	* XmlDsigC14NWithCommentsTransform.cs: Remove unnecessary assignment
+	to Algorithm now that base ctor is fixed.
+	* XmlDsigC14NTransform.cs: In default ctor, just invoke .ctor (bool).
+	In .ctor (bool), assign WithComments algorithm if includeComments is
+	true. Use constants for Algorithm namespace.
+	* XmlDsigEnvelopedSignatureTransform.cs: Use constant for Algorithm
+	namespace.
+	* XmlDsigXPathTransform.cs: Use constant for Algorithm namespace.
+	* XmlDsigXsltTransform.cs: Use constant for Algorithm namespace.
+	* XmlLicenseTransform.cs: Assign Algorithm in ctor.
+	* XmlSignature.cs: Added constant for XmlLicenseTransform algorithm.
+
 2008-08-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
 	* set Algorithm in .ctor(bool), fixed bug #398904.
Index: System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs	(working copy)
@@ -51,7 +51,7 @@
 
 		public XmlDsigEnvelopedSignatureTransform (bool includeComments) 
 		{
-			Algorithm = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";;
+			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform;
 			comments = includeComments;
 		}
 

Property changes on: System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs	(working copy)
@@ -48,14 +48,16 @@
 		private XmlCanonicalizer canonicalizer;
 		private Stream s;
 		
-		public XmlDsigC14NTransform () 
+		public XmlDsigC14NTransform () : this (false)
 		{
-			Algorithm = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";;
-			canonicalizer = new XmlCanonicalizer (false, false, PropagatedNamespaces);
 		}
 
-		public XmlDsigC14NTransform (bool includeComments) 
+		public XmlDsigC14NTransform (bool includeComments)
 		{
+			if (includeComments)
+				Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform;
+			else
+				Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NTransform;
 			canonicalizer = new XmlCanonicalizer (includeComments, false, PropagatedNamespaces);
 		}
 

Property changes on: System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs	(working copy)
@@ -37,7 +37,6 @@
 		public XmlDsigExcC14NWithCommentsTransform ()
 			: base (true)
 		{
-			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform;
 		}
 
 		public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)

Property changes on: System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlLicenseTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlLicenseTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlLicenseTransform.cs	(working copy)
@@ -40,6 +40,7 @@
 
 		public XmlLicenseTransform ()
 		{
+			Algorithm = XmlSignature.AlgorithmNamespaces.XmlLicenseTransform;
 		}
 
 		public IRelDecryptor Decryptor {

Property changes on: System.Security.Cryptography.Xml/XmlLicenseTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
===================================================================
--- System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs	(revision 110022)
+++ System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs	(working copy)
@@ -51,9 +51,9 @@
 		private XmlDocument doc;
 		private XsltContext ctx;
 
-		public XmlDsigXPathTransform () 
+		public XmlDsigXPathTransform ()
 		{
-			Algorithm = "http://www.w3.org/TR/1999/REC-xpath-19991116";;
+			Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXPathTransform;
 		}
 
 		public override Type [] InputTypes {

Property changes on: System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Index: System.Security_test.dll.sources
===================================================================
--- System.Security_test.dll.sources	(revision 110022)
+++ System.Security_test.dll.sources	(working copy)
@@ -42,8 +42,10 @@
 System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs
+System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigXPathTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
+System.Security.Cryptography.Xml/XmlLicenseTransformTest.cs
 System.Security.Cryptography.X509Certificates/X509Certificate2UITest.cs
 System.Security.Permissions/DataProtectionPermissionAttributeTest.cs
 System.Security.Cryptography/CryptographicAttributeObjectCas.cs
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 110022)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2008-08-09  Gert Driesen  <[EMAIL PROTECTED]>
+
+	* System.Security_test.dll.sources: Added XmlLicenseTransformTest.cs
+	and  XmlDsigExcC14NWithCommentsTransformTest.cs.
+
 2007-06-12  Marek Safar <[EMAIL PROTECTED]>
 
 	* Makefile: Check only major framework version to do 2.x build.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to