2 // TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
\r
5 // Mark Crichton (crichton@gimp.org)
\r
10 using System.Security.Cryptography;
\r
12 using NUnit.Framework;
\r
14 namespace MonoTests.System.Security.Cryptography {
\r
16 public class RNGCryptoServiceProviderTest : TestCase {
\r
17 private RNGCryptoServiceProvider _algo;
\r
19 public RNGCryptoServiceProviderTest() : base ("MonoTests.System.Security.Cryptography.RNGCryptoServiceProviderTest testcase") {
\r
22 public RNGCryptoServiceProviderTest(String name) : base(name) {
\r
26 public static ITest Suite {
\r
28 return new TestSuite(typeof(RNGCryptoServiceProviderTest));
\r
32 protected override void SetUp() {
\r
33 _algo = new RNGCryptoServiceProvider();
\r
36 private void SetDefaultData() {
\r
39 public void TestProperties() {
\r
40 Assert("Properties (1)", _algo != null);
\r
42 byte[] random = new Byte[25];
\r
44 // The C code doesn't throw an exception yet.
\r
45 _algo.GetBytes(random);
\r
47 // This one we can check...
\r
48 _algo.GetNonZeroBytes(random);
\r
50 foreach (Byte rnd_byte in random) {
\r
51 Assert("Properties (2)", rnd_byte != 0);
\r