Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NameTableTests.cs « Test « System.XML « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ee115132f44120e94e46ea7a1ce9af01ddfa1d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//
// System.Xml.NameTableTests.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// (C) Ximian, Inc.
//

using System;
using System.Xml;

using NUnit.Framework;

namespace MonoTests.System.Xml
{
	public class NameTableTests : TestCase
	{
		NameTable table;
		
		public NameTableTests (string name)
			: base (name)
		{
		}

		protected override void SetUp ()
		{
			table = new NameTable ();
		}

		//
		// Tests System.Xml.NameTable.Add (string)
		//		
		public void TestAdd1 ()
		{
			string add = "add1";
			string testAdd = table.Add (add);
			AssertEquals (add, testAdd);
			AssertSame (add, testAdd);
		}

		//
		// Tests System.Xml.NameTable.Add (char[], int, int)
		//		
		public void TestAdd2 ()
		{
			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)
		//
		public void TestGet1 ()
		{
			string get1 = "get1";
			string testGet = table.Add (get1);			

			AssertEquals (table.Get (get1), testGet);
			AssertSame (get1, testGet );
		}

		//
		// Tests System.Xml.NameTable.Get (char[], int, int)
		//
		public void TestGet2 ()
		{						
			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)
		//
		public void TestGet3 ()
		{
			char[] test = new char [4] { 't', 'e', 's', 't' };
			int index = 0;
			int length = 0;

			AssertEquals (table.Get (test, index, length), String.Empty);
		}
	}
}