[bcl] Remove more NET_2_0 checks from class libs
[mono.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Pkcs / CryptographicAttributeTest.cs
1 //
2 // CryptographicAttributeTest.cs - NUnit tests for CryptographicAttribute
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10
11 using NUnit.Framework;
12
13 using System;
14 using System.Collections;
15 using System.Security.Cryptography;
16 using System.Security.Cryptography.Pkcs;
17
18 namespace MonoTests.System.Security.Cryptography.Pkcs {
19
20         [TestFixture]
21         public class CryptographicAttributeTest {
22
23                 static string defaultOid = "1.2.840.113549.1.7.1";
24                 static string defaultName = "PKCS 7 Data";
25
26                 [Test]
27                 public void ConstructorOid () 
28                 {
29                         Oid o = new Oid (defaultOid);
30                         CryptographicAttribute ca = new CryptographicAttribute (o);
31                         Assert.AreEqual (defaultName, ca.Oid.FriendlyName, "Oid.FriendlyName");
32                         Assert.AreEqual (defaultOid, ca.Oid.Value, "Oid.Value");
33                         Assert.AreEqual (0, ca.Values.Count, "Values");
34                 }
35
36                 [Test]
37                 //BUG [ExpectedException (typeof (ArgumentNullException))]
38                 public void ConstructorOidNull () 
39                 {
40                         CryptographicAttribute ca = new CryptographicAttribute (null);
41                 }
42
43                 [Test]
44                 public void ConstructorOidArrayList () 
45                 {
46                         Oid o = new Oid (defaultOid);
47                         ArrayList al = new ArrayList ();
48                         CryptographicAttribute ca = new CryptographicAttribute (o, al);
49                         Assert.AreEqual (defaultName, ca.Oid.FriendlyName, "Oid.FriendlyName");
50                         Assert.AreEqual (defaultOid, ca.Oid.Value, "Oid.Value");
51                         Assert.AreEqual (0, ca.Values.Count, "Values");
52                 }
53
54                 [Test]
55                 //BUG [ExpectedException (typeof (ArgumentNullException))]
56                 public void ConstructorOidNullArrayList () 
57                 {
58                         ArrayList al = new ArrayList ();
59                         CryptographicAttribute ca = new CryptographicAttribute (null, al);
60                 }
61
62                 [Test]
63                 //BUG [ExpectedException (typeof (ArgumentNullException))]
64                 [ExpectedException (typeof (NullReferenceException))]
65                 public void ConstructorOidArrayListNull () 
66                 {
67                         Oid o = new Oid (defaultOid);
68                         ArrayList al = null; // do not confuse compiler
69                         CryptographicAttribute ca = new CryptographicAttribute (o, al);
70                 }
71
72                 [Test]
73                 public void ConstructorOidObject () 
74                 {
75                         Oid o = new Oid (defaultOid);
76                         CryptographicAttribute ca = new CryptographicAttribute (o, o);
77                         Assert.AreEqual (defaultName, ca.Oid.FriendlyName, "Oid.FriendlyName");
78                         Assert.AreEqual (defaultOid, ca.Oid.Value, "Oid.Value");
79                         Assert.AreEqual (1, ca.Values.Count, "Values");
80                 }
81
82                 [Test]
83                 //BUG [ExpectedException (typeof (ArgumentNullException))]
84                 public void ConstructorOidNullObject () 
85                 {
86                         Oid o = new Oid (defaultOid);
87                         CryptographicAttribute ca = new CryptographicAttribute (null, o);
88                 }
89
90                 [Test]
91                 //BUG [ExpectedException (typeof (ArgumentNullException))]
92                 public void ConstructorOidObjectNull () 
93                 {
94                         Oid o = new Oid (defaultOid);
95                         object obj = null; // do not confuse compiler
96                         CryptographicAttribute ca = new CryptographicAttribute (o, obj);
97                 }
98         }
99 }
100