**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Xml / AssertCrypto.cs
blob30536d5c38ba361e74451c506eeb678dd308ccc6
1 //
2 // MonoTests.System.Security.Cryptography.Xml.AssertCrypto.cs
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
10 using System;
11 using System.Security.Cryptography;
13 using NUnit.Framework;
15 namespace MonoTests.System.Security.Cryptography.Xml {
17 public class AssertCrypto : Assertion {
19 // because most crypto stuff works with byte[] buffers
20 static public void AssertEquals (string msg, byte[] array1, byte[] array2)
22 if ((array1 == null) && (array2 == null))
23 return;
24 if (array1 == null)
25 Fail (msg + " -> First array is NULL");
26 if (array2 == null)
27 Fail (msg + " -> Second array is NULL");
29 bool a = (array1.Length == array2.Length);
30 if (a) {
31 for (int i = 0; i < array1.Length; i++) {
32 if (array1 [i] != array2 [i]) {
33 a = false;
34 break;
38 msg += " -> Expected " + BitConverter.ToString (array1, 0);
39 msg += " is different than " + BitConverter.ToString (array2, 0);
40 Assert (msg, a);