fixed tests
[mono.git] / mcs / class / System / Test / System.Security.Cryptography / OidCollectionTest.cs
1 //
2 // OidCollectionTest.cs - NUnit tests for OidCollection
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 #if NET_2_0
11
12 using NUnit.Framework;
13
14 using System;
15 using System.Security.Cryptography;
16
17 namespace MonoTests.System.Security.Cryptography {
18
19         [TestFixture]
20         public class OidCollectionTest : Assertion {
21
22                 [Test]
23                 public void Constructor () 
24                 {
25                         OidCollection oc = new OidCollection ();
26                         // default properties
27                         AssertEquals ("Count", 0, oc.Count);
28                         Assert ("IsSynchronized", !oc.IsSynchronized);
29                         AssertNotNull ("SyncRoot", oc.SyncRoot);
30                         AssertNotNull ("GetEnumerator", oc.GetEnumerator ());
31                 }
32
33                 [Test]
34                 public void Add ()
35                 {
36                         OidCollection oc = new OidCollection ();
37                         oc.Add (new Oid ("1.0"));
38                         AssertEquals ("Count", 1, oc.Count);
39                         AssertEquals ("[0]", "1.0", oc [0].Value);
40                         AssertEquals ("['1.0']", "1.0", oc ["1.0"].Value);
41                 }
42
43                 [Test]
44                 //BUG [ExpectedException (typeof (ArgumentNullException))]
45                 public void AddNull () 
46                 {
47                         OidCollection oc = new OidCollection ();
48                         oc.Add (null);
49                         AssertEquals ("Count", 1, oc.Count);
50                         // AssertNull ("[0]", oc); throw NullReferenceException
51                 }
52
53                 [Test]
54                 public void CopyToOid () 
55                 {
56                         OidCollection oc = new OidCollection ();
57                         oc.Add (new Oid ("1.0"));
58                         Oid[] array = new Oid [1];
59                         oc.CopyTo (array, 0);
60                         AssertEquals ("CopyTo(Oid)", "1.0", array [0].Value);
61                 }
62
63                 [Test]
64                 [ExpectedException (typeof (ArgumentNullException))]
65                 public void CopyToOidNull ()
66                 {
67                         OidCollection oc = new OidCollection ();
68                         oc.Add (new Oid ("1.0"));
69                         Oid[] array = null;
70                         oc.CopyTo (array, 0);
71                 }
72         }
73 }
74
75 #endif