2009-06-24 Robert Jordan <robertj@gmx.net>
[mono.git] / mcs / class / corlib / Test / System.Collections / DictionaryEntryTest.cs
1 // DictionaryEntryTest
2
3 using System;
4 using System.Collections;
5 using NUnit.Framework;
6
7 namespace MonoTests.System.Collections {
8
9         [TestFixture]
10         public class DictionaryEntryTest {
11                 [Test]
12                 public void Ctor () {
13
14                         DictionaryEntry d = new DictionaryEntry (1, "something");
15                         Assert.IsNotNull (d);
16                         Assert.AreEqual (1, d.Key, "#01");
17                         Assert.AreEqual ("something", d.Value, "#02");
18                 }
19
20                 [Test]
21                 public void Key () {
22                         DictionaryEntry d = new DictionaryEntry (1, "something");
23                         d.Key = 77.77;
24                         Assert.AreEqual (77.77, d.Key, "#03");
25                 }
26
27                 [Test]
28                 public void Value () {
29                         DictionaryEntry d = new DictionaryEntry (1, "something");
30                         d.Value = 'p';
31                         Assert.AreEqual ('p', d.Value, "#04");
32                 }
33
34                 [Test]
35 #if ONLY_1_1
36                 [ExpectedException (typeof (ArgumentNullException))]
37 #endif                  
38                 public void NullKeyCtor ()
39                 {
40                         DictionaryEntry d = new DictionaryEntry (null, "bar");
41                 }
42
43                 [Test]
44 #if ONLY_1_1
45                 [ExpectedException (typeof (ArgumentNullException))]
46 #endif                  
47                 public void NullKeySetter ()
48                 {
49                         DictionaryEntry d = new DictionaryEntry ("foo", "bar");
50                         d.Key = null;
51                 }
52         }
53 }