Merge pull request #1656 from alexanderkyte/webservice_27561
[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
11 using NUnit.Framework;
12
13 using System;
14 using System.Security.Cryptography;
15
16 namespace MonoTests.System.Security.Cryptography {
17
18         [TestFixture]
19         public class OidCollectionTest {
20
21                 [Test]
22                 public void Constructor () 
23                 {
24                         OidCollection oc = new OidCollection ();
25                         // default properties
26                         Assert.AreEqual (0, oc.Count, "Count");
27                         Assert.IsTrue (!oc.IsSynchronized, "IsSynchronized");
28                         Assert.IsNotNull (oc.SyncRoot, "SyncRoot");
29                         Assert.IsNotNull (oc.GetEnumerator (), "GetEnumerator");
30                 }
31
32                 [Test]
33                 public void Add ()
34                 {
35                         OidCollection oc = new OidCollection ();
36                         oc.Add (new Oid ("1.0"));
37                         Assert.AreEqual (1, oc.Count, "Count");
38                         Assert.AreEqual ("1.0", oc [0].Value, "[0]");
39                         Assert.AreEqual ("1.0", oc ["1.0"].Value, "['1.0']");
40                 }
41
42                 [Test]
43                 //BUG [ExpectedException (typeof (ArgumentNullException))]
44                 public void AddNull () 
45                 {
46                         OidCollection oc = new OidCollection ();
47                         oc.Add (null);
48                         Assert.AreEqual (1, oc.Count, "Count");
49                         // Assert.IsNull (oc, "[0]"); throw NullReferenceException
50                 }
51
52                 [Test]
53                 public void CopyToOid () 
54                 {
55                         OidCollection oc = new OidCollection ();
56                         oc.Add (new Oid ("1.0"));
57                         Oid[] array = new Oid [1];
58                         oc.CopyTo (array, 0);
59                         Assert.AreEqual ("1.0", array [0].Value, "CopyTo(Oid)");
60                 }
61
62                 [Test]
63                 [ExpectedException (typeof (ArgumentNullException))]
64                 public void CopyToOidNull ()
65                 {
66                         OidCollection oc = new OidCollection ();
67                         oc.Add (new Oid ("1.0"));
68                         Oid[] array = null;
69                         oc.CopyTo (array, 0);
70                 }
71         }
72 }
73