diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2005-05-02 16:51:40 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2005-05-02 16:51:40 +0400 |
commit | 916f45692e061ee978c69dd0b66b97497913ab3e (patch) | |
tree | 0e82c86ba43e89f02b90a6fa333d5d9273f433f7 /mcs | |
parent | 34c5f802962e5f8bba8232ad57ffb85a4394644e (diff) |
2005-05-02 Sebastien Pouliot <sebastien@ximian.com>
* SignedXmlTest.cs: AddObject and AddReference now throws
ArgumentNullException in 2.0.
* XmlDsigC14NWithCommentsTransformTest.cs: InputType was fixed in 2.0.
* XmlDsigC14NTransformTest.cs: InputType was fixed in 2.0.
* XmlDsigXsltTransformTest.cs: Fixed tests for 2.0, InputType, Empty
XSLT and invalid XSLT (new exception).
svn path=/trunk/mcs/; revision=43877
Diffstat (limited to 'mcs')
5 files changed, 65 insertions, 9 deletions
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog index 3d7fd148f2a..16d4a2acc06 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog @@ -1,3 +1,12 @@ +2005-05-02 Sebastien Pouliot <sebastien@ximian.com> + + * SignedXmlTest.cs: AddObject and AddReference now throws + ArgumentNullException in 2.0. + * XmlDsigC14NWithCommentsTransformTest.cs: InputType was fixed in 2.0. + * XmlDsigC14NTransformTest.cs: InputType was fixed in 2.0. + * XmlDsigXsltTransformTest.cs: Fixed tests for 2.0, InputType, Empty + XSLT and invalid XSLT (new exception). + 2005-04-28 Sebastien Pouliot <sebastien@ximian.com> * XmlDsigXPathTransformTest.cs: Marked FunctionHereObsolete (ignored) diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs index 900d992eb69..b216bcf4cea 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs @@ -363,8 +363,24 @@ namespace MonoTests.System.Security.Cryptography.Xml { AsymmetricAlgorithm aa2 = sxe.PublicGetPublicKey (); AssertNull ("Second Public Key is null", aa2); } +#if NET_2_0 + [Test] + [ExpectedException (typeof (ArgumentNullException))] + public void AddObject_Null () + { + SignedXml sx = new SignedXml (); + sx.AddObject (null); + } [Test] + [ExpectedException (typeof (ArgumentNullException))] + public void AddReference_Null () + { + SignedXml sx = new SignedXml (); + sx.AddReference (null); + } +#else + [Test] public void Add_Null () { SignedXml sx = new SignedXml (); @@ -372,7 +388,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { sx.AddObject (null); sx.AddReference (null); } - +#endif [Test] [ExpectedException (typeof (CryptographicException))] public void GetXml_WithoutInfo () diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs index 4da4c5b1dc1..e1cf3cb7596 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs @@ -177,10 +177,14 @@ namespace MonoTests.System.Security.Cryptography.Xml { } [Test] +#if NET_2_0 + [ExpectedException (typeof (ArgumentException))] +#else + // LAMESPEC: input MUST be one of InputType - but no exception is thrown (not documented) +#endif public void LoadInputWithUnsupportedType () { byte[] bad = { 0xBA, 0xD }; - // LAMESPEC: input MUST be one of InputType - but no exception is thrown (not documented) transform.LoadInput (bad); } diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs index 4b9b69c6586..c7f5b802265 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs @@ -92,7 +92,11 @@ namespace MonoTests.System.Security.Cryptography.Xml { AssertEquals ("Default InnerXml", null, xnl); } - [Test] +#if NET_2_0 + [ExpectedException (typeof (ArgumentException))] +#else + // LAMESPEC: input MUST be one of InputType - but no exception is thrown (not documented) +#endif public void LoadInputWithUnsupportedType () { byte[] bad = { 0xBA, 0xD }; 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 865d74b5fe4..5d835ac7018 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 @@ -95,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>"; @@ -121,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\">"; |