blob: f9d16d58df1635181bc926f371f437d3e86da7eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
//
// TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
//
// Author:
// Mark Crichton (crichton@gimp.org)
//
using System;
using System.Security.Cryptography;
using NUnit.Framework;
namespace MonoTests.System.Security.Cryptography {
public class RNGCryptoServiceProviderTest : TestCase {
private RNGCryptoServiceProvider _algo;
public RNGCryptoServiceProviderTest() : base ("MonoTests.System.Security.Cryptography.RNGCryptoServiceProviderTest testcase") {
_algo = null;
}
public RNGCryptoServiceProviderTest(String name) : base(name) {
_algo = null;
}
public static ITest Suite {
get {
return new TestSuite(typeof(RNGCryptoServiceProviderTest));
}
}
protected override void SetUp() {
_algo = new RNGCryptoServiceProvider();
}
private void SetDefaultData() {
}
public void TestProperties() {
Assert("Properties (1)", _algo != null);
byte[] random = new Byte[25];
// The C code doesn't throw an exception yet.
_algo.GetBytes(random);
// This one we can check...
_algo.GetNonZeroBytes(random);
foreach (Byte rnd_byte in random) {
Assert("Properties (2)", rnd_byte != 0);
}
}
}
}
|