2 // MonoTests.System.Security.Cryptography.Xml.AssertCrypto.cs
5 // Sebastien Pouliot <sebastien@ximian.com>
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
12 using System.Security.Cryptography;
14 using NUnit.Framework;
16 namespace MonoTests.System.Security.Cryptography.Xml {
18 public class AssertCrypto : Assertion {
20 // because most crypto stuff works with byte[] buffers
21 static public void AssertEquals (string msg, byte[] array1, byte[] array2)
23 if ((array1 == null) && (array2 == null))
26 Fail (msg + " -> First array is NULL");
28 Fail (msg + " -> Second array is NULL");
30 bool a = (array1.Length == array2.Length);
32 for (int i = 0; i < array1.Length; i++) {
33 if (array1 [i] != array2 [i]) {
39 msg += " -> Expected " + BitConverter.ToString (array1, 0);
40 msg += " is different than " + BitConverter.ToString (array2, 0);
44 private const string xmldsig = " xmlns=\"http://www.w3.org/2000/09/xmldsig#\"";
46 // not to be used to test C14N output
47 static public void AssertXmlEquals (string msg, string expected, string actual)
49 expected = expected.Replace (xmldsig, String.Empty);
50 actual = actual.Replace (xmldsig, String.Empty);
51 AssertEquals (msg, expected, actual);