Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -10,6 +10,7 @@
//
using System;
using System.Collections;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
@@ -117,11 +118,7 @@ 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>";
@@ -158,15 +155,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
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.IsTrue (result, "Exception not thrown");
@@ -174,11 +166,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
}
[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\">";
@@ -256,7 +244,19 @@ namespace MonoTests.System.Security.Cryptography.Xml {
XmlDocument doc = GetXslDoc ();
transform.LoadInnerXml (doc.DocumentElement.ChildNodes);
XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
Assert.AreEqual (doc.DocumentElement.ChildNodes, xnl, "LoadInnerXml");
AssertNodeListEqual (doc.DocumentElement.ChildNodes, xnl, "LoadInnerXml");
}
void AssertNodeListEqual (XmlNodeList nl1, XmlNodeList nl2, string label)
{
Assert.AreEqual (nl1.Count, nl2.Count, label + ": node count");
IEnumerator e1, e2;
int i;
for (i = 0, e1 = nl1.GetEnumerator (), e2 = nl2.GetEnumerator (); e1.MoveNext (); i++) {
Assert.IsTrue (e2.MoveNext (), label + " : nl2.MoveNext");
Assert.AreEqual (e1.Current, e2.Current, label + " : node at " + i);
}
Assert.IsFalse (e2.MoveNext (), label + " : nl2 has extras");
}
[Test]