Removal of NET_1_1 defines and some NET_2_0; Both defines are true these days in...
[mono.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Xml / KeyInfoRetrievalMethodTest.cs
index b3ca3993c61c8185fd6ee6a230c8af6865b3ee85..140bdc7b589c0cc2734e373838166c14abdfe657 100644 (file)
@@ -2,9 +2,10 @@
 // KeyInfoRetrievalMethodTest.cs - NUnit Test Cases for KeyInfoRetrievalMethod
 //
 // Author:
-//     Sebastien Pouliot (spouliot@motus.com)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 
 using System;
@@ -19,29 +20,40 @@ namespace MonoTests.System.Security.Cryptography.Xml {
        [TestFixture]
        public class KeyInfoRetrievalMethodTest {
 
+               [Test]
+               public void TestNewEmptyKeyNode () 
+               {
+                       KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
+#if NET_1_0
+                       Assert.AreEqual ("<RetrievalElement xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml), "Empty");
+#else
+                       Assert.AreEqual ("<RetrievalMethod xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml), "Empty");
+#endif
+               }
+
                [Test]
                public void TestNewKeyNode () 
                {
                        string uri = "http://www.go-mono.com/";
                        KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
-
-                       // verify empty XML
-                       Assertion.AssertEquals ("Empty", "<RetrievalElement xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml));
-
                        uri1.Uri = uri;
                        XmlElement xel = uri1.GetXml ();
 
                        KeyInfoRetrievalMethod uri2 = new KeyInfoRetrievalMethod (uri1.Uri);
                        uri2.LoadXml (xel);
 
-                       Assertion.AssertEquals ("uri1==uri2", (uri1.GetXml ().OuterXml), (uri2.GetXml ().OuterXml));
-                       Assertion.AssertEquals ("uri==Uri", uri, uri1.Uri);
+                       Assert.AreEqual ((uri1.GetXml ().OuterXml), (uri2.GetXml ().OuterXml), "uri1==uri2");
+                       Assert.AreEqual (uri, uri1.Uri, "uri==Uri");
                }
 
                [Test]
                public void TestImportKeyNode () 
                {
+#if NET_1_0
                        string value = "<RetrievalElement URI=\"http://www.go-mono.com/\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />";
+#else
+                       string value = "<RetrievalMethod URI=\"http://www.go-mono.com/\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />";
+#endif
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml (value);
 
@@ -50,10 +62,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
 
                        // verify that proper XML is generated (equals to original)
                        string s = (uri1.GetXml ().OuterXml);
-                       Assertion.AssertEquals ("Xml", value, s);
+                       Assert.AreEqual (value, s, "Xml");
 
                        // verify that property is parsed correctly
-                       Assertion.AssertEquals ("Uri", "http://www.go-mono.com/", uri1.Uri);
+                       Assert.AreEqual ("http://www.go-mono.com/", uri1.Uri, "Uri");
                }
 
                [Test]
@@ -74,8 +86,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
                        // no exception is thrown
                        uri1.LoadXml (doc.DocumentElement);
-                       // note that URI="" is present (unlike a empty Uri)
-                       Assertion.AssertEquals("invalid", "<RetrievalElement URI=\"\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml));
+                       AssertCrypto.AssertXmlEquals ("invalid", "<RetrievalMethod xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml));
                }
        }
-}
\ No newline at end of file
+}