| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //
- // System.Xml.NameTableTests.cs
- //
- // Author: Duncan Mak ([email protected])
- // Author: Martin Willemoes Hansen ([email protected])
- //
- // (C) Ximian, Inc.
- // (C) 2003 Martin Willemoes Hansen
- //
- using System;
- using System.Xml;
- using NUnit.Framework;
- namespace MonoTests.System.Xml
- {
- [TestFixture]
- public class NameTableTests : Assertion
- {
- NameTable table;
-
- [SetUp]
- public void GetReady ()
- {
- table = new NameTable ();
- }
- //
- // Tests System.Xml.NameTable.Add (string)
- //
- [Test]
- public void Add1 ()
- {
- string add = "add1";
- string testAdd = table.Add (add);
- AssertEquals (add, testAdd);
- AssertSame (add, testAdd);
- }
- //
- // Tests System.Xml.NameTable.Add (char[], int, int)
- //
- [Test]
- public void Add2 ()
- {
- char[] test = new char [4] { 'a', 'd', 'd', '2' };
- int index = 0;
- int length = 3; // "add"
- AssertEquals ("add", table.Add (test, index, length));
- }
- //
- // Tests System.Xml.NameTable.Get (string)
- //
- [Test]
- public void Get1 ()
- {
- string get1 = "get1";
- string testGet = table.Add (get1);
- AssertEquals (table.Get (get1), testGet);
- AssertSame (get1, testGet );
- }
- //
- // Tests System.Xml.NameTable.Get (char[], int, int)
- //
- [Test]
- public void Get2 ()
- {
- char[] test = new char [4] { 'g', 'e', 't', '2' };
- int index = 0;
- int length = 3; // "get"
-
- string testGet = table.Add (test, index, length);
- AssertEquals (table.Get (test, index, length), testGet);
- }
- //
- // Tests System.Xml.NameTable.Get (char[], int, 0)
- //
- [Test]
- public void Get3 ()
- {
- char[] test = new char [4] { 't', 'e', 's', 't' };
- int index = 0;
- int length = 0;
- AssertEquals (table.Get (test, index, length), String.Empty);
- }
- }
- }
|