| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
- //
- // Author:
- // Mark Crichton ([email protected])
- //
- using System;
- using System.Security.Cryptography;
- using NUnit.Framework;
- namespace MonoTests.System.Security.Cryptography {
- public class RNGCryptoServiceProviderTest : TestCase {
- private RNGCryptoServiceProvider _algo;
-
- 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);
- }
- }
- }
- }
|