HybridDictionaryTest.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // HybridDictionaryTest.cs - NUnit Test Cases for System.Net.HybridDictionary
  3. //
  4. // Authors:
  5. // Lawrence Pit ([email protected])
  6. // Martin Willemoes Hansen ([email protected])
  7. //
  8. // (C) 2003 Martin Willemoes Hansen
  9. //
  10. using NUnit.Framework;
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Specialized;
  14. namespace MonoTests.System.Collections.Specialized
  15. {
  16. [TestFixture]
  17. public class HybridDictionaryTest : Assertion
  18. {
  19. [Test]
  20. public void All ()
  21. {
  22. HybridDictionary dict = new HybridDictionary (true);
  23. dict.Add ("CCC", "ccc");
  24. dict.Add ("BBB", "bbb");
  25. dict.Add ("fff", "fff");
  26. dict ["EEE"] = "eee";
  27. dict ["ddd"] = "ddd";
  28. Assertion.AssertEquals ("#1", 5, dict.Count);
  29. Assertion.AssertEquals ("#2", "eee", dict ["eee"]);
  30. dict.Add ("CCC2", "ccc");
  31. dict.Add ("BBB2", "bbb");
  32. dict.Add ("fff2", "fff");
  33. dict ["EEE2"] = "eee";
  34. dict ["ddd2"] = "ddd";
  35. dict ["xxx"] = "xxx";
  36. dict ["yyy"] = "yyy";
  37. Assertion.AssertEquals ("#3", 12, dict.Count);
  38. Assertion.AssertEquals ("#4", "eee", dict ["eee"]);
  39. }
  40. [Test]
  41. public void Empty ()
  42. {
  43. HybridDictionary hd = new HybridDictionary (true);
  44. Assert ("null", !hd.Contains (null));
  45. Assert ("unexisting", !hd.Contains ("unexisting"));
  46. }
  47. [Test]
  48. [ExpectedException (typeof (ArgumentNullException))]
  49. public void NotEmpty ()
  50. {
  51. HybridDictionary hd = new HybridDictionary (true);
  52. hd.Add ("CCC", "ccc");
  53. AssertEquals ("Count", 1, hd.Count);
  54. Assert ("null", !hd.Contains (null));
  55. }
  56. }
  57. }