| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // CryptographicAttributeTest.cs - NUnit tests for CryptographicAttribute
- //
- // Author:
- // Sebastien Pouliot ([email protected])
- //
- // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
- //
- #if NET_1_2
- using NUnit.Framework;
- using System;
- using System.Collections;
- using System.Security.Cryptography;
- using System.Security.Cryptography.Pkcs;
- namespace MonoTests.System.Security.Cryptography.Pkcs {
- [TestFixture]
- public class CryptographicAttributeTest : Assertion {
- static string defaultOid = "1.2.840.113549.1.7.1";
- static string defaultName = "PKCS 7 Data";
- [Test]
- public void ConstructorOid ()
- {
- Oid o = new Oid (defaultOid);
- CryptographicAttribute ca = new CryptographicAttribute (o);
- AssertEquals ("Oid.FriendlyName", defaultName, ca.Oid.FriendlyName);
- AssertEquals ("Oid.Value", defaultOid, ca.Oid.Value);
- AssertEquals ("Values", 0, ca.Values.Count);
- }
- [Test]
- //BUG [ExpectedException (typeof (ArgumentNullException))]
- public void ConstructorOidNull ()
- {
- CryptographicAttribute ca = new CryptographicAttribute (null);
- }
- [Test]
- public void ConstructorOidArrayList ()
- {
- Oid o = new Oid (defaultOid);
- ArrayList al = new ArrayList ();
- CryptographicAttribute ca = new CryptographicAttribute (o, al);
- AssertEquals ("Oid.FriendlyName", defaultName, ca.Oid.FriendlyName);
- AssertEquals ("Oid.Value", defaultOid, ca.Oid.Value);
- AssertEquals ("Values", 0, ca.Values.Count);
- }
- [Test]
- //BUG [ExpectedException (typeof (ArgumentNullException))]
- public void ConstructorOidNullArrayList ()
- {
- ArrayList al = new ArrayList ();
- CryptographicAttribute ca = new CryptographicAttribute (null, al);
- }
- [Test]
- //BUG [ExpectedException (typeof (ArgumentNullException))]
- [ExpectedException (typeof (NullReferenceException))]
- public void ConstructorOidArrayListNull ()
- {
- Oid o = new Oid (defaultOid);
- ArrayList al = null; // do not confuse compiler
- CryptographicAttribute ca = new CryptographicAttribute (o, al);
- }
- [Test]
- public void ConstructorOidObject ()
- {
- Oid o = new Oid (defaultOid);
- CryptographicAttribute ca = new CryptographicAttribute (o, o);
- AssertEquals ("Oid.FriendlyName", defaultName, ca.Oid.FriendlyName);
- AssertEquals ("Oid.Value", defaultOid, ca.Oid.Value);
- AssertEquals ("Values", 1, ca.Values.Count);
- }
- [Test]
- //BUG [ExpectedException (typeof (ArgumentNullException))]
- public void ConstructorOidNullObject ()
- {
- Oid o = new Oid (defaultOid);
- CryptographicAttribute ca = new CryptographicAttribute (null, o);
- }
- [Test]
- //BUG [ExpectedException (typeof (ArgumentNullException))]
- public void ConstructorOidObjectNull ()
- {
- Oid o = new Oid (defaultOid);
- object obj = null; // do not confuse compiler
- CryptographicAttribute ca = new CryptographicAttribute (o, obj);
- }
- }
- }
- #endif
|