2 // KeyInfoNodeTest.cs - NUnit Test Cases for KeyInfoNode
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
11 using System.Security.Cryptography;
12 using System.Security.Cryptography.Xml;
15 using NUnit.Framework;
17 namespace MonoTests.System.Security.Cryptography.Xml {
20 public class KeyInfoNodeTest : Assertion {
23 public void NewKeyNode ()
25 string test = "<Test></Test>";
26 XmlDocument doc = new XmlDocument ();
29 KeyInfoNode node1 = new KeyInfoNode ();
30 node1.Value = doc.DocumentElement;
31 XmlElement xel = node1.GetXml ();
33 KeyInfoNode node2 = new KeyInfoNode (node1.Value);
36 AssertEquals ("node1==node2", (node1.GetXml ().OuterXml), (node2.GetXml ().OuterXml));
40 public void ImportKeyNode ()
42 // Note: KeyValue is a valid KeyNode
43 string value = "<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">Mono::</KeyName>";
44 XmlDocument doc = new XmlDocument ();
47 KeyInfoNode node1 = new KeyInfoNode ();
48 node1.LoadXml (doc.DocumentElement);
50 string s = (node1.GetXml ().OuterXml);
51 AssertEquals ("Node", value, s);
54 // well there's no invalid value - unless you read the doc ;-)
56 public void InvalidKeyNode ()
58 string bad = "<Test></Test>";
59 XmlDocument doc = new XmlDocument ();
62 KeyInfoNode node1 = new KeyInfoNode ();
63 // LAMESPEC: No ArgumentNullException is thrown if value == null
65 AssertNull ("Value==null", node1.Value);