* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Xml / XmlDsigXsltTransformTest.cs
index d07004c5c5d20ab096fb893aef6f179d867e1216..5d835ac7018a94306ee1d8b9f367cc040252dcff 100644 (file)
@@ -3,6 +3,7 @@
 //
 // Author:
 //     Sebastien Pouliot <sebastien@ximian.com>
+//     Atsushi Enomoto <atsushi@ximian.com>
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
 // (C) 2004 Novell (http://www.novell.com)
@@ -94,7 +95,11 @@ namespace MonoTests.System.Security.Cryptography.Xml {
 
 
                [Test]
+#if NET_2_0
+               [ExpectedException (typeof (ArgumentNullException))]
+#else
                [ExpectedException (typeof (NullReferenceException))]
+#endif
                public void EmptyXslt () 
                {
                        string test = "<Test>XmlDsigXsltTransform</Test>";
@@ -110,7 +115,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                // (see XSLT spec 2.7)
                public void EmbeddedStylesheet () 
                {
-                       string test = "<Test xsl:version='1.0'>XmlDsigXsltTransform</Test>";
+                       string test = "<Test xsl:version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>XmlDsigXsltTransform</Test>";
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml (test);
 
@@ -120,19 +125,38 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                }
 
                [Test]
-               [ExpectedException (typeof (XsltCompileException))]
                public void InvalidXslt () 
                {
-                       string test = "<xsl:element name='foo' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>XmlDsigXsltTransform</xsl:element>";
-                       XmlDocument doc = new XmlDocument ();
-                       doc.LoadXml (test);
+                       bool result = false;
+                       try {
+                               string test = "<xsl:element name='foo' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>XmlDsigXsltTransform</xsl:element>";
+                               XmlDocument doc = new XmlDocument ();
+                               doc.LoadXml (test);
 
-                       transform.LoadInnerXml (doc.ChildNodes);
-                       Stream s = (Stream) transform.GetOutput ();
+                               transform.LoadInnerXml (doc.ChildNodes);
+                               Stream s = (Stream) transform.GetOutput ();
+                       }
+#if NET_2_0
+                       catch (Exception e) {
+                               // we must deal with an internal exception
+                               result = (e.GetType ().ToString ().EndsWith ("XsltLoadException"));
+                               result = true;
+#else
+                       catch (XsltCompileException) {
+                               result = true;
+#endif
+                       }
+                       finally {
+                               Assert ("Exception not thrown", result);
+                       }
                }
 
                [Test]
+#if NET_2_0
+               [ExpectedException (typeof (ArgumentNullException))]
+#else
                [ExpectedException (typeof (NullReferenceException))]
+#endif
                public void OnlyInner () 
                {
                        string test = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns=\"http://www.w3.org/TR/xhtml1/strict\" version=\"1.0\">";