2 // System.Xml.NameTableTests.cs
4 // Author: Duncan Mak (duncan@ximian.com)
5 // Author: Martin Willemoes Hansen (mwh@sysrq.dk)
8 // (C) 2003 Martin Willemoes Hansen
14 using NUnit.Framework;
16 namespace MonoTests.System.Xml
19 public class NameTableTests : Assertion
24 public void GetReady ()
26 table = new NameTable ();
30 // Tests System.Xml.NameTable.Add (string)
36 string testAdd = table.Add (add);
37 AssertEquals (add, testAdd);
38 AssertSame (add, testAdd);
42 // Tests System.Xml.NameTable.Add (char[], int, int)
47 char[] test = new char [4] { 'a', 'd', 'd', '2' };
49 int length = 3; // "add"
51 AssertEquals ("add", table.Add (test, index, length));
55 // Tests System.Xml.NameTable.Get (string)
61 string testGet = table.Add (get1);
62 AssertEquals ("#1", "get1", testGet);
64 AssertEquals ("#2", testGet, table.Get (get1));
65 AssertSame ("#3", get1, testGet );
69 // Tests System.Xml.NameTable.Get (char[], int, int)
74 char[] test = new char [4] { 'g', 'e', 't', '2' };
76 int length = 3; // "get"
78 string testGet = table.Add (test, index, length);
79 AssertEquals ("#1", "get", testGet);
81 AssertEquals ("#2", testGet, table.Get ("get"));
82 AssertEquals ("#3", testGet, table.Get (test, index, length));
86 // Tests System.Xml.NameTable.Get (char[], int, 0)
91 char[] test = new char [4] { 't', 'e', 's', 't' };
95 AssertEquals (String.Empty, table.Get (test, index, length));