* XmlSerializerTests.cs: Added some identifiers for AssertEquals.
[mono.git] / mcs / class / System.XML / Test / System.Xml / NameTableTests.cs
1 //
2 // System.Xml.NameTableTests.cs
3 //
4 // Author: Duncan Mak (duncan@ximian.com)
5 // Author: Martin Willemoes Hansen (mwh@sysrq.dk)
6 //
7 // (C) Ximian, Inc.
8 // (C) 2003 Martin Willemoes Hansen
9 //
10
11 using System;
12 using System.Xml;
13
14 using NUnit.Framework;
15
16 namespace MonoTests.System.Xml
17 {
18         [TestFixture]
19         public class NameTableTests : Assertion
20         {
21                 NameTable table;
22                 
23                 [SetUp]
24                 public void GetReady ()
25                 {
26                         table = new NameTable ();
27                 }
28
29                 //
30                 // Tests System.Xml.NameTable.Add (string)
31                 //              
32                 [Test]
33                 public void Add1 ()
34                 {
35                         string add = "add1";
36                         string testAdd = table.Add (add);
37                         AssertEquals (add, testAdd);
38                         AssertSame (add, testAdd);
39                 }
40
41                 //
42                 // Tests System.Xml.NameTable.Add (char[], int, int)
43                 //              
44                 [Test]
45                 public void Add2 ()
46                 {
47                         char[] test = new char [4] { 'a', 'd', 'd', '2' };
48                         int index = 0;
49                         int length = 3; // "add"                        
50
51                         AssertEquals ("add", table.Add (test, index, length));
52                 }
53
54                 //
55                 // Tests System.Xml.NameTable.Get (string)
56                 //
57                 [Test]
58                 public void Get1 ()
59                 {
60                         string get1 = "get1";
61                         string testGet = table.Add (get1);                      
62
63                         AssertEquals (table.Get (get1), testGet);
64                         AssertSame (get1, testGet );
65                 }
66
67                 //
68                 // Tests System.Xml.NameTable.Get (char[], int, int)
69                 //
70                 [Test]
71                 public void Get2 ()
72                 {                                               
73                         char[] test = new char [4] { 'g', 'e', 't', '2' };
74                         int index = 0; 
75                         int length = 3; // "get"
76                         
77                         string testGet = table.Add (test, index, length);                       
78
79                         AssertEquals (table.Get (test, index, length), testGet);
80                 }
81
82                 //
83                 // Tests System.Xml.NameTable.Get (char[], int, 0)
84                 //
85                 [Test]
86                 public void Get3 ()
87                 {
88                         char[] test = new char [4] { 't', 'e', 's', 't' };
89                         int index = 0;
90                         int length = 0;
91
92                         AssertEquals (table.Get (test, index, length), String.Empty);
93                 }
94         }
95 }