//
// 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)
[Test]
+#if NET_2_0
+ [ExpectedException (typeof (ArgumentNullException))]
+#else
[ExpectedException (typeof (NullReferenceException))]
+#endif
public void EmptyXslt ()
{
string test = "<Test>XmlDsigXsltTransform</Test>";
// (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);
}
[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\">";