* Tests inherits from Assertion and Assertion. prefix is removed
[mono.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Xml / AssertCrypto.cs
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 //
9
10 using System;
11 using System.Security.Cryptography;
12
13 using NUnit.Framework;
14
15 namespace MonoTests.System.Security.Cryptography.Xml {
16
17         public class AssertCrypto : Assertion {
18
19                 // because most crypto stuff works with byte[] buffers
20                 static public void AssertEquals (string msg, byte[] array1, byte[] array2) 
21                 {
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");
28
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;
35                                         }
36                                 }
37                         }
38                         msg += " -> Expected " + BitConverter.ToString (array1, 0);
39                         msg += " is different than " + BitConverter.ToString (array2, 0);
40                         Assert (msg, a);
41                 }
42         }
43 }