Files
acceptance-tests
data
debian
docs
external
ikvm-native
libgc
llvm
m4
man
mcs
build
class
Accessibility
Commons.Xml.Relaxng
Cscompmgd
CustomMarshalers
Facades
I18N
IBM.Data.DB2
ICSharpCode.SharpZipLib
Microsoft.Build
Microsoft.Build.Engine
Microsoft.Build.Framework
Microsoft.Build.Tasks
Microsoft.Build.Utilities
Microsoft.CSharp
Microsoft.NuGet.Build.Tasks
Microsoft.VisualC
Microsoft.Web.Infrastructure
MicrosoftAjaxLibrary
Mono.Btls.Interface
Mono.C5
Mono.CSharp
Mono.Cairo
Mono.Cecil
Mono.Cecil.Mdb
Mono.CodeContracts
Mono.CompilerServices.SymbolWriter
Mono.Data.Sqlite
Mono.Data.Tds
Mono.Debugger.Soft
Mono.Http
Mono.Management
Mono.Messaging
Mono.Messaging.RabbitMQ
Mono.Options
Mono.Parallel
Mono.Posix
Mono.Profiler.Log
Mono.Runtime.Tests
Mono.Security
Mono.Security.Win32
Mono.Simd
Mono.Tasklets
Mono.WebBrowser
Mono.XBuild.Tasks
Novell.Directory.Ldap
PEAPI
RabbitMQ.Client
SMDiagnostics
System
System.ComponentModel.Composition.4.5
System.ComponentModel.DataAnnotations
System.Configuration
System.Configuration.Install
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Linq
System.Data.OracleClient
System.Data.Services
System.Data.Services.Client
System.Deployment
System.Design
System.DirectoryServices
System.DirectoryServices.Protocols
System.Drawing
System.Drawing.Design
System.Dynamic
System.EnterpriseServices
System.IO.Compression
System.IO.Compression.FileSystem
System.IdentityModel
System.IdentityModel.Selectors
System.Json
System.Json.Microsoft
System.Management
System.Messaging
System.Net
System.Net.Http
System.Net.Http.Formatting
System.Net.Http.WebRequest
System.Net.Http.WinHttpHandler
System.Numerics
System.Numerics.Vectors
System.Reactive.Core
System.Reactive.Debugger
System.Reactive.Experimental
System.Reactive.Interfaces
System.Reactive.Linq
System.Reactive.Observable.Aliases
System.Reactive.PlatformServices
System.Reactive.Providers
System.Reactive.Runtime.Remoting
System.Reactive.Windows.Forms
System.Reactive.Windows.Threading
System.Reflection.Context
System.Runtime.Caching
System.Runtime.CompilerServices.Unsafe
System.Runtime.DurableInstancing
System.Runtime.Remoting
System.Runtime.Serialization
System.Runtime.Serialization.Formatters.Soap
System.Security
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.Web
System.ServiceProcess
System.Threading.Tasks.Dataflow
System.Transactions
System.Web
System.Web.Abstractions
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Extensions
System.Web.Extensions.Design
System.Web.Http
System.Web.Http.SelfHost
System.Web.Http.WebHost
System.Web.Mobile
System.Web.Mvc3
System.Web.Razor
System.Web.RegularExpressions
System.Web.Routing
System.Web.Services
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Windows
System.Windows.Forms
System.Windows.Forms.DataVisualization
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.XML
System.Xaml
System.Xml.Linq
System.Xml.Serialization
SystemWebTestShim
WebMatrix.Data
WindowsBase
aot-compiler
corlib
Assembly
CommonCrypto
CoreFoundation
Documentation
LinkerDescriptor
Microsoft.Win32
Mono
Mono.Globalization.Unicode
Mono.Interop
Mono.Security
Mono.Security.Cryptography
Mono.Xml
ReferenceSources
System
System.Configuration.Assemblies
System.Deployment.Internal
System.Diagnostics
System.Diagnostics.SymbolStore
System.Diagnostics.Tracing
System.Globalization
System.IO
System.IO.IsolatedStorage
System.Reflection
System.Reflection.Emit
System.Reflection.Metadata
System.Resources
System.Runtime
System.Runtime.CompilerServices
System.Runtime.Hosting
System.Runtime.InteropServices
System.Runtime.InteropServices.RuntimeInformation
System.Runtime.InteropServices.WindowsRuntime
System.Runtime.Remoting
System.Runtime.Remoting.Activation
System.Runtime.Remoting.Channels
System.Runtime.Remoting.Contexts
System.Runtime.Remoting.Lifetime
System.Runtime.Remoting.Messaging
System.Runtime.Remoting.Metadata
System.Runtime.Remoting.Metadata.W3cXsd2001
System.Runtime.Remoting.Proxies
System.Runtime.Remoting.Services
System.Runtime.Versioning
System.Security
System.Security.AccessControl
System.Security.Cryptography
System.Security.Cryptography.X509Certificates
System.Security.Permissions
System.Security.Policy
System.Security.Principal
System.Text
System.Threading
System.Threading.Tasks
Test
Microsoft.Win32
Mono
System
System.Collections
System.Collections.Concurrent
System.Collections.Generic
System.Collections.ObjectModel
System.Diagnostics
System.Diagnostics.Contracts
System.Globalization
System.IO
System.IO.IsolatedStorage
System.Reflection
System.Reflection.Emit
System.Resources
System.Runtime.CompilerServices
System.Runtime.ExceptionServices
System.Runtime.InteropServices
System.Runtime.Remoting
System.Runtime.Remoting.Channels
System.Runtime.Remoting.Contexts
System.Runtime.Remoting.Messaging
System.Runtime.Remoting.Metadata.W3cXsd2001
System.Runtime.Remoting.Proxies
System.Runtime.Serialization
System.Runtime.Serialization.Formatters.Binary
System.Runtime.Versioning
System.Security
System.Security.AccessControl
System.Security.Claims
System.Security.Cryptography
AesCfbTest.cs
AllTests2.cs
AsymmetricAlgorithmTest.cs
CfbTest.cs
CipherModeTest.cs
CryptoAPITransformCas.cs
CryptoConfigCas.cs
CryptoConfigTest.cs
CryptoStreamTest.cs
CspParametersTest.cs
CspProviderFlagsTest.cs
DESCryptoServiceProviderTest.cs
DESTest.cs.REMOVED.git-id
DSACryptoServiceProviderTest.cs
DSASignatureDeformatterTest.cs
DSASignatureFormatterTest.cs
DSATest.cs
DesCfbTest.cs
FromBase64Transform.cs
HMACMD5Test.cs
HMACRIPEMD160Test.cs
HMACSHA1Test.cs
HMACSHA256Test.cs
HMACSHA384Test.cs
HMACSHA512Test.cs
HashAlgorithmTestBase.cs
HashAlgorithmTestImpl.cs
KeyedHashAlgorithmTest.cs
MACTripleDESTest.cs
MD5Test.cs
PKCS1MaskGenerationMethodTest.cs
PaddingModeTest.cs
PasswordDeriveBytesTest.cs
RC2CryptoServiceProviderTest.cs
RC2Test.cs
RIPEMD160ManagedTest.cs
RIPEMD160Test.cs
RNGCryptoServiceProviderTest.cs
RSACryptoServiceProviderTest.cs.REMOVED.git-id
RSAOAEPKeyExchangeDeformatterTest.cs
RSAOAEPKeyExchangeFormatterTest.cs
RSAPKCS1KeyExchangeDeformatterTest.cs
RSAPKCS1KeyExchangeFormatterTest.cs
RSAPKCS1SignatureDeformatterTest.cs
RSAPKCS1SignatureFormatterTest.cs
RSATest.cs
RandomNumberGeneratorTest.cs
Rc2CfbTest.cs
Rfc2898DeriveBytesTest.cs
RijndaelCfbTest.cs.REMOVED.git-id
RijndaelManagedTest.cs
RijndaelTest.cs
SHA1CryptoServiceProviderTest.cs
SHA1TestBase.cs
SHA1TestImpl.cs
SHA256ManagedTest.cs
SHA256TestBase.cs
SHA256TestImpl.cs
SHA384ManagedTest.cs
SHA384TestBase.cs
SHA384TestImpl.cs
SHA512ManagedTest.cs
SHA512TestBase.cs
SHA512TestImpl.cs
SignatureDescriptionTest.cs
SymmetricAlgorithm2Test.cs
SymmetricAlgorithmTest.cs.REMOVED.git-id
SymmetricAlgorithmTransformTest.cs
ToBase64TransformTest.cs
TripleDESCryptoServiceProviderTest.cs
TripleDESTest.cs
TripleDesCfbTest.cs
System.Security.Cryptography.X509Certificates
System.Security.Permissions
System.Security.Policy
System.Security.Principal
System.Text
System.Threading
System.Threading.Tasks
resources
coreclr
corefx
corert
il
resources
Makefile
corlib.dll.sources
corlib_test.dll.sources
monotouch_corlib.dll.exclude.sources
monotouch_corlib.dll.sources
monotouch_runtime_corlib.dll.exclude.sources
monotouch_runtime_corlib.dll.sources
monotouch_tv_corlib.dll.exclude.sources
monotouch_tv_corlib.dll.sources
monotouch_tv_runtime_corlib.dll.exclude.sources
monotouch_tv_runtime_corlib.dll.sources
monotouch_watch_corlib.dll.exclude.sources
monotouch_watch_corlib.dll.sources
monotouch_watch_runtime_corlib.dll.exclude.sources
monotouch_watch_runtime_corlib.dll.sources
net_4_x_corlib.dll.sources
xammac_corlib.dll.exclude.sources
xammac_corlib.dll.sources
dlr
doc
legacy
lib
monodoc
notes
reference-assemblies
referencesource
test-helpers
LICENSE
Makefile
Open.snk
README
ecma.pub
mono.pub
mono.snk
msfinal.pub
reactive.pub
silverlight.pub
winfx.pub
winfx3.pub
docs
errors
ilasm
jay
mcs
nunit24
packages
tests
tools
AUTHORS
COPYING
INSTALL.txt
Makefile
MonoIcon.png
README
ScalableMonoIcon.svg
mkinstalldirs
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs

101 lines
2.1 KiB
C#
Raw Normal View History

//
// TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
//
// Authors:
// Mark Crichton (crichton@gimp.org)
// Sebastien Pouliot (sebastien@ximian.com)
//
// Copyright (C) 2004 Novell (http://www.novell.com)
//
using System;
using System.Security.Cryptography;
using NUnit.Framework;
namespace MonoTests.System.Security.Cryptography {
[TestFixture]
public class RNGCryptoServiceProviderTest {
private RNGCryptoServiceProvider _algo;
[SetUp]
public void SetUp ()
{
_algo = new RNGCryptoServiceProvider ();
}
[Test]
public void ConstructorByteArray ()
{
byte[] array = new byte [16];
byte[] seed = (byte[]) array.Clone ();
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (seed);
Assert.AreEqual (BitConverter.ToString (array), BitConverter.ToString (seed), "Seed");
}
[Test]
public void ConstructorByteArray_Null ()
{
byte[] array = null;
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (array);
}
[Test]
public void ConstructorCsp_Null ()
{
CspParameters csp = null;
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (csp);
}
[Test]
public void ConstructorString ()
{
string s = "Mono seed";
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (s);
}
[Test]
public void ConstructorString_Null ()
{
string s = null;
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (s);
}
[Test]
public void GetBytes ()
{
byte[] random = new byte [25];
// The C code doesn't throw an exception yet.
_algo.GetBytes (random);
}
[Test]
public void GetNonZeroBytes ()
{
byte[] random = new byte [25];
// This one we can check...
_algo.GetNonZeroBytes (random);
foreach (Byte rnd_byte in random) {
Assert.IsTrue(rnd_byte != 0);
}
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetBytesNull ()
{
_algo.GetBytes (null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetNonZeroBytesNull ()
{
_algo.GetNonZeroBytes (null);
}
}
}