2009-06-26 Robert Jordan <robertj@gmx.net>
[mono.git] / mcs / class / System.XML / Test / System.Xml / nist_dom / fundamental / Node / Node.cs
1 //**************************************************************************\r
2 //\r
3 //\r
4 //                       National Institute Of Standards and Technology\r
5 //                                     DTS Version 1.0\r
6 //         \r
7 //                                     Node Interface\r
8 //\r
9 // Written by: Carmelo Montanez\r
10 // Modified by:  Mary Brady\r
11 //\r
12 // Ported to System.Xml by: Mizrahi Rafael rafim@mainsoft.com\r
13 // Mainsoft Corporation (c) 2003-2004\r
14 //**************************************************************************\r
15 using System;\r
16 using System.Xml;\r
17 \r
18 using nist_dom;\r
19 using NUnit.Framework;\r
20 \r
21 namespace nist_dom.fundamental\r
22 {\r
23     [TestFixture]\r
24     public class NodeTest\r
25     {\r
26         public static int i = 2;\r
27 /*\r
28         public testResults[] RunTests()\r
29         {\r
30             testResults[] tests = new testResults[] {core0001NO(), core0002NO(), core0003NO(),core0004NO(),\r
31                                                         core0005NO(), core0006NO(), core0007NO(), core0008NO(),\r
32                                                         core0009NO(), core0010NO(), core0011NO(), core0012NO(),\r
33                                                         core0013NO(), core0014NO(), core0015NO(), core0016NO(),\r
34                                                         core0017NO(), core0018NO(), core0019NO(), core0020NO(),\r
35                                                         core0021NO(), core0022NO(), core0023NO(), core0024NO(),\r
36                                                         core0025NO(), core0026NO(), core0027NO(), core0028NO(),\r
37                                                         core0029NO(), core0030NO(), core0031NO(), core0032NO(),\r
38                                                         core0033NO(), core0034NO(), core0035NO(), core0036NO(),\r
39                                                         core0038NO(), core0039NO(), core0040NO(),\r
40                                                         core0041NO(), core0042NO(), core0043NO(), core0044NO(),\r
41                                                         core0045NO(), core0046NO(), core0047NO(), core0048NO(),\r
42                                                         core0049NO(), core0050NO(), core0051NO(), core0052NO(),\r
43                                                         core0053NO(), core0054NO(), core0055NO(), core0056NO(),\r
44                                                         core0057NO(), core0058NO(), core0059NO(), core0060NO(),\r
45                                                         core0061NO(), core0062NO(), core0063NO(), core0064NO(),\r
46                                                         core0065NO(), core0066NO(), core0067NO(), core0068NO(),\r
47                                                         core0069NO(), core0070NO(), core0071NO(), core0072NO(),\r
48                                                         core0073NO(), core0074NO(), core0075NO(), core0076NO(),\r
49                                                         core0077NO(), core0078NO(), core0079NO(), core0080NO(),\r
50                                                         core0081NO(), core0082NO(), core0083NO(), core0084NO(),\r
51                                                         core0085NO(), core0087NO(), core0088NO(),\r
52                                                         core0089NO(), core0090NO(), core0091NO(), core0092NO(),\r
53                                                         core0093NO(), core0094NO(), core0095NO(), core0096NO(),\r
54                                                         core0097NO(), core0098NO(), core0099NO(), core0100NO(),\r
55                                                         core0101NO(), core0102NO(), core0103NO()};\r
56   \r
57             return tests;\r
58         }\r
59 */\r
60 \r
61         //------------------------ test case core-0001NO------------------------\r
62         //\r
63         // Testing feature - The "nodeType" attribute for an Element node is \r
64         //                   1 (ELEMENT_NODE). \r
65         //\r
66         // Testing approach - Retrieve the root node and check its "nodeType" \r
67         //                    attribute.  It should be set to 1. \r
68         //\r
69         // Semantic Requirements: 1, 14\r
70         //\r
71         //----------------------------------------------------------------------------\r
72 \r
73         [Test]\r
74         public void core0001NO()\r
75         {\r
76             int computedValue = 0;\r
77             int expectedValue = util.ELEMENT_NODE;\r
78 \r
79             testResults results = new testResults("Core0001NO");\r
80 \r
81             results.description = "The nodeType attribute for an Element Node "+\r
82                 " should be set to the constant 1.";\r
83             //\r
84             // The nodeType attribute for the root node should be set to the value 1.\r
85             //\r
86             computedValue = (int)util.getRootNode().NodeType;\r
87             //\r
88             // write out results.\r
89             //\r
90             results.expected = expectedValue.ToString();\r
91             results.actual = computedValue.ToString();\r
92             Assert.AreEqual (results.expected, results.actual);\r
93         }\r
94 \r
95         //------------------------ End test case core-0001NO --------------------------\r
96         //\r
97         //------------------------- test case core-0002NO -----------------------------\r
98         //\r
99         // Testing feature - The "nodeType" attribute for an Attribute node is\r
100         //                   2 (ATTRIBUTE_NODE).\r
101         //\r
102         // Testing approach - Retrieve the first attribute from the last child of\r
103         //                    the first employee.  Its "nodeType" attribute is then \r
104         //                    checked, it should be set to 2.\r
105         //\r
106         // Semantic Requirements: 2, 14 \r
107         //\r
108         //----------------------------------------------------------------------------\r
109 \r
110         [Test]\r
111         public void core0002NO()\r
112         {\r
113             string computedValue = "";\r
114             System.Xml.XmlElement testNode = null;\r
115             System.Xml.XmlAttribute attrNode = null;\r
116             string expectedValue = util.ATTRIBUTE_NODE.ToString();\r
117 \r
118             testResults results = new testResults("Core0002NO");\r
119             try\r
120             {\r
121                 results.description = "The nodeType attribute for an Attribute Node "+\r
122                     " should be set to the constant 2.";\r
123                 // \r
124                 // Retrieve the targeted data and its type.\r
125                 //\r
126                 testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);\r
127                 attrNode = testNode.GetAttributeNode("domestic");//.node.\r
128                 computedValue = ((int)attrNode.NodeType).ToString();\r
129             }\r
130             catch(System.Exception ex)\r
131             {\r
132                 computedValue = "Exception " + ex.Message;\r
133             }\r
134             //\r
135             // write out results.\r
136             //\r
137             results.expected = expectedValue.ToString();\r
138             results.actual = computedValue;\r
139 \r
140             Assert.AreEqual (results.expected, results.actual);\r
141         }\r
142 \r
143         //------------------------ End test case core-0002NO --------------------------\r
144         //\r
145         //------------------------- test case core-0003NO -----------------------------\r
146         //\r
147         // Testing feature - The "nodeType" attribute for a Text node is\r
148         //                   3 (TEXT_NODE).\r
149         //\r
150         // Testing approach - Retrieve the Text data from the last child of the \r
151         //                    first employee and and examine its "nodeType" \r
152         //                    attribute.  It should be set to 3.\r
153         //\r
154         // Semantic Requirements: 3, 14 \r
155         //\r
156         //----------------------------------------------------------------------------\r
157 \r
158         [Test]\r
159         public void core0003NO()\r
160         {\r
161             string computedValue = "";\r
162             System.Xml.XmlNode testNode = null;\r
163             System.Xml.XmlNode textNode = null;\r
164             string expectedValue = util.TEXT_NODE.ToString();\r
165 \r
166             testResults results = new testResults("Core0003NO");\r
167             try\r
168             {\r
169                 results.description = "The nodeType attribute for a Text Node "+\r
170                     " should be set to the constant 3.";\r
171 \r
172                 //\r
173                 // Retrieve the targeted data.\r
174                 //\r
175                 testNode = util.nodeObject(util.FIRST,util.SIXTH);\r
176                 textNode = testNode.FirstChild;//.node.\r
177                 //\r
178                 // The nodeType attribute should be set to the value 3.\r
179                 //\r
180                 computedValue = ((int)textNode.NodeType).ToString();\r
181             }\r
182             catch(System.Exception ex)\r
183             {\r
184                 computedValue = "Exception " + ex.Message;\r
185             }\r
186             //\r
187             // write out results.\r
188             //\r
189             results.expected = expectedValue.ToString();\r
190             results.actual = computedValue;\r
191 \r
192             Assert.AreEqual (results.expected, results.actual);\r
193         }\r
194 \r
195         //------------------------ End test case core-0003NO --------------------------\r
196         //\r
197         //------------------------- test case core-0004NO -----------------------------\r
198         //\r
199         // Testing feature - The "nodeType" attribute for a CDATASection node is\r
200         //                   4 (CDATA_SECTION_NODE).\r
201         //\r
202         // Testing approach - Retrieve the CDATASection node contained inside\r
203         //                    the second child of the second employee and\r
204         //                    examine its "nodeType" attribute.  It should be \r
205         //                    set to 4.\r
206         //\r
207         // Semantic Requirements: 4, 14 \r
208         //\r
209         //----------------------------------------------------------------------------\r
210 \r
211         [Test]\r
212         public void core0004NO()\r
213         {\r
214             string computedValue = "";\r
215             System.Xml.XmlNode testNode = null;\r
216             System.Xml.XmlNode cDataNode = null;\r
217             string expectedValue = util.CDATA_SECTION_NODE.ToString();\r
218 \r
219             testResults results = new testResults("Core0004NO");\r
220             try\r
221             {\r
222                 results.description = "The nodeType attribute for a CDATASection Node "+\r
223                     " should be set to the constant 4.";\r
224                 //\r
225                 // Retrieve the targeted data.\r
226                 //\r
227                 testNode = util.nodeObject(util.SECOND,util.SECOND);\r
228                 cDataNode = testNode.LastChild; //.node.\r
229                 //\r
230                 // The nodeType attribute should be set to the value 3.\r
231                 //\r
232                 computedValue = ((int)cDataNode.NodeType).ToString();\r
233             }\r
234             catch(System.Exception ex)\r
235             {\r
236                 computedValue = "Exception " + ex.Message;\r
237             }\r
238             //\r
239             // write out results.\r
240             //\r
241             results.expected = expectedValue.ToString();\r
242             results.actual = computedValue.ToString();\r
243 \r
244             Assert.AreEqual (results.expected, results.actual);\r
245         }\r
246 \r
247         //------------------------ End test case core-0004NO --------------------------\r
248         //\r
249         //------------------------- test case core-0005NO -----------------------------\r
250         //\r
251         // Testing feature - The "nodeType" attribute for an EntityReference node \r
252         //                   is 5 (ENTITY_REFERENCE_NODE).\r
253         //\r
254         // Testing approach - Retrieve the first Entity Reference node from the \r
255         //                    last child of the second employee and examine its \r
256         //                    "nodeType" attribute.  It should be set to 5.\r
257         //\r
258         // Semantic Requirements:  5, 14 \r
259         //\r
260         //----------------------------------------------------------------------------\r
261 \r
262         [Test]\r
263         public void core0005NO()\r
264         {\r
265             string computedValue = "";\r
266             System.Xml.XmlNode testNode = null;\r
267             System.Xml.XmlNode entRefNode = null;\r
268             string expectedValue = XmlNodeType.EntityReference.ToString ();//util.ENTITY_REFERENCE_NODE;\r
269 \r
270             testResults results = new testResults("Core0005NO");\r
271             try\r
272             {\r
273                 results.description = "The nodeType attribute for an EntityReference Node "+\r
274                     " should be set to the constant 5.";\r
275 \r
276                 //\r
277                 // Retrieve the targeted data.\r
278                 //\r
279                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
280                 entRefNode = testNode.FirstChild;//.node.\r
281                 //\r
282                 // The nodeType attribute should be set to the value 5.\r
283                 //\r
284                 computedValue = entRefNode.NodeType.ToString();\r
285             }\r
286             catch(System.Exception ex)\r
287             {\r
288                 computedValue = "Exception " + ex.Message;\r
289             }\r
290             //\r
291             // write out results.\r
292             //\r
293             results.expected = expectedValue.ToString();\r
294             results.actual = computedValue.ToString();\r
295 \r
296             Assert.AreEqual (results.expected, results.actual);\r
297         }\r
298 \r
299         //------------------------ End test case core-0005NO --------------------------\r
300         //\r
301         //------------------------- test case core-0006NO -----------------------------\r
302         //\r
303         // Testing feature - The "nodeType" attribute for an Entity node \r
304         //                   6 (ENTITY_NODE).\r
305         //\r
306         // Testing approach - Retrieve the first Entity declaration in the\r
307         //                    "DOCTYPE" section of the XML file and examine\r
308         //                    its "nodeType" attribute.  It should be set to 6.\r
309         //\r
310         // Semantic Requirements: 6, 14 \r
311         //\r
312         //----------------------------------------------------------------------------\r
313 \r
314         [Test]\r
315         public void core0006NO()\r
316         {\r
317             int computedValue = 0;\r
318             System.Xml.XmlNode testNode = null;\r
319             int expectedValue = util.ENTITY_NODE;\r
320 \r
321             testResults results = new testResults("Core0006NO");\r
322             results.description = "The nodeType attribute for an Entity Node "+\r
323                 " should be set to the constant 6.";\r
324             //\r
325             // Get the targeted data and its type.\r
326             //\r
327             testNode = util.getEntity("ent1");\r
328             //\r
329             // The nodeType attribute should be set to the value 6.\r
330             //\r
331             computedValue = (int)testNode.NodeType;\r
332 \r
333             //\r
334             // write out results.\r
335             //\r
336             results.expected = expectedValue.ToString();\r
337             results.actual = computedValue.ToString();\r
338 \r
339             Assert.AreEqual (results.expected, results.actual);\r
340         }\r
341 \r
342         //------------------------ End test case core-0006NO --------------------------\r
343         //\r
344         //------------------------- test case core-0007NO -----------------------------\r
345         //\r
346         // Testing feature - The "nodeType" attribute for a ProcessingInstruction.\r
347         //\r
348         // Testing approach - Retrieve the first declaration in the XML file\r
349         //                    and examine its "nodeType" attribute.  It should \r
350         //                    be set to ProcessingInstruction.\r
351         //\r
352         // Semantic Requirements: 7, 14 \r
353         //\r
354         //----------------------------------------------------------------------------\r
355 \r
356         [Test]\r
357         public void core0007NO()\r
358         {\r
359             string computedValue = "";\r
360             System.Xml.XmlNode testNode = null;\r
361             string expectedValue =  util.XML_DECLARATION_NODE.ToString(); //util.PROCESSING_INSTRUCTION_NODE.ToString();\r
362 \r
363             testResults results = new testResults("Core0007NO");\r
364             results.description = "The nodeType attribute for an ProcessingInstruction Node.";\r
365             //\r
366             //  Get the targeted data.\r
367             //\r
368             testNode = util.getDOMDocument().ChildNodes.Item(0);\r
369             //\r
370             // The nodeType attribute should be set to the value 7.\r
371             //\r
372             computedValue = ((int)testNode.NodeType).ToString();\r
373             //\r
374             // write out results.\r
375             //\r
376             results.expected = expectedValue.ToString();\r
377             results.actual = computedValue.ToString();\r
378 \r
379             Assert.AreEqual (results.expected, results.actual);\r
380         }\r
381 \r
382         //------------------------ End test case core-0007NO --------------------------\r
383         //\r
384         //------------------------- test case core-0008NO -----------------------------\r
385         //\r
386         // Testing feature - The "nodeType" attribute for a comment node is\r
387         //                   8 (COMMENT_NODE).\r
388         //\r
389         // Testing approach - Retrieve the only comment (third child) from the\r
390         //                    main DOM document and examine its "nodeType" attribute.  \r
391         //                    It should be set to 8.\r
392         //\r
393         // Semantic Requirements: 8, 14 \r
394         //\r
395         //----------------------------------------------------------------------------\r
396 \r
397         [Test]\r
398         public void core0008NO()\r
399         {\r
400             int computedValue = 0;\r
401             System.Xml.XmlNode testNode = null;\r
402             int expectedValue = util.COMMENT_NODE;\r
403 \r
404             testResults results = new testResults("Core0008NO");\r
405             results.description = "The nodeType attribute for a Comment Node "+\r
406                 " should be set to the constant 8.";\r
407             //\r
408             // Get the targeted data.\r
409             //\r
410             testNode = util.getDOMDocument().ChildNodes.Item(2);\r
411             //\r
412             // The nodeType attribute should be set to the value 8.\r
413             //\r
414             computedValue = (int)testNode.NodeType;\r
415             //\r
416             // write out results.\r
417             //\r
418             results.expected = expectedValue.ToString();\r
419             results.actual = computedValue.ToString();\r
420 \r
421             Assert.AreEqual (results.expected, results.actual);\r
422         }\r
423 \r
424         //------------------------ End test case core-0008NO --------------------------\r
425         //\r
426         //------------------------- test case core-0009NO -----------------------------\r
427         //\r
428         // Testing feature - The "nodeType" attribute for a Document node is\r
429         //                   9 (DOCUMENT_NODE).\r
430         //\r
431         // Testing approach - Retrieve the DOM Document and examine its \r
432         //                    "nodeType" attribute.  It should be set to 9.\r
433         //\r
434         // Semantic Requirements: 9, 14 \r
435         //\r
436         //----------------------------------------------------------------------------\r
437 \r
438         [Test]\r
439         public void core0009NO()\r
440         {\r
441             int computedValue = 0;\r
442             System.Xml.XmlNode testNode = null;\r
443             int expectedValue = util.DOCUMENT_NODE;\r
444 \r
445             testResults results = new testResults("Core0009NO");\r
446             results.description = "The nodeType attribute for an Document Node "+\r
447                 " should be set to the constant 9.";\r
448             //\r
449             // Get the targeted data.\r
450             //\r
451             testNode = util.getDOMDocument();\r
452             //\r
453             // The nodeType attribute should be set to the value 9.\r
454             //\r
455             computedValue = (int)testNode.NodeType;\r
456             //\r
457             // write out results.\r
458             //\r
459             results.expected = expectedValue.ToString();\r
460             results.actual = computedValue.ToString();\r
461 \r
462             Assert.AreEqual (results.expected, results.actual);\r
463         }\r
464 \r
465         //------------------------ End test case core-0009NO --------------------------\r
466         //\r
467         //------------------------- test case core-0010NO -----------------------------\r
468         //\r
469         // Testing feature - The "nodeType" attribute for a DocumentType node is\r
470         //                   10 (DOCUMENT_TYPE_NODE).\r
471         //\r
472         // Testing approach - Retrieve the DOCTYPE declaration (second child) from\r
473         //                    the XML file and examine its "nodeType" attribute. \r
474         //                    It should be set to 10.\r
475         //\r
476         // Semantic Requirements: 10, 14 \r
477         //\r
478         //----------------------------------------------------------------------------\r
479 \r
480         [Test]\r
481         public void core0010NO()\r
482         {\r
483             int computedValue = 0;\r
484             System.Xml.XmlNode testNode = null;\r
485             int expectedValue = util.DOCUMENT_TYPE_NODE;\r
486 \r
487             testResults results = new testResults("Core0010NO");\r
488             results.description = "The nodeType attribute for an DocumentType Node "+\r
489                 " should be set to the constant 10.";\r
490             //\r
491             // Get the targeted data.\r
492             //\r
493             testNode = util.getDocType();\r
494             //\r
495             // The nodeType attribute should be set to the value 10.\r
496             //\r
497             computedValue = (int)testNode.NodeType;\r
498             //\r
499             // write out results.\r
500             //\r
501             results.expected = expectedValue.ToString();\r
502             results.actual = computedValue.ToString();\r
503 \r
504             Assert.AreEqual (results.expected, results.actual);\r
505         }\r
506 \r
507         //------------------------ End test case core-0010NO --------------------------\r
508         //\r
509         //------------------------- test case core-0011NO -----------------------------\r
510         //\r
511         // Testing feature - The "nodeType" attribute for a DocumentFragment node\r
512         //                   is 11 (DOCUMENT_FRAGMENT_NODE).\r
513         //\r
514         // Testing approach - Retrieve the whole DOM document and invoke its\r
515         //                    "createDocumentFragment()" method and examine the\r
516         //                    "nodeType" attribute of the returned node.  It should \r
517         //                    be set to 11.\r
518         //\r
519         // Semantic Requirements: 11, 14\r
520         //\r
521         //----------------------------------------------------------------------------\r
522 \r
523         [Test]\r
524         public void core0011NO()\r
525         {\r
526             int computedValue = 0;\r
527             System.Xml.XmlNode testNode = null;\r
528             int expectedValue = util.DOCUMENT_FRAGMENT_NODE;\r
529 \r
530             testResults results = new testResults("Core0011NO");\r
531             results.description = "The nodeType attribute for a DocumentFragment Node "+\r
532                 " should be set to the constant 11.";\r
533             //\r
534             // Get the targeted data.\r
535             //\r
536             testNode = util.getDOMDocument().CreateDocumentFragment();\r
537             //\r
538             // The nodeType attribute should be set to the value 11.\r
539             //\r
540             computedValue = (int)testNode.NodeType;\r
541             //\r
542             // write out results.\r
543             //\r
544             results.expected = expectedValue.ToString();\r
545             results.actual = computedValue.ToString();\r
546 \r
547             Assert.AreEqual (results.expected, results.actual);\r
548         }\r
549 \r
550         //------------------------ End test case core-0011NO --------------------------\r
551         //\r
552         //------------------------- test case core-0012NO -----------------------------\r
553         //\r
554         // Testing feature - The "nodeType" attribute for a notation node is\r
555         //                   12 (NOTATION_NODE).\r
556         //\r
557         // Testing approach - Retrieve the Notation declaration inside the \r
558         //                    DocumentType node and examine its "nodeType"\r
559         //                    attribute.  It should be set to 12.\r
560         //\r
561         // Semantic Requirements: 12, 14\r
562         //\r
563         //----------------------------------------------------------------------------\r
564 \r
565         [Test]\r
566         public void core0012NO()\r
567         {\r
568             string computedValue = "";\r
569             System.Xml.XmlNode testNode = null;\r
570             string expectedValue = util.NOTATION_NODE.ToString();\r
571 \r
572             testResults results = new testResults("Core0012NO");\r
573             try\r
574             {\r
575                 results.description = "The nodeType attribute for a Notation Node "+\r
576                     " should be set to the constant 12.";\r
577                 //\r
578                 // Get the targeted data.\r
579                 //\r
580                 testNode = util.getNotation("notation1");\r
581                 //\r
582                 // The nodeType attribute should be set to the value 12.\r
583                 //\r
584                 computedValue = ((int)testNode.NodeType).ToString();\r
585             }\r
586             catch(System.Exception ex)\r
587             {\r
588                 computedValue = "Exception " + ex.Message;\r
589             }\r
590             //\r
591             // write out results.\r
592             //\r
593             results.expected = expectedValue.ToString();\r
594             results.actual = computedValue.ToString();\r
595 \r
596             Assert.AreEqual (results.expected, results.actual);\r
597         }\r
598 \r
599         //------------------------ End test case core-0012NO --------------------------\r
600         //\r
601         //------------------------   test case core-0013NO ----------------------------\r
602         //\r
603         // Testing feature - The "nodeName" attribute for an Element node is\r
604         //                   its tagName.\r
605         //\r
606         // Testing approach - Retrieve the first Element node (root node) of the \r
607         //                    DOM object and check its "nodeName" attribute.  \r
608         //                    It should be equal to its tagName.\r
609         //\r
610         // Semantic Requirements: 13, 15 \r
611         //\r
612         //----------------------------------------------------------------------------\r
613 \r
614         [Test]\r
615         public void core0013NO()\r
616         {\r
617             string computedValue = "0";\r
618             string expectedValue = "staff"; \r
619 \r
620             testResults results = new testResults("Core0013NO");\r
621             results.description = "The nodeName attribute for an Element Node " +\r
622                 "should be set to its tagName.";\r
623             //\r
624             // The nodeName attribute should be set to "staff". \r
625             //\r
626             computedValue = util.getRootNode().Name;\r
627             //\r
628             // write out results.\r
629             //\r
630             results.expected = expectedValue;\r
631             results.actual = computedValue;\r
632 \r
633             Assert.AreEqual (results.expected, results.actual);\r
634         }\r
635 \r
636         //------------------------ End test case core-0013NO --------------------------\r
637         //\r
638         //------------------------- test case core-0014NO -----------------------------\r
639         //\r
640         // Testing feature - The "nodeName" attribute for an Attribute node is\r
641         //                   the name of the attribute.\r
642         //\r
643         // Testing approach - Retrieve the attribute named "domestic" from the last \r
644         //                    child of the first employee.  Its "nodeName" attribute \r
645         //                    is then checked.  It should be set to "domestic".\r
646         //\r
647         // Semantic Requirements: 13, 15  \r
648         //\r
649         //----------------------------------------------------------------------------\r
650 \r
651         [Test]\r
652         public void core0014NO()\r
653         {\r
654             string computedValue = "0";\r
655             string expectedValue = "domestic";\r
656             System.Xml.XmlElement testNode = null;\r
657             System.Xml.XmlAttribute attrNode = null;\r
658 \r
659             testResults results = new testResults("Core0014NO");\r
660             try\r
661             {\r
662                 results.description = "The nodeName attribute for an Attribute Node " +\r
663                     "should be set to the name of the attribute.";\r
664                 //\r
665                 // Retrieve the targeted data.\r
666                 //\r
667                 testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);\r
668                 attrNode = testNode.GetAttributeNode("domestic"); //.node.\r
669                 //\r
670                 // The nodeName attribute should be set to the value "domestic".\r
671                 //\r
672                 computedValue = attrNode.Name;\r
673             }\r
674             catch(System.Exception ex)\r
675             {\r
676                 computedValue = "Exception " + ex.Message;\r
677             }\r
678             //\r
679             // write out results.\r
680             //\r
681             results.expected = expectedValue;\r
682             results.actual = computedValue;\r
683 \r
684             Assert.AreEqual (results.expected, results.actual);\r
685         }\r
686 \r
687         //------------------------ End test case core-0014NO --------------------------\r
688         //\r
689         //------------------------- test case core-0015NO -----------------------------\r
690         //\r
691         // Testing feature - The "nodeName" attribute for a text node is\r
692         //                   "#text".\r
693         //\r
694         // Testing approach - Retrieve the Text data from the last child of the\r
695         //                    first employee and and examine its "nodeName"\r
696         //                    attribute.  It should be set to "#text".\r
697         //\r
698         // Semantic Requirements: 13, 15 \r
699         //\r
700         //----------------------------------------------------------------------------\r
701 \r
702         [Test]\r
703         public void core0015NO()\r
704         {\r
705             string computedValue = "0";\r
706             string expectedValue = "#text";\r
707             System.Xml.XmlNode testNode = null;\r
708             System.Xml.XmlNode textNode = null;\r
709 \r
710             testResults results = new testResults("Core0015NO");\r
711             try\r
712             {\r
713                 results.description = "The nodeName attribute for a Text Node " +\r
714                     "should be set to \"#text\".";\r
715                 //\r
716                 // Retrieve the targeted data.\r
717                 //\r
718                 testNode = util.nodeObject(util.FIRST,util.SIXTH);\r
719                 textNode = testNode.FirstChild;//.node.\r
720                 //\r
721                 // The nodeName attribute should be set to the value "#text".\r
722                 //\r
723                 computedValue = textNode.Name;\r
724             }\r
725             catch(System.Exception ex)\r
726             {\r
727                 computedValue = "Exception " + ex.Message;\r
728             }\r
729             //\r
730             // write out results.\r
731             //\r
732             results.expected = expectedValue;\r
733             results.actual = computedValue;\r
734 \r
735             Assert.AreEqual (results.expected, results.actual);\r
736         }\r
737 \r
738         //------------------------ End test case core-0015NO --------------------------\r
739         //\r
740         //------------------------- test case core-0016NO -----------------------------\r
741         //\r
742         // Testing feature - The "nodeName" attribute for a CDATASection node is\r
743         //                   "#cdata-section".\r
744         //\r
745         // Testing approach - Retrieve the CDATASection node inside the second \r
746         //                    child of the second employee and examine its "nodeName"\r
747         //                    attribute.  It should be set to "#cdata-section".\r
748         //\r
749         // Semantic Requirements: 13, 15 \r
750         //\r
751         //----------------------------------------------------------------------------\r
752 \r
753         [Test]\r
754         public void core0016NO()\r
755         {\r
756             string computedValue = "0";\r
757             string expectedValue = "#cdata-section";\r
758             System.Xml.XmlNode testNode = null;\r
759             System.Xml.XmlNode cDataNode = null;\r
760 \r
761             testResults results = new testResults("Core0016NO");\r
762             try\r
763             {\r
764                 results.description = "The nodeName attribute for a CDATASection Node " +\r
765                     "should be set to \"#cdata-section\".";\r
766                 //\r
767                 // Retrieve the targeted data.\r
768                 //\r
769                 testNode = util.nodeObject(util.SECOND,util.SECOND);  \r
770                 cDataNode = testNode.LastChild;;//.node.\r
771                 //\r
772                 // The nodeName attribute should be set to "#cdata-section".\r
773                 //\r
774                 computedValue = cDataNode.Name;\r
775             }\r
776             catch(System.Exception ex)\r
777             {\r
778                 computedValue = "Exception " + ex.Message;\r
779             }\r
780             //\r
781             // write out results.\r
782             //\r
783             results.expected = expectedValue;\r
784             results.actual = computedValue;\r
785 \r
786             Assert.AreEqual (results.expected, results.actual);\r
787         }\r
788 \r
789         //------------------------ End test case core-0016NO --------------------------\r
790         //\r
791         //------------------------- test case core-0017NO -----------------------------\r
792         //\r
793         // Testing feature - The "nodeName" attribute for an EntityReference node\r
794         //                   is the name of the entity referenced.\r
795         //\r
796         // Testing approach - Retrieve the first Entity Reference node from the last \r
797         //                    child of the second employee and examine its\r
798         //                    "nodeName" attribute.  It should be set to "ent2".\r
799         //\r
800         // Semantic Requirements: 13, 15 \r
801         //\r
802         //----------------------------------------------------------------------------\r
803 \r
804         [Test]\r
805         public void core0017NO()\r
806         {\r
807             string computedValue = "";\r
808             string expectedValue = "ent2";\r
809             System.Xml.XmlNode testNode = null;\r
810             System.Xml.XmlNode entRefNode = null;\r
811 \r
812             testResults results = new testResults("Core0017NO");\r
813             try\r
814             {\r
815                 results.description = "The nodeName attribute for an EntityReference Node " +\r
816                     "should be set to the name of the entity referenced.";\r
817                 //\r
818                 // Retrieve the targeted data.\r
819                 //\r
820                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
821                 entRefNode = testNode.FirstChild;//.node.\r
822                 //\r
823                 // The nodeName attribute should be set to "ent2".\r
824                 //\r
825                 computedValue = entRefNode.Name;\r
826             }\r
827             catch(System.Exception ex)\r
828             {\r
829                 computedValue = "Exception " + ex.Message;\r
830             }\r
831             //\r
832             // write out results.\r
833             //\r
834             results.expected = expectedValue;\r
835             results.actual = computedValue;\r
836 \r
837             Assert.AreEqual (results.expected, results.actual);\r
838         }\r
839         //------------------------ End test case core-0017NO --------------------------\r
840         //\r
841         //------------------------- test case core-0018NO -----------------------------\r
842         //\r
843         // Testing feature - The "nodeName" attribute for an Entity node is\r
844         //                   the entity name.\r
845         //\r
846         // Testing approach - Retrieve the first Entity declaration in the\r
847         //                    "DOCTYPE" section of the XML file and examine\r
848         //                    its "nodeName" attribute.  It should be set to\r
849         //                    "ent1" .\r
850         //\r
851         // Semantic Requirements: 13, 15 \r
852         //\r
853         //----------------------------------------------------------------------------\r
854 \r
855         [Test]\r
856         public void core0018NO()\r
857         {\r
858             string computedValue = "";\r
859             string expectedValue = "ent1";\r
860             System.Xml.XmlNode testNode = null;\r
861 \r
862             testResults results = new testResults("Core0018NO");\r
863             results.description = "The nodeName attribute for an Entity Node " +\r
864                 "should be set to the entity name.";\r
865             //\r
866             // Get the targeted data.\r
867             //\r
868             testNode = util.getEntity("ent1");\r
869             //\r
870             // The nodeName attribute should be set to "ent1".\r
871             //\r
872             computedValue = testNode.Name;\r
873             //\r
874             // write out results.\r
875             //\r
876             results.expected = expectedValue;\r
877             results.actual = computedValue;\r
878 \r
879             Assert.AreEqual (results.expected, results.actual);\r
880         }\r
881 \r
882         //------------------------ End test case core-0018NO --------------------------\r
883         //\r
884         //------------------------- test case core-0019NO -----------------------------\r
885         //\r
886         // Testing feature - The "nodeName" attribute for a ProcessingInstruction\r
887         //                   node is the target.\r
888         //\r
889         // Testing approach - Retrieve the first declaration in the XML file\r
890         //                    and examine its "nodeName" attribute.  It should\r
891         //                    be set to "xml".\r
892         //\r
893         // Semantic Requirements: 13, 15 \r
894         //\r
895         //----------------------------------------------------------------------------\r
896 \r
897         [Test]\r
898         public void core0019NO()\r
899         {\r
900             string computedValue = "0";\r
901             string expectedValue = "xml";\r
902             System.Xml.XmlNode testNode = null;\r
903 \r
904             testResults results = new testResults("Core0019NO");\r
905             results.description = "The nodeName attribute for a ProcessingInstruction "+\r
906                 "Node should be set to the target.";\r
907             //\r
908             // Get the targeted data.\r
909             //\r
910             testNode = util.getDOMDocument().ChildNodes.Item(0);\r
911             //\r
912             // The nodeName attribute should be set to "xml".\r
913             //\r
914             computedValue = testNode.Name;\r
915             //\r
916             // write out results.\r
917             //\r
918             results.expected = expectedValue;\r
919             results.actual = computedValue;\r
920 \r
921             Assert.AreEqual (results.expected, results.actual);\r
922         }\r
923 \r
924         //------------------------ End test case core-0019NO --------------------------\r
925         //\r
926         //------------------------- test case core-0020NO -----------------------------\r
927         //\r
928         // Testing feature - The "nodeName" attribute for a comment node is\r
929         //                   "#comment".\r
930         //\r
931         // Testing approach - Retrieve the only comment in the XML file (third child)\r
932         //                    and examine its "nodeName" attribute.  It should\r
933         //                    be set to "#comment".\r
934         //\r
935         // Semantic Requirements: 13, 15 \r
936         //\r
937         //----------------------------------------------------------------------------\r
938 \r
939         [Test]\r
940         public void core0020NO()\r
941         {\r
942             string computedValue = "0";\r
943             string expectedValue = "#comment";\r
944             System.Xml.XmlNode testNode = null;\r
945 \r
946             testResults results = new testResults("Core0020NO");\r
947             results.description = "The nodeName attribute for a comment Node "+\r
948                 "should be set to \"#comment\".";\r
949             //\r
950             // Get the targeted data.\r
951             //\r
952             testNode = util.getDOMDocument().ChildNodes.Item(2);      \r
953             //\r
954             // The nodeName attribute should be set to "#comment".\r
955             //\r
956             computedValue = testNode.Name;\r
957             //\r
958             // write out results.\r
959             //\r
960             results.expected = expectedValue;\r
961             results.actual = computedValue;\r
962 \r
963             Assert.AreEqual (results.expected, results.actual);\r
964         }\r
965 \r
966         //------------------------ End test case core-0020NO --------------------------\r
967         //\r
968         //------------------------- test case core-0021NO -----------------------------\r
969         //\r
970         // Testing feature - The "nodeName" attribute for a Document node is\r
971         //                   "#document".\r
972         //\r
973         // Testing approach - Retrieve the DOM Document and examine its\r
974         //                    "nodeName" attribute.  It should be set to "#document".\r
975         //\r
976         // Semantic Requirements: 13, 15 \r
977         //\r
978         //----------------------------------------------------------------------------\r
979 \r
980         [Test]\r
981         public void core0021NO()\r
982         {\r
983             string computedValue = "";\r
984             string expectedValue = "#document";\r
985             System.Xml.XmlNode testNodeNode = null;\r
986 \r
987             testResults results = new testResults("Core0021NO");\r
988             results.description = "The nodeName attribute for a Document Node "+\r
989                 "should be set to \"#document\".";\r
990             //\r
991             // Get the targeted data.\r
992             //\r
993             System.Xml.XmlNode testNode = util.getDOMDocument();\r
994             //\r
995             // The nodeName attribute should be set to "#document". \r
996             //\r
997             computedValue = testNode.Name;\r
998             //\r
999             // write out results.\r
1000             //\r
1001             results.expected = expectedValue;\r
1002             results.actual = computedValue;\r
1003 \r
1004             Assert.AreEqual (results.expected, results.actual);\r
1005         }\r
1006 \r
1007         //------------------------ End test case core-0021NO --------------------------\r
1008         //\r
1009         //------------------------- test case core-0022NO -----------------------------\r
1010         //\r
1011         // Testing feature - The "nodeName" attribute for a DocumentType node is\r
1012         //                   the document type name.\r
1013         //\r
1014         // Testing approach - Retrieve the DOCTYPE declaration (second child) from\r
1015         //                    the XML file and examine its "nodeName" attribute.\r
1016         //                    It should be set to "staff". \r
1017         //\r
1018         // Semantic Requirements: 13, 15 \r
1019         //\r
1020         //----------------------------------------------------------------------------\r
1021 \r
1022         [Test]\r
1023         public void core0022NO()\r
1024         {\r
1025             string computedValue = "";\r
1026             string expectedValue = "staff";\r
1027             System.Xml.XmlNode testNode = null;\r
1028 \r
1029             testResults results = new testResults("Core0022NO");\r
1030             results.description = "The nodeName attribute for a DocumentType Node " +\r
1031                 "should be set to the document type name.";\r
1032             //\r
1033             // Get the targeted data.\r
1034             //\r
1035             testNode = util.getDocType();\r
1036             //\r
1037             // The nodeName attribute should be set to "staff".\r
1038             //\r
1039             computedValue = testNode.Name;\r
1040             //\r
1041             // write out results.\r
1042             //\r
1043             results.expected = expectedValue;\r
1044             results.actual = computedValue;\r
1045 \r
1046             Assert.AreEqual (results.expected, results.actual);\r
1047         }\r
1048 \r
1049         //------------------------ End test case core-0022NO ------------------------\r
1050         //\r
1051         //------------------------- test case core-0023NO -----------------------------\r
1052         //\r
1053         // Testing feature - The "nodeName" attribute for a DocumentFragment node\r
1054         //                   is "#document-fragment".\r
1055         //\r
1056         // Testing approach - Retrieve the whole DOM document and invoke its\r
1057         //                    "createDocumentFragment()" method and examine the\r
1058         //                    "nodeName" attribute of the returned node.  It should\r
1059         //                    be set to "#document-fragment". \r
1060         //\r
1061         // Semantic Requirements: 13, 15 \r
1062         //\r
1063         //----------------------------------------------------------------------------\r
1064 \r
1065         [Test]\r
1066         public void core0023NO()\r
1067         {\r
1068             string computedValue = "";\r
1069             string expectedValue = "#document-fragment";\r
1070             System.Xml.XmlNode testNode = null;\r
1071 \r
1072             testResults results = new testResults("Core0023NO");\r
1073             results.description = "The nodeName attribute for a DocumentFragment Node "+\r
1074                 "should be set to \"#document-fragment\".";\r
1075             //\r
1076             // Get the targeted data.\r
1077             //\r
1078             testNode = util.getDOMDocument().CreateDocumentFragment();\r
1079             //\r
1080             // The nodeName attribute should be set to "#document-fragment".\r
1081             //\r
1082             computedValue = testNode.Name;\r
1083             //\r
1084             // write out results.\r
1085             //\r
1086             results.expected = expectedValue;\r
1087             results.actual = computedValue;\r
1088 \r
1089             Assert.AreEqual (results.expected, results.actual);\r
1090         }\r
1091 \r
1092         //------------------------ End test case core-0023NO --------------------------\r
1093         //\r
1094         //------------------------- test case core-0024NO -----------------------------\r
1095         //\r
1096         // Testing feature - The "nodeName" attribute for a notation node is\r
1097         //                   the name of the notation.\r
1098         //\r
1099         // Testing approach - Retrieve the Notation declaration inside the\r
1100         //                    DocumentType node and examine its "nodeName"\r
1101         //                    attribute.  It should be set to "notation1".\r
1102         //\r
1103         // Semantic Requirements: 13, 15 \r
1104         //\r
1105         //----------------------------------------------------------------------------\r
1106 \r
1107         [Test]\r
1108         public void core0024NO()\r
1109         {\r
1110             string computedValue = "";\r
1111             string expectedValue = "notation1";\r
1112             System.Xml.XmlNode testNode = null;\r
1113 \r
1114             testResults results = new testResults("Core0024NO");\r
1115             try\r
1116             {\r
1117                 results.description = "The nodeName attribute for a Notation Node " +\r
1118                     "should be set to the notation name.";\r
1119                 //\r
1120                 // Get the targeted data.\r
1121                 //\r
1122                 testNode = util.getNotation("notation1");\r
1123                 //\r
1124                 // The nodeName attribute should be set to "notation1".\r
1125                 //\r
1126                 computedValue = testNode.Name;\r
1127             }\r
1128             catch(System.Exception ex)\r
1129             {\r
1130                 computedValue = "Exception " + ex.Message;\r
1131             }\r
1132             //\r
1133             // write out results.\r
1134             //\r
1135             results.expected = expectedValue;\r
1136             results.actual = computedValue;\r
1137 \r
1138             Assert.AreEqual (results.expected, results.actual);\r
1139         }\r
1140 \r
1141         //------------------------ End test case core-0024NO --------------------------\r
1142         //\r
1143         //------------------------   test case core-0025NO ----------------------------\r
1144         //\r
1145         // Testing feature - The "nodeValue" attribute for an Element node is\r
1146         //                   null.\r
1147         //\r
1148         // Testing approach - Retrieve the root node of the DOM object and check\r
1149         //                    its "nodeValue" attribute.  It should be equal\r
1150         //                    to null.\r
1151         //\r
1152         // Semantic Requirements: 13, 16 \r
1153         //\r
1154         //----------------------------------------------------------------------------\r
1155 \r
1156         [Test]\r
1157         public void core0025NO()\r
1158         {\r
1159             object computedValue = null;\r
1160             object expectedValue = null;\r
1161 \r
1162             testResults results = new testResults("Core0025NO");\r
1163             results.description = "The nodeValue attribute for an Element Node " +\r
1164                 "should be set to null.";\r
1165             //\r
1166             // The nodeValue attribute should be set to null.\r
1167             //\r
1168             computedValue = util.getRootNode().Value;\r
1169             //\r
1170             // write out results.\r
1171             //\r
1172             results.expected = (expectedValue == null).ToString();\r
1173             results.actual = (computedValue == null).ToString();\r
1174 \r
1175             Assert.AreEqual (results.expected, results.actual);\r
1176         }\r
1177 \r
1178         //------------------------ End test case core-0025NO --------------------------\r
1179         //\r
1180         //------------------------- test case core-0026NO -----------------------------\r
1181         //\r
1182         // Testing feature - The "nodeValue" attribute for an Attribute node is\r
1183         //                   the value of the attribute.\r
1184         //\r
1185         // Testing approach - Retrieve the attribute named "domestic" from the last \r
1186         //                    child of the first employee.  Its "nodeValue" attribute \r
1187         //                    is then checked, it should be set to "Yes".\r
1188         //\r
1189         // Semantic Requirements: 13, 16\r
1190         //\r
1191         //----------------------------------------------------------------------------\r
1192 \r
1193         [Test]\r
1194         public void core0026NO()\r
1195         {\r
1196             string computedValue = "";\r
1197             string expectedValue = "Yes";\r
1198             System.Xml.XmlElement testNode = null;\r
1199             System.Xml.XmlAttribute attrNode = null;\r
1200 \r
1201             testResults results = new testResults("Core0026NO");\r
1202             try\r
1203             {\r
1204                 results.description = "The nodeValue attribute for an Attribute Node " +\r
1205                     "should be set to the value of the attribute.";\r
1206                 //\r
1207                 // Get the targeted data.\r
1208                 //\r
1209                 testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);\r
1210                 attrNode = testNode.GetAttributeNode("domestic");//.node.\r
1211                 //\r
1212                 // The nodeType attribute should be set to "Yes".\r
1213                 //\r
1214                 computedValue = attrNode.Value;\r
1215             }\r
1216             catch(System.Exception ex)\r
1217             {\r
1218                 computedValue = "Exception " + ex.Message;\r
1219             }\r
1220             //\r
1221             // write out results.\r
1222             //\r
1223             results.expected = expectedValue;\r
1224             results.actual = computedValue;\r
1225 \r
1226             Assert.AreEqual (results.expected, results.actual);\r
1227         }\r
1228 \r
1229         //------------------------ End test case core-0026NO --------------------------\r
1230         //\r
1231         //------------------------- test case core-0027NO -----------------------------\r
1232         //\r
1233         // Testing feature - The "nodeValue" attribute for a Text node is\r
1234         //                   content of the Text node.\r
1235         //\r
1236         // Testing approach - Retrieve the Text data from the last child of the\r
1237         //                    first employee and and examine its "nodeValue"\r
1238         //                    attribute.  It should be set to \r
1239         //                    "1230 North Ave. Dallas, Texas 98551". \r
1240         //\r
1241         // Semantic Requirements: 13, 16\r
1242         //\r
1243         //----------------------------------------------------------------------------\r
1244 \r
1245         [Test]\r
1246         public void core0027NO()\r
1247         {\r
1248             string computedValue = "";\r
1249             string expectedValue = "1230 North Ave. Dallas, Texas 98551";\r
1250             System.Xml.XmlNode testNode = null;\r
1251             System.Xml.XmlNode textNode = null;\r
1252 \r
1253             testResults results = new testResults("Core0027NO");\r
1254             try\r
1255             {\r
1256                 results.description = "The nodeValue attribute for a Text node " +\r
1257                     "should be set to contents of the of the Text node.";\r
1258                 //\r
1259                 // Get the targeted data.\r
1260                 //\r
1261                 testNode = util.nodeObject(util.FIRST,util.SIXTH);\r
1262                 textNode = testNode.FirstChild;//.node.\r
1263                 //\r
1264                 // Retrieve the nodeValue attribute.\r
1265                 //\r
1266                 computedValue = textNode.Value;\r
1267             }\r
1268             catch(System.Exception ex)\r
1269             {\r
1270                 computedValue = "Exception " + ex.Message;\r
1271             }\r
1272             //\r
1273             // write out results.\r
1274             //\r
1275             results.expected = expectedValue;\r
1276             results.actual = computedValue;\r
1277 \r
1278             Assert.AreEqual (results.expected, results.actual);\r
1279         }\r
1280 \r
1281         //------------------------ End test case core-0027NO --------------------------\r
1282         //\r
1283         //------------------------- test case core-0028NO -----------------------------\r
1284         //\r
1285         // Testing feature - The "nodeValue" attribute for a CDATASection node is\r
1286         //                   the content of the CDATASection.\r
1287         //\r
1288         // Testing approach - Retrieve the first CDATASection node inside the second \r
1289         //                    child of the second employee and examine its "nodeValue" \r
1290         //                    attribute.  It should be set to "This is a CDATA Section\r
1291         //                    with EntityReference number 2 &ent2;".\r
1292         //\r
1293         // Semantic Requirements: 13, 16\r
1294         //\r
1295         //----------------------------------------------------------------------------\r
1296 \r
1297         [Test]\r
1298         public void core0028NO()\r
1299         {\r
1300             string computedValue = "0";\r
1301             string expectedValue = "This is a CDATASection with EntityReference number 2 &ent2;";\r
1302             System.Xml.XmlNode testNode = null;\r
1303             System.Xml.XmlNode cDataNode = null;\r
1304 \r
1305             testResults results = new testResults("Core0028NO");\r
1306             try\r
1307             {\r
1308                 results.description = "The nodeValue attribute for a CDATASection Node "+\r
1309                     "should be set to the contents of the CDATASection."; \r
1310                 //\r
1311                 // Retrieve the targeted data.\r
1312                 //\r
1313                 testNode = util.nodeObject(util.SECOND,util.SECOND);\r
1314                 cDataNode = testNode.ChildNodes.Item(1);//.node.\r
1315                 //\r
1316                 // Get the "nodeValue" attribute.\r
1317                 //\r
1318                 computedValue = cDataNode.Value;\r
1319             }\r
1320             catch(System.Exception ex)\r
1321             {\r
1322                 computedValue = "Exception " + ex.Message;\r
1323             }\r
1324             //\r
1325             // write out results.\r
1326             //\r
1327             results.expected = expectedValue;\r
1328             results.actual = computedValue;\r
1329 \r
1330             Assert.AreEqual (results.expected, results.actual);\r
1331         }\r
1332 \r
1333         //------------------------ End test case core-0028NO --------------------------\r
1334         //\r
1335         //------------------------- test case core-0029NO -----------------------------\r
1336         //\r
1337         // Testing feature - The "nodeValue" attribute for an EntityReference node\r
1338         //                   is null.\r
1339         //\r
1340         // Testing approach - Retrieve the first Entity Reference node from the last\r
1341         //                    child of the second employee and examine its\r
1342         //                    "nodeValue" attribute.  It should be set to null.\r
1343         //\r
1344         // Semantic Requirements: 13, 16\r
1345         //\r
1346         //----------------------------------------------------------------------------\r
1347 \r
1348         [Test]\r
1349         public void core0029NO()\r
1350         {\r
1351             object computedValue = null;\r
1352             object expectedValue = null;\r
1353             System.Xml.XmlNode testNode = null;\r
1354             System.Xml.XmlNode entRefNode = null;\r
1355 \r
1356             testResults results = new testResults("Core0029NO");\r
1357             try\r
1358             {\r
1359                 results.description = "The nodeValue attribute for an EntityReference "+\r
1360                     "node should be set to null.";\r
1361                 //\r
1362                 // Get the targeted data.\r
1363                 //\r
1364                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
1365                 entRefNode = testNode.FirstChild;//.node.\r
1366                 //\r
1367                 // The nodeValue attribute should be set to null.\r
1368                 //\r
1369                 computedValue = entRefNode.Value;\r
1370             }\r
1371             catch(System.Exception ex)\r
1372             {\r
1373                 computedValue = "Exception " + ex.Message;\r
1374             }\r
1375             //\r
1376             // write out results.\r
1377             //\r
1378             results.expected = (expectedValue == null).ToString();\r
1379             results.actual = (computedValue == null).ToString();\r
1380 \r
1381             Assert.AreEqual (results.expected, results.actual);\r
1382         }\r
1383 \r
1384         //------------------------ End test case core-0029NO --------------------------\r
1385         //\r
1386         //------------------------- test case core-0030NO -----------------------------\r
1387         //\r
1388         // Testing feature - The "nodeValue" attribute for an Entity node\r
1389         //                   is null.\r
1390         //\r
1391         // Testing approach - Retrieve the first Entity declaration in the\r
1392         //                    "DOCTYPE" section of the XML file and examine\r
1393         //                    its "nodeValue" attribute.  It should be set to\r
1394         //                    null.\r
1395         //\r
1396         // Semantic Requirements: 13, 16\r
1397         //\r
1398         //----------------------------------------------------------------------------\r
1399 \r
1400         [Test]\r
1401         public void core0030NO()\r
1402         {\r
1403             object computedValue = null;\r
1404             object expectedValue = null;\r
1405             System.Xml.XmlNode testNode = null;\r
1406 \r
1407             testResults results = new testResults("Core0030NO");\r
1408             results.description = "The nodeValue attribute for an Entity node " +\r
1409                 "should be set to null.";\r
1410             //\r
1411             // Get the targeted data.\r
1412             //\r
1413             testNode = util.getEntity("ent1");;\r
1414             //\r
1415             // The nodeValue attribute should be set to null.\r
1416             //\r
1417             computedValue = testNode.Value;\r
1418             //\r
1419             // write out results.\r
1420             //\r
1421             results.expected = (expectedValue == null).ToString();\r
1422             results.actual = (computedValue == null).ToString();\r
1423 \r
1424             Assert.AreEqual (results.expected, results.actual);\r
1425         }\r
1426 \r
1427         //------------------------ End test case core-0030NO --------------------------\r
1428         //\r
1429         //------------------------- test case core-0031NO -----------------------------\r
1430         //\r
1431         // Testing feature - The "nodeValue" attribute for a ProcessingInstruction\r
1432         //                   node is the entire content excluding the target.\r
1433         //\r
1434         // Testing approach - Retrieve the first declaration in the XML file\r
1435         //                    and examine its "nodeValue" attribute.  It should\r
1436         //                    be set to "version="1.0"".\r
1437         //\r
1438         // Semantic Requirements: 13, 16\r
1439         //\r
1440         //----------------------------------------------------------------------------\r
1441 \r
1442         [Test]\r
1443         public void core0031NO()\r
1444         {\r
1445             string computedValue = "";\r
1446             string expectedValue = "version=\"1.0\"";\r
1447             System.Xml.XmlNode testNode = null;\r
1448 \r
1449             testResults results = new testResults("Core0031NO");\r
1450             results.description = "The nodeValue attribute for a ProcessingInstruction "+\r
1451                 "node is the entire contents excluding the target.";\r
1452             //\r
1453             // Get the targeted data.\r
1454             //\r
1455             testNode = util.getDOMDocument().ChildNodes.Item(0);\r
1456             //\r
1457             // The nodeValue attribute should be set to "version="1.0"".\r
1458             //\r
1459             computedValue = testNode.Value;\r
1460             //\r
1461             // write out results.\r
1462             //\r
1463             results.expected = expectedValue;\r
1464             results.actual = computedValue;\r
1465 \r
1466             Assert.AreEqual (results.expected, results.actual);\r
1467         }\r
1468 \r
1469         //------------------------ End test case core-0031NO --------------------------\r
1470         //\r
1471         //------------------------- test case core-0032NO -----------------------------\r
1472         //\r
1473         // Testing feature - The "nodeValue" attribute for a comment node is\r
1474         //                   the content of the comment.\r
1475         //\r
1476         // Testing approach - Retrieve the only comment in the XML file (third child)\r
1477         //                    and examine its "nodeValue" attribute.  It should\r
1478         //                    be set to " This is comment number 1.".\r
1479         //\r
1480         // Semantic Requirements: 13, 16\r
1481         //\r
1482         //----------------------------------------------------------------------------\r
1483 \r
1484         [Test]\r
1485         public void core0032NO()\r
1486         {\r
1487             string computedValue = "";\r
1488             string expectedValue = " This is comment number 1.";\r
1489             System.Xml.XmlNode testNode = null;\r
1490 \r
1491             testResults results = new testResults("Core0032NO");\r
1492             results.description = "The nodeValue attribute for a comment node " +\r
1493                 "should be set to the contents of the comment.";\r
1494             //\r
1495             // Get the targeted data.\r
1496             //\r
1497             testNode = util.getDOMDocument().ChildNodes.Item(2);\r
1498             //\r
1499             // The nodeValue attribute should be set to " This is comment number 1."\r
1500             //\r
1501             computedValue = testNode.Value;\r
1502             //\r
1503             // write out results.\r
1504             //\r
1505             results.expected = expectedValue;\r
1506             results.actual = computedValue;\r
1507 \r
1508             Assert.AreEqual (results.expected, results.actual);\r
1509         }\r
1510 \r
1511         //------------------------ End test case core-0032NO --------------------------\r
1512         //\r
1513         //------------------------- test case core-0033NO -----------------------------\r
1514         //\r
1515         // Testing feature - The "nodeValue" attribute for a Document node is\r
1516         //                   null.\r
1517         //\r
1518         // Testing approach - Retrieve the DOM Document and examine its\r
1519         //                    "nodeValue" attribute.  It should be set to null.\r
1520         //\r
1521         // Semantic Requirements: 13, 16\r
1522         //\r
1523         //----------------------------------------------------------------------------\r
1524 \r
1525         [Test]\r
1526         public void core0033NO()\r
1527         {\r
1528             object computedValue = null;\r
1529             object expectedValue = null;\r
1530             System.Xml.XmlNode testNode = null;\r
1531 \r
1532             testResults results = new testResults("Core0033NO");\r
1533             results.description = "The nodeValue attribute for a Document node "+\r
1534                 "should be set to null.";\r
1535             //\r
1536             // Get the targeted data.\r
1537             //\r
1538             testNode = util.getDOMDocument();\r
1539             //\r
1540             // The nodeValue attribute should be set to null.\r
1541             //\r
1542             computedValue = testNode.Value;\r
1543             //\r
1544             // write out results.\r
1545             //\r
1546             results.expected = (expectedValue == null).ToString();\r
1547             results.actual = (computedValue == null).ToString();\r
1548 \r
1549             Assert.AreEqual (results.expected, results.actual);\r
1550         }\r
1551 \r
1552         //------------------------ End test case core-0033NO --------------------------\r
1553         //\r
1554         //------------------------- test case core-0034NO -----------------------------\r
1555         //\r
1556         // Testing feature - The "nodeValue" attribute for a DocumentType node is\r
1557         //                   null.\r
1558         //\r
1559         // Testing approach - Retrieve the DOCTYPE declaration (second child) from\r
1560         //                    the XML file and examine its "nodeValue" attribute.\r
1561         //                    It should be set to null.\r
1562         //\r
1563         // Semantic Requirements: 13, 16\r
1564         //\r
1565         //----------------------------------------------------------------------------\r
1566 \r
1567         [Test]\r
1568         public void core0034NO()\r
1569         {\r
1570             object computedValue = null;\r
1571             object expectedValue = null;\r
1572             System.Xml.XmlNode testNode = null;\r
1573 \r
1574             testResults results = new testResults("Core0034NO");\r
1575             results.description = "The nodeValue attribute for a DocumentType Node " +\r
1576                 "should be set to null.";\r
1577             //\r
1578             // Get the targeted data.\r
1579             //\r
1580             testNode = util.getDOMDocument().ChildNodes.Item(1);\r
1581             //\r
1582             // The nodeValue attribute should be set to null.\r
1583             //\r
1584             computedValue = testNode.Value;\r
1585             //\r
1586             // write out results.\r
1587             //\r
1588             results.expected = (expectedValue == null).ToString();\r
1589             results.actual = (computedValue == null).ToString();\r
1590 \r
1591             Assert.AreEqual (results.expected, results.actual);\r
1592         }\r
1593 \r
1594         //------------------------ End test case core-0034NO ------------------------\r
1595         //\r
1596         //------------------------- test case core-0035NO -----------------------------\r
1597         //\r
1598         // Testing feature - The "nodeValue" attribute for a DocumentFragment node\r
1599         //                   is null.\r
1600         //\r
1601         // Testing approach - Retrieve the whole DOM document and invoke its\r
1602         //                    "createDocumentFragment()" method and examine the\r
1603         //                    "nodeValue" attribute of the returned node.  It should\r
1604         //                    be set to null.\r
1605         //\r
1606         // Semantic Requirements: 13, 16\r
1607         //\r
1608         //----------------------------------------------------------------------------\r
1609 \r
1610         [Test]\r
1611         public void core0035NO()\r
1612         {\r
1613             object computedValue = null;\r
1614             object expectedValue = null;\r
1615             System.Xml.XmlNode testNode = null;\r
1616 \r
1617             testResults results = new testResults("Core0035NO");\r
1618             results.description = "The nodeValue attribute for a DocumentFragment node " +\r
1619                 "should be set to null.";\r
1620             //\r
1621             // Get the targeted data.\r
1622             //\r
1623             testNode = util.getDOMDocument().CreateDocumentFragment();\r
1624             //\r
1625             // The nodeValue attribute should be set to null.\r
1626             //\r
1627             computedValue = testNode.Value;\r
1628             //\r
1629             // write out results.\r
1630             //\r
1631             results.expected = (expectedValue == null).ToString();\r
1632             results.actual = (computedValue == null).ToString();\r
1633 \r
1634             Assert.AreEqual (results.expected, results.actual);\r
1635         }\r
1636 \r
1637         //------------------------ End test case core-0035NO --------------------------\r
1638         //\r
1639         //------------------------- test case core-0036NO -----------------------------\r
1640         //\r
1641         // Testing feature - The "nodeValue" attribute for a notation node is\r
1642         //                   the name of the notation.\r
1643         //\r
1644         // Testing approach - Retrieve the Notation declaration inside the\r
1645         //                    DocumentType node and examine its nodeValue \r
1646         //                    attribute.  It should be set to null.\r
1647         //\r
1648         // Semantic Requirements: 13, 16\r
1649         //\r
1650         //----------------------------------------------------------------------------\r
1651 \r
1652         [Test]\r
1653         public void core0036NO()\r
1654         {\r
1655             object computedValue = null;\r
1656             object expectedValue = null;\r
1657             System.Xml.XmlNode testNode = null;\r
1658 \r
1659             testResults results = new testResults("Core0036NO");\r
1660             try\r
1661             {\r
1662                 results.description = "The nodeValue attribute for a Notation node " +\r
1663                     "should be set to null.";\r
1664                 //\r
1665                 // Get the targeted data.\r
1666                 //\r
1667                 testNode = util.getNotation("notation1");\r
1668                 //\r
1669                 // The nodeValue attribute should be set to null.\r
1670                 //\r
1671                 computedValue = testNode.Value;\r
1672             }\r
1673             catch(System.Exception ex)\r
1674             {\r
1675                 computedValue = "Exception " + ex.Message;\r
1676             }\r
1677             //\r
1678             // write out results.\r
1679             //\r
1680             results.expected = (expectedValue == null).ToString();\r
1681             results.actual = (computedValue == null).ToString();\r
1682 \r
1683             Assert.AreEqual (results.expected, results.actual);\r
1684         }\r
1685 \r
1686         //------------------------ End test case core-0036NO --------------------------\r
1687         //\r
1688         //------------------------   test case core-0037NO ----------------------------\r
1689         //\r
1690         // Testing feature - The "attributes" attribute for an Element node is\r
1691         //                   a NamedNodeMap.\r
1692         //\r
1693         // Testing approach - Retrieve the last child of the third employee\r
1694         //                    and examine its "attributes" attribute.  It should be \r
1695         //                    equal to a NamedNodeMap of its attributes. \r
1696         //\r
1697         // Semantic Requirements: 13, 17\r
1698         //\r
1699         //----------------------------------------------------------------------------\r
1700 \r
1701         [Test]\r
1702         public void core0037NO()\r
1703         {\r
1704             string computedValue = "";\r
1705             string expectedValue = "";\r
1706             System.Xml.XmlNode testNode = null;\r
1707             string testName = "core-0037NO";\r
1708 \r
1709             testResults results = new testResults("core0037NO");\r
1710             try\r
1711             {\r
1712                 results.description += "The \"attributes\" attribute for an Element node";\r
1713                 results.description += " should be set to a NamedNodeMap. ";\r
1714 \r
1715                 //\r
1716                 // Retrieve the targeted data and its attributes.\r
1717                 //\r
1718                 testNode = util.nodeObject(util.THIRD,util.SIXTH);\r
1719                 computedValue += testNode.Attributes.Item(util.FIRST).Name+" ";\r
1720                 computedValue += testNode.Attributes.Item(util.SECOND).Name;\r
1721                 //\r
1722                 // Determine the order of the NamedNodeMap items.\r
1723                 //\r
1724                 if (computedValue.Substring(0,1) == "d" && computedValue.Substring(1,1) == "o")\r
1725                     expectedValue = "domestic street";\r
1726                 else\r
1727                     expectedValue = "street domestic";\r
1728             }\r
1729             catch(System.Exception ex)\r
1730             {\r
1731                 computedValue = "Exception " + ex.Message;\r
1732             }\r
1733             //\r
1734             // write out results.\r
1735             //\r
1736             results.expected = expectedValue;\r
1737             results.actual = computedValue;\r
1738 \r
1739             Assert.AreEqual (results.expected, results.actual);\r
1740         }\r
1741 \r
1742         //------------------------ End test case core-0037NO --------------------------\r
1743         //\r
1744         //------------------------- test case core-0038NO -----------------------------\r
1745         //\r
1746         // Testing feature - The "attributes" attribute for an Attribute node is\r
1747         //                   null.\r
1748         //\r
1749         // Testing approach - Retrieve the first attribute from the last child of \r
1750         //                    the first employee and.  Its "attributes" attribute \r
1751         //                    is then checked.  It should be set to null.\r
1752         //\r
1753         // Semantic Requirements: 13, 17\r
1754         //\r
1755         //----------------------------------------------------------------------------\r
1756 \r
1757         [Test]\r
1758         public void core0038NO()\r
1759         {\r
1760             object computedValue = null;\r
1761             object expectedValue = null;\r
1762             System.Xml.XmlNode testNode = null;\r
1763             System.Xml.XmlAttribute attrNode = null;\r
1764 \r
1765             testResults results = new testResults("Core0038NO");\r
1766             try\r
1767             {\r
1768                 results.description = "The \"attributes\" attribute for an Attribute node " +\r
1769                     "should be set to null.";\r
1770                 //\r
1771                 // Retrieve the targeted data.\r
1772                 //\r
1773                 testNode = util.nodeObject(util.FIRST,util.SIXTH);\r
1774                 attrNode = (System.Xml.XmlAttribute)testNode.Attributes.Item(util.FIRST);\r
1775                 //\r
1776                 // The "attributes" attribute should be set to null.\r
1777                 //\r
1778                 computedValue = attrNode.Attributes;\r
1779             }\r
1780             catch(System.Exception ex)\r
1781             {\r
1782                 computedValue = "Exception " + ex.Message;\r
1783             }\r
1784             //\r
1785             // write out results.\r
1786             //\r
1787             results.expected = (expectedValue == null).ToString();\r
1788             results.actual = (computedValue == null).ToString();\r
1789 \r
1790             Assert.AreEqual (results.expected, results.actual);\r
1791         }\r
1792 \r
1793         //------------------------ End test case core-0038NO --------------------------\r
1794         //\r
1795         //------------------------- test case core-0039NO -----------------------------\r
1796         //\r
1797         // Testing feature - The "attributes" attribute for a Text node is\r
1798         //                   null.\r
1799         //\r
1800         // Testing approach - Retrieve the text data from the last child of the\r
1801         //                    first employee and examine its "attributes"\r
1802         //                    attribute.  It should be set to null.\r
1803         //\r
1804         // Semantic Requirements: 13, 17\r
1805         //\r
1806         //----------------------------------------------------------------------------\r
1807 \r
1808         [Test]\r
1809         public void core0039NO()\r
1810         {\r
1811             object computedValue = null;\r
1812             object expectedValue = null;\r
1813             System.Xml.XmlNode testNode = null;\r
1814             System.Xml.XmlNode textNode = null;\r
1815 \r
1816             testResults results = new testResults("Core0039NO");\r
1817             try\r
1818             {\r
1819                 results.description = "The \"attributes\" attribute for a Text node "+\r
1820                     "should be set to null.";\r
1821                 //\r
1822                 // Retrieve the targeted data.\r
1823                 //\r
1824                 testNode = util.nodeObject(util.FIRST,util.SIXTH);\r
1825                 textNode = testNode.FirstChild;//.node.\r
1826                 //\r
1827                 // The "attributes" attribute should be set to null\r
1828                 //\r
1829                 computedValue = textNode.Attributes;\r
1830             }\r
1831             catch(System.Exception ex)\r
1832             {\r
1833                 computedValue = "Exception " + ex.Message;\r
1834             }\r
1835             //\r
1836             // write out results.\r
1837             //\r
1838             results.expected = (expectedValue == null).ToString();\r
1839             results.actual = (computedValue == null).ToString();\r
1840 \r
1841             Assert.AreEqual (results.expected, results.actual);\r
1842         }\r
1843 \r
1844         //------------------------ End test case core-0039NO --------------------------\r
1845         //\r
1846         //------------------------- test case core-0040NO -----------------------------\r
1847         //\r
1848         // Testing feature - The "attributes" attribute for a CDATASection node is\r
1849         //                   null.\r
1850         //\r
1851         // Testing approach - Retrieve the CDATASection node contained inside\r
1852         //                    the second child of the second employee and\r
1853         //                    examine its "attributes" attribute.  It should be\r
1854         //                    set to null.\r
1855         //\r
1856         // Semantic Requirements: 13, 17\r
1857         //\r
1858         //----------------------------------------------------------------------------\r
1859 \r
1860         [Test]\r
1861         public void core0040NO()\r
1862         {\r
1863             object computedValue = null;\r
1864             object expectedValue = null;\r
1865             System.Xml.XmlNode testNode = null;\r
1866             System.Xml.XmlNode cDataNode = null;\r
1867 \r
1868             testResults results = new testResults("Core0040NO");\r
1869             try\r
1870             {\r
1871                 results.description = "The \"attributes\" attribute for a CDATASection "+\r
1872                     "node should be set to null.";\r
1873                 //\r
1874                 // Retrieve the targeted data.\r
1875                 //\r
1876                 testNode = util.nodeObject(util.SECOND,util.SECOND);\r
1877                 cDataNode = testNode.LastChild;//.node.\r
1878                 //\r
1879                 // The "attributes" attribute should be set to null.\r
1880                 //\r
1881                 computedValue = cDataNode.Attributes;\r
1882             }\r
1883             catch(System.Exception ex)\r
1884             {\r
1885                 computedValue = "Exception " + ex.Message;\r
1886             }\r
1887             //\r
1888             // write out results.\r
1889             //\r
1890             results.expected = (expectedValue == null).ToString();\r
1891             results.actual = (computedValue == null).ToString();\r
1892 \r
1893             Assert.AreEqual (results.expected, results.actual);\r
1894         }\r
1895 \r
1896         //------------------------ End test case core-0040NO --------------------------\r
1897         //\r
1898         //------------------------- test case core-0041NO -----------------------------\r
1899         //\r
1900         // Testing feature - The "attributes" attribute for an EntityReference node\r
1901         //                   is null.\r
1902         //\r
1903         // Testing approach - Retrieve the first Entity Reference node from the last \r
1904         //                    child of the second employee and examine its\r
1905         //                    "attributes" attribute.  It should be set to null.\r
1906         //\r
1907         // Semantic Requirements: 13, 17\r
1908         //\r
1909         //----------------------------------------------------------------------------\r
1910 \r
1911         [Test]\r
1912         public void core0041NO()\r
1913         {\r
1914             object computedValue = null;\r
1915             object expectedValue = null;\r
1916             System.Xml.XmlNode testNode = null;\r
1917             System.Xml.XmlNode entRefNode = null;\r
1918 \r
1919             testResults results = new testResults("Core0041NO");\r
1920             try\r
1921             {\r
1922                 results.description = "The \"attributes\" attribute for an "+\r
1923                     "EntityReference node should be set to null.";\r
1924                 //\r
1925                 // Retrieve the targeted data.\r
1926                 //\r
1927                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
1928                 entRefNode = testNode.FirstChild;//.node.\r
1929                 //\r
1930                 // The \"attributes\" attribute should be set to null.\r
1931                 //\r
1932                 computedValue = entRefNode.Attributes;\r
1933             }\r
1934             catch(System.Exception ex)\r
1935             {\r
1936                 computedValue = "Exception " + ex.Message;\r
1937             }\r
1938             //\r
1939             // write out results.\r
1940             //\r
1941             results.expected = (expectedValue == null).ToString();\r
1942             results.actual = (computedValue == null).ToString();\r
1943 \r
1944             Assert.AreEqual (results.expected, results.actual);\r
1945         }\r
1946         //------------------------ End test case core-0041NO --------------------------\r
1947         //\r
1948         //------------------------- test case core-0042NO -----------------------------\r
1949         //\r
1950         // Testing feature - The "attributes" attribute for an Entity node\r
1951         //                   is null.\r
1952         //\r
1953         // Testing approach - Retrieve the first Entity declaration in the\r
1954         //                    "DOCTYPE" section of the XML file and examine\r
1955         //                    its "attributes" attribute.  It should be set to\r
1956         //                    null.\r
1957         //\r
1958         // Semantic Requirements: 13, 17\r
1959         //\r
1960         //----------------------------------------------------------------------------\r
1961 \r
1962         [Test]\r
1963         public void core0042NO()\r
1964         {\r
1965             object computedValue = null;\r
1966             object expectedValue = null;\r
1967             System.Xml.XmlNode testNode = null;\r
1968 \r
1969             testResults results = new testResults("Core0042NO");\r
1970 \r
1971             results.description = "The \"attributes\" attribute for an Entity node "+\r
1972                 "should be set to null.";\r
1973             //\r
1974             // Get the targeted data.\r
1975             //\r
1976             testNode = util.getEntity("ent1");\r
1977             //\r
1978             // The "attributes" attribute should be set to null.\r
1979             //\r
1980             computedValue = testNode.Attributes;\r
1981             //\r
1982             // write out results.\r
1983             //\r
1984             results.expected = (expectedValue == null).ToString();\r
1985             results.actual = (computedValue == null).ToString();\r
1986 \r
1987             Assert.AreEqual (results.expected, results.actual);\r
1988         }\r
1989 \r
1990         //------------------------ End test case core-0042NO --------------------------\r
1991         //\r
1992         //------------------------- test case core-0043NO -----------------------------\r
1993         //\r
1994         // Testing feature - The "attributes" attribute for a ProcessingInstruction\r
1995         //                   node is null.\r
1996         //\r
1997         // Testing approach - Retrieve the first declaration in the XML file\r
1998         //                    and examine its "attributes" attribute.  It should\r
1999         //                    be set to null.\r
2000         //\r
2001         // Semantic Requirements: 13, 17\r
2002         //\r
2003         //----------------------------------------------------------------------------\r
2004 \r
2005         [Test]\r
2006         public void core0043NO()\r
2007         {\r
2008             object computedValue = null;\r
2009             object expectedValue = null;\r
2010             System.Xml.XmlNode testNode = null;\r
2011 \r
2012             testResults results = new testResults("Core0043NO");\r
2013 \r
2014             results.description = "The \"attributes\" attribute for a "+\r
2015                 "ProcessingInstruction node is null.";\r
2016             //\r
2017             // Get the targeted data.\r
2018             //\r
2019             testNode = util.getDOMDocument().ChildNodes.Item(0);\r
2020             //\r
2021             // The "attributes" attribute should be set to null.\r
2022             //\r
2023             computedValue = testNode.Attributes;\r
2024             //\r
2025             // write out results.\r
2026             //\r
2027             results.expected = (expectedValue == null).ToString();\r
2028             results.actual = (computedValue == null).ToString();\r
2029 \r
2030             Assert.AreEqual (results.expected, results.actual);\r
2031         }\r
2032 \r
2033         //------------------------ End test case core-0043NO --------------------------\r
2034         //\r
2035         //------------------------- test case core-0044NO -----------------------------\r
2036         //\r
2037         // Testing feature - The "attributes" attribute for a comment node is\r
2038         //                   null.\r
2039         //\r
2040         // Testing approach - Retrieve the third child of the DOM document and\r
2041         //                    examine its "attributes" attribute.  It should\r
2042         //                    be set to null.\r
2043         //\r
2044         // Semantic Requirements: 13, 17\r
2045         //\r
2046         //----------------------------------------------------------------------------\r
2047 \r
2048         [Test]\r
2049         public void core0044NO()\r
2050         {\r
2051             object computedValue = null;\r
2052             object expectedValue = null; \r
2053             System.Xml.XmlNode testNode = null;\r
2054 \r
2055             testResults results = new testResults("Core0044NO");\r
2056 \r
2057             results.description = "The \"attributes\" attribute for a comment node "+\r
2058                 "should be set to null.";\r
2059             //\r
2060             // Get the targeted data.\r
2061             //\r
2062             testNode = util.getDOMDocument().ChildNodes.Item(2);\r
2063             //\r
2064             // The "attributes" attribute should be set to null. \r
2065             //\r
2066             computedValue = testNode.Attributes;\r
2067             //\r
2068             // write out results.\r
2069             //\r
2070             results.expected = (expectedValue == null).ToString();\r
2071             results.actual = (computedValue == null).ToString();\r
2072 \r
2073             Assert.AreEqual (results.expected, results.actual);\r
2074         }\r
2075 \r
2076         //------------------------ End test case core-0044NO --------------------------\r
2077         //\r
2078         //------------------------- test case core-0045NO -----------------------------\r
2079         //\r
2080         // Testing feature - The "attributes" attribute for a Document node is\r
2081         //                   null.\r
2082         //\r
2083         // Testing approach - Retrieve the DOM Document and examine its\r
2084         //                    "attributes" attribute.  It should be set to null.\r
2085         //\r
2086         // Semantic Requirements: 13, 17\r
2087         //\r
2088         //----------------------------------------------------------------------------\r
2089 \r
2090         [Test]\r
2091         public void core0045NO()\r
2092         {\r
2093             object computedValue = null;\r
2094             object expectedValue = null;\r
2095             System.Xml.XmlNode testNode = null;\r
2096 \r
2097             testResults results = new testResults("Core0045NO");\r
2098 \r
2099             results.description = "The \"attributes\" attribute for a Document node "+\r
2100                 "should be set to null.";\r
2101             //\r
2102             // Get the targeted data.\r
2103             //\r
2104             testNode = util.getDOMDocument();\r
2105             //\r
2106             // The "attributes" attribute should be set to null.\r
2107             //\r
2108             computedValue = testNode.Attributes;\r
2109             //\r
2110             // write out results.\r
2111             //\r
2112             results.expected = (expectedValue == null).ToString();\r
2113             results.actual = (computedValue == null).ToString();\r
2114 \r
2115             Assert.AreEqual (results.expected, results.actual);\r
2116         }\r
2117 \r
2118         //------------------------ End test case core-0045NO --------------------------\r
2119         //\r
2120         //------------------------- test case core-0046NO -----------------------------\r
2121         //\r
2122         // Testing feature - The "attributes" attribute for a DocumentType node is\r
2123         //                   null.\r
2124         //\r
2125         // Testing approach - Retrieve the DOCTYPE declaration (second child) from\r
2126         //                    the XML file and examine its "attribute" attribute.\r
2127         //                    It should be set to null.\r
2128         //\r
2129         // Semantic Requirements: 13, 17\r
2130         //\r
2131         //----------------------------------------------------------------------------\r
2132 \r
2133         [Test]\r
2134         public void core0046NO()\r
2135         {\r
2136             object computedValue = null;\r
2137             object expectedValue = null; \r
2138             System.Xml.XmlNode testNode = null;\r
2139 \r
2140             testResults results = new testResults("Core0046NO");\r
2141 \r
2142             results.description = "The \"attribute\" attribute for a DocumentType "+\r
2143                 "node should be set to null.";\r
2144             //\r
2145             // Get the targeted data.\r
2146             //\r
2147             testNode = util.getDocType();\r
2148             //\r
2149             // The "attributes" attribute should be set to null.\r
2150             //\r
2151             computedValue = testNode.Attributes;\r
2152             //\r
2153             // write out results.\r
2154             //\r
2155             results.expected = (expectedValue == null).ToString();\r
2156             results.actual = (computedValue == null).ToString();\r
2157 \r
2158             Assert.AreEqual (results.expected, results.actual);\r
2159         }\r
2160 \r
2161         //------------------------ End test case core-0046NO ------------------------\r
2162         //\r
2163         //------------------------- test case core-0047NO ---------------------------\r
2164         //\r
2165         // Testing feature - The "attributes" attribute for a DocumentFragment node\r
2166         //                   is null.\r
2167         //\r
2168         // Testing approach - Retrieve the whole DOM document and invoke its\r
2169         //                    "createDocumentFragment()" method and examine the\r
2170         //                    "attributes" attribute of the returned node.  It\r
2171         //                    should be set to null.\r
2172         //\r
2173         // Semantic Requirements: 13, 17\r
2174         //\r
2175         //----------------------------------------------------------------------------\r
2176 \r
2177         [Test]\r
2178         public void core0047NO()\r
2179         {\r
2180             object computedValue = null;\r
2181             object expectedValue = null;\r
2182             System.Xml.XmlNode testNode = null;\r
2183 \r
2184             testResults results = new testResults("Core0047NO");\r
2185             results.description = "The \"attributes\" attribute for a DocumentFragment "+\r
2186                 "node should be set to null.";\r
2187             //\r
2188             // Get the targeted data.\r
2189             //\r
2190             testNode = util.getDOMDocument().CreateDocumentFragment();\r
2191             //\r
2192             // The "attributes" attribute should be set to null.\r
2193             //\r
2194             computedValue = testNode.Attributes;\r
2195             //\r
2196             // write out results.\r
2197             //\r
2198             results.expected = (expectedValue == null).ToString();\r
2199             results.actual = (computedValue == null).ToString();\r
2200 \r
2201             Assert.AreEqual (results.expected, results.actual);\r
2202         }\r
2203 \r
2204         //------------------------ End test case core-0047NO --------------------------\r
2205         //\r
2206         //------------------------- test case core-0048NO -----------------------------\r
2207         //\r
2208         // Testing feature - The "attributes" attribute for a notation node is\r
2209         //                   null.\r
2210         //\r
2211         // Testing approach - Retrieve the Notation declaration inside the\r
2212         //                    DocumentType node and examine its "attributes"\r
2213         //                    attribute.  It should be set to null.\r
2214         //\r
2215         // Semantic Requirements: 13, 17\r
2216         //\r
2217         //----------------------------------------------------------------------------\r
2218 \r
2219         [Test]\r
2220         public void core0048NO()\r
2221         {\r
2222             object computedValue = null;\r
2223             object expectedValue = null;\r
2224             System.Xml.XmlNode testNode = null;\r
2225 \r
2226             testResults results = new testResults("Core0048NO");\r
2227             try\r
2228             {\r
2229                 results.description = "The \"attributes\" attribute for a Notation node "+\r
2230                     "should be set to null.";\r
2231                 //\r
2232                 // Get the targeted data.\r
2233                 //\r
2234                 testNode = util.getNotation("notation1");\r
2235                 //\r
2236                 // The "attributes" attribute should be set to null.\r
2237                 //\r
2238                 computedValue = testNode.Attributes;\r
2239             }\r
2240             catch(System.Exception ex)\r
2241             {\r
2242                 computedValue = "Exception " + ex.Message;\r
2243             }\r
2244             //\r
2245             // write out results.\r
2246             //\r
2247             results.expected = (expectedValue == null).ToString();\r
2248             results.actual = (computedValue == null).ToString();\r
2249 \r
2250             Assert.AreEqual (results.expected, results.actual);\r
2251         }\r
2252 \r
2253         //------------------------ End test case core-0048NO --------------------------\r
2254         //\r
2255         //------------------------- test case core-0049NO -----------------------------\r
2256         //\r
2257         // Testing feature - The "parentNode" attribute contains the parent of \r
2258         //                   this node.\r
2259         //\r
2260         // Testing approach - Retrieve the second employee and examine its\r
2261         //                    "parentNode" attribute.  It should be set\r
2262         //                    to "staff".\r
2263         //\r
2264         // Semantic Requirements: 18\r
2265         //\r
2266         //----------------------------------------------------------------------------\r
2267 \r
2268         [Test]\r
2269         public void core0049NO()\r
2270         {\r
2271             string computedValue = "";\r
2272             string expectedValue = "staff";\r
2273             System.Xml.XmlNode testNode = null;\r
2274             System.Xml.XmlNode testNodeParent = null;\r
2275 \r
2276             testResults results = new testResults("Core0049NO");\r
2277             try\r
2278             {\r
2279                 results.description = "The parentNode attribute contains the parent "+\r
2280                     "node of this node.";\r
2281                 //\r
2282                 // Retrieve the targeted data and access its parent node.\r
2283                 //\r
2284                 testNode = util.nodeObject(util.SECOND,-1);\r
2285                 testNodeParent = testNode.ParentNode; //.node.\r
2286                 //\r
2287                 // The nodeName attribute should be "staff".\r
2288                 //\r
2289                 computedValue = testNodeParent.Name;\r
2290             }\r
2291             catch(System.Exception ex)\r
2292             {\r
2293                 computedValue = "Exception " + ex.Message;\r
2294             }\r
2295             //\r
2296             //  Write out results\r
2297             //\r
2298             results.expected = expectedValue;\r
2299             results.actual = computedValue;\r
2300 \r
2301             Assert.AreEqual (results.expected, results.actual);\r
2302         }\r
2303 \r
2304         //------------------------ End test case core-0049NO --------------------------\r
2305         //\r
2306         //------------------------- test case core-0050NO -----------------------------\r
2307         //\r
2308         // Testing feature - The "parentNode" attribute of a node that has just \r
2309         //                   been created and not yet added to the tree is null.\r
2310         //\r
2311         // Testing approach - Create a new "employee" Element node using the \r
2312         //                    "createElement(name)" method from the Document\r
2313         //                    interface.  Since this new node has not yet been\r
2314         //                    added to the tree, its parentNode attribute should\r
2315         //                    be null.\r
2316         //\r
2317         // Semantic Requirements: 19\r
2318         //\r
2319         //----------------------------------------------------------------------------\r
2320 \r
2321         [Test]\r
2322         public void core0050NO()\r
2323         {\r
2324             object computedValue = null;\r
2325             object expectedValue = null;\r
2326             System.Xml.XmlNode testNode = null;\r
2327 \r
2328             testResults results = new testResults("Core0050NO");\r
2329 \r
2330             results.description = "The parentNode attribute of a node that has just "+\r
2331                 "been created, but not yet added to the tree is "+\r
2332                 "null.";\r
2333             //\r
2334             // Create new node and access its parentNode attribute.\r
2335             //\r
2336             testNode = util.createNode(util.ELEMENT_NODE,"employee");\r
2337             computedValue = testNode.ParentNode;\r
2338             //\r
2339             //  Write out results.\r
2340             //\r
2341             results.expected = (expectedValue == null).ToString();\r
2342             results.actual = (computedValue == null).ToString();\r
2343 \r
2344             util.resetData();\r
2345             Assert.AreEqual (results.expected, results.actual);\r
2346         }\r
2347 \r
2348         //------------------------ End test case core-0050NO --------------------------\r
2349         //\r
2350         //------------------------- test case core-0051NO -----------------------------\r
2351         //\r
2352         // Testing feature - The "parentNode" attribute of a node that has been \r
2353         //                   been removed from the tree is null.\r
2354         //\r
2355         // Testing approach - Remove the first employee by invoking the \r
2356         //                    "removeChild(oldChild)" method and examine its \r
2357         //                    parentNode attribute.  It should be set to null.\r
2358         //\r
2359         // Semantic Requirements: 20 \r
2360         //\r
2361         //----------------------------------------------------------------------------\r
2362 \r
2363         [Test]\r
2364         public void core0051NO()\r
2365         {\r
2366             object computedValue = null;\r
2367             object expectedValue = null;\r
2368             System.Xml.XmlNode testNode = null;\r
2369             System.Xml.XmlNode removedNode = null;\r
2370 \r
2371             testResults results = new testResults("Core0051NO");\r
2372 \r
2373             results.description = "The parentNode attribute of a node that has "+\r
2374                 "been removed from the tree is null.";\r
2375             //\r
2376             // Remove the targeted data and access its parentNode attribute.\r
2377             //\r
2378             testNode = util.nodeObject(util.FIRST,-1);\r
2379             removedNode = util.getRootNode().RemoveChild(testNode);//.node\r
2380             computedValue = removedNode.ParentNode;\r
2381             //\r
2382             // Write out results.\r
2383             //\r
2384             results.expected = (expectedValue == null).ToString();\r
2385             results.actual = (computedValue == null).ToString();\r
2386 \r
2387             util.resetData();\r
2388             Assert.AreEqual (results.expected, results.actual);\r
2389         }\r
2390 \r
2391         //------------------------ End test case core-0051NO --------------------------\r
2392         //\r
2393         //------------------------- test case core-0052NO -----------------------------\r
2394         //\r
2395         // Testing feature - The "childNodes" attribute of a node contains a \r
2396         //                   NodeList of all the children of this node.\r
2397         //\r
2398         // Testing approach - Retrieve the second employee and examine its \r
2399         //                    childNodes attribute.  It should be NodeList\r
2400         //                    containing all of its children.  The length of \r
2401         //                    the list should be 9.\r
2402         //\r
2403         // Semantic Requirements: 21 \r
2404         //\r
2405         //----------------------------------------------------------------------------\r
2406 \r
2407         [Test]\r
2408         public void core0052NO()\r
2409         {\r
2410             int computedValue = 0;\r
2411             int expectedValue = 6;\r
2412             System.Xml.XmlNode testNode = null;\r
2413             System.Xml.XmlNodeList nodeList = null;\r
2414 \r
2415             testResults results = new testResults("Core0052NO");\r
2416 \r
2417             results.description = "The childNodes attribute of a node contains a "+\r
2418                 "NodeList of all the children of this node.";\r
2419             //\r
2420             // Retrieve targeted data and examine the list length.\r
2421             //\r
2422             testNode = util.nodeObject(util.SECOND,-1);\r
2423             nodeList = testNode.ChildNodes;//.node.\r
2424             computedValue = nodeList.Count;\r
2425             //\r
2426             //  Write out results.\r
2427             //\r
2428             results.expected = expectedValue.ToString();\r
2429             results.actual = computedValue.ToString();\r
2430 \r
2431             Assert.AreEqual (results.expected, results.actual);\r
2432         }\r
2433 \r
2434         //------------------------ End test case core-0052NO --------------------------\r
2435         //\r
2436         //------------------------- test case core-0053NO -----------------------------\r
2437         //\r
2438         // Testing feature - If a node has no children then the NodeList returned\r
2439         //                   by its childNodes attribute has no nodes.\r
2440         //\r
2441         // Testing approach - Retrieve the textual data from the first child of \r
2442         //                    of the second employee and examine its childNodes \r
2443         //                    attribute.  It should be NodeList with no nodes \r
2444         //                    in it.\r
2445         //\r
2446         // Semantic Requirements: 22\r
2447         //\r
2448         //----------------------------------------------------------------------------\r
2449 \r
2450         [Test]\r
2451         public void core0053NO()\r
2452         {\r
2453             string computedValue = "";\r
2454             string expectedValue = "0";\r
2455             string testName = "core-0053NO";\r
2456             System.Xml.XmlNode testNode = null;\r
2457             System.Xml.XmlNodeList noChildNode = null;\r
2458 \r
2459             testResults results = new testResults("Core0053NO");\r
2460             try\r
2461             {\r
2462                 results.description = "If a node has no child nodes then the NodeList "+\r
2463                     "returned by its childNodes attribute has no "+\r
2464                     "nodes."; \r
2465                 //\r
2466                 // Retrieve the targeted data and access its childNodes attribute.\r
2467                 //\r
2468                 testNode = util.nodeObject(util.SECOND,util.FIRST);\r
2469                 noChildNode = testNode.FirstChild.ChildNodes;//.node.\r
2470                 computedValue = noChildNode.Count.ToString();\r
2471             }\r
2472             catch(System.Exception ex)\r
2473             {\r
2474                 computedValue = "Exception " + ex.Message;\r
2475             }\r
2476             //\r
2477             //  Write out results.\r
2478             //\r
2479             results.expected = expectedValue;\r
2480             results.actual = computedValue;\r
2481 \r
2482             Assert.AreEqual (results.expected, results.actual);\r
2483         }\r
2484 \r
2485         //------------------------ End test case core-0053NO --------------------------\r
2486         //\r
2487         //------------------------- test case core-0054NO -----------------------------\r
2488         //\r
2489         // Testing feature - The NodeList returned by the childNodes attribute is live.\r
2490         //                   Changes on the node's children are immediately reflected\r
2491         //                   on the nodes returned by the NodeList.\r
2492         //\r
2493         // Testing approach -  Create a NodeList of the children of the second employee \r
2494         //                     and then add a newly created element (created with the \r
2495         //                     "createElement" method from the Document interface) to \r
2496         //                     the second employee by using the "append" method.  The\r
2497         //                     length attribute of the NodeList should reflect this new\r
2498         //                     addition to the child list.  It should now return the\r
2499         //                     value 7.\r
2500         // \r
2501         // Semantic Requirements: 23\r
2502         //\r
2503         //----------------------------------------------------------------------------\r
2504 \r
2505         [Test]\r
2506         public void core0054NO()\r
2507         {\r
2508             int computedValue = 0;\r
2509             int expectedValue = 7;\r
2510             System.Xml.XmlNode testNode = null;\r
2511             System.Xml.XmlNodeList nodeList = null;\r
2512 \r
2513             testResults results = new testResults("Core0054NO");\r
2514 \r
2515             results.description = "The NodeList returned by the childNodes attribute "+\r
2516                 "is live.  Changes in the children node are "+\r
2517                 "immediately reflected in the NodeList.";\r
2518             //   \r
2519             // Retrieve the targeted data and append a new Element node to it.\r
2520             //\r
2521             testNode = util.nodeObject(util.SECOND,-1);\r
2522             nodeList = testNode.ChildNodes;//.node.\r
2523             testNode.AppendChild(util.createNode(util.ELEMENT_NODE,"text3"));//.node.\r
2524             computedValue = nodeList.Count;\r
2525             //\r
2526             //  Write out results.\r
2527             //\r
2528             results.expected = expectedValue.ToString();\r
2529             results.actual = computedValue.ToString();\r
2530 \r
2531             util.resetData();\r
2532             Assert.AreEqual (results.expected, results.actual);\r
2533         }\r
2534 \r
2535         //------------------------ End test case core-0054NO --------------------------\r
2536         //\r
2537         //------------------------- test case core-0055NO -----------------------------\r
2538         //\r
2539         // Testing feature - The firstChild attribute contains the first child of this\r
2540         //                   node.\r
2541         //\r
2542         // Testing approach - Retrieve the second employee and examine its firstChild\r
2543         //                    attribute.  It should be set to a node whose tag name\r
2544         //                    "employeeId".\r
2545         //\r
2546         // Semantic Requirements: 24\r
2547         //\r
2548         //----------------------------------------------------------------------------\r
2549 \r
2550         [Test]\r
2551         public void core0055NO()\r
2552         {\r
2553             string computedValue = "";\r
2554             string expectedValue = "employeeId";\r
2555             System.Xml.XmlNode testNode = null;\r
2556             System.Xml.XmlNode firstChildNode = null;\r
2557 \r
2558             testResults results = new testResults("Core0055NO");\r
2559 \r
2560             results.description = "The firstChild attribute contains the first "+\r
2561                 "child of this node.";\r
2562             //\r
2563             // Retrieve the targeted data.\r
2564             //\r
2565             testNode = util.nodeObject(util.SECOND,-1);\r
2566             firstChildNode = testNode.FirstChild;//.node.\r
2567             //\r
2568             // Its firstChild attribute's tagName should be "employeeId".\r
2569             //\r
2570             computedValue = firstChildNode.Name;\r
2571             //\r
2572             // Write out results.\r
2573             //\r
2574             results.expected = expectedValue;\r
2575             results.actual = computedValue;\r
2576 \r
2577             Assert.AreEqual (results.expected, results.actual);\r
2578         }\r
2579 \r
2580         //------------------------ End test case core-0055NO --------------------------\r
2581         //\r
2582         //------------------------- test case core-0056NO -----------------------------\r
2583         //\r
2584         // Testing feature - If there is no first child then the firstChild attribute \r
2585         //                   returns null.\r
2586         //\r
2587         // Testing approach - Retrieve the Text node from the first child of the first \r
2588         //                    employee and examine its firstChild attribute.  It \r
2589         //                    should be set to null.\r
2590         //\r
2591         // Semantic Requirements: 25\r
2592         //\r
2593         //----------------------------------------------------------------------------\r
2594 \r
2595         [Test]\r
2596         public void core0056NO()\r
2597         {\r
2598             object computedValue = null;\r
2599             object expectedValue = null;\r
2600             System.Xml.XmlNode testNode = null;\r
2601             System.Xml.XmlNode noChildNode = null;\r
2602 \r
2603             testResults results = new testResults("Core0056NO");\r
2604             try\r
2605             {\r
2606                 results.description = "If a node does not have a first child then its "+\r
2607                     "firstChild attribute returns null.";\r
2608                 //\r
2609                 // Get the targeted data.\r
2610                 //\r
2611                 testNode = util.nodeObject(util.FIRST,util.FIRST);\r
2612                 noChildNode = testNode.FirstChild;//.node.\r
2613                 //\r
2614                 //  Its firstChild attribute should be equal to null.\r
2615                 //\r
2616                 computedValue = noChildNode.FirstChild;\r
2617             }\r
2618             catch(System.Exception ex)\r
2619             {\r
2620                 computedValue = "Exception " + ex.Message;\r
2621             }\r
2622 \r
2623             //\r
2624             // Write out results.\r
2625             //\r
2626             results.expected = (expectedValue == null).ToString();\r
2627             results.actual = (computedValue == null).ToString();\r
2628 \r
2629             Assert.AreEqual (results.expected, results.actual);\r
2630         }\r
2631 \r
2632         //------------------------ End test case core-0056NO --------------------------\r
2633         //\r
2634         //------------------------- test case core-0057NO -----------------------------\r
2635         //\r
2636         // Testing feature - The lastChild attribute contains the last child of this\r
2637         //                   node.\r
2638         //\r
2639         // Testing approach - Retrieve the second employee and examine its lastChild\r
2640         //                    attribute.  It should be set to a node whose tag name\r
2641         //                    is "address".\r
2642         //\r
2643         // Semantic Requirements: 26\r
2644         //\r
2645         //----------------------------------------------------------------------------\r
2646 \r
2647         [Test]\r
2648         public void core0057NO()\r
2649         {\r
2650             string computedValue = "";\r
2651             string expectedValue = "address";\r
2652             System.Xml.XmlNode testNode = null;\r
2653             System.Xml.XmlNode lastChildNode = null;\r
2654 \r
2655             testResults results = new testResults("Core0057NO"); \r
2656 \r
2657             results.description = "The lastChild attribute contains the last "+\r
2658                 "child of this node.";\r
2659             //\r
2660             // Retrieve the targeted data and access its lastChild attribute.\r
2661             //\r
2662             testNode = util.nodeObject(util.SECOND,-1);\r
2663             //\r
2664             // Its lastChild attribute should be equal to a node with tag name = "address".\r
2665             //\r
2666             lastChildNode = testNode.LastChild;//.node.\r
2667             computedValue = lastChildNode.Name;\r
2668             //\r
2669             // Write out results.\r
2670             //\r
2671             results.expected = expectedValue;\r
2672             results.actual = computedValue;\r
2673 \r
2674             Assert.AreEqual (results.expected, results.actual);\r
2675         }\r
2676 \r
2677         //------------------------ End test case core-0057NO --------------------------\r
2678         //\r
2679         //------------------------- test case core-0058NO -----------------------------\r
2680         //\r
2681         // Testing feature - If there is no last child then the lastChild attribute\r
2682         //                   returns null.\r
2683         //\r
2684         // Testing approach - Retrieve the Text node inside the first child of the \r
2685         //                    second employee and examine its lastChild attribute.  \r
2686         //                    It should be set to null.\r
2687         //\r
2688         // Semantic Requirements: 27\r
2689         //\r
2690         //----------------------------------------------------------------------------\r
2691 \r
2692         [Test]\r
2693         public void core0058NO()\r
2694         {\r
2695             object computedValue = null;\r
2696             object expectedValue = null;\r
2697             System.Xml.XmlNode testNode = null;\r
2698             System.Xml.XmlNode noChildNode = null;\r
2699 \r
2700             testResults results = new testResults("Core0058NO");\r
2701             try\r
2702             {\r
2703                 results.description = "If a node does not have a last child then its "+\r
2704                     "lastChild attribute returns null.";\r
2705                 //\r
2706                 // Retrieve the targeted data.\r
2707                 //\r
2708                 testNode = util.nodeObject(util.SECOND,util.FIRST);\r
2709                 noChildNode = testNode.FirstChild;//.node.\r
2710                 //\r
2711                 // Its lastChild attribute should be equal to null.\r
2712                 //\r
2713                 computedValue = noChildNode.LastChild;\r
2714             }\r
2715             catch(System.Exception ex)\r
2716             {\r
2717                 computedValue = "Exception " + ex.Message;\r
2718             }\r
2719             //\r
2720             // Write out results.\r
2721             //\r
2722             results.expected = (expectedValue == null).ToString();\r
2723             results.actual = (computedValue == null).ToString();\r
2724 \r
2725             Assert.AreEqual (results.expected, results.actual);\r
2726         }\r
2727 \r
2728         //------------------------ End test case core-0058NO --------------------------\r
2729         //\r
2730         //------------------------- test case core-0059NO -----------------------------\r
2731         //\r
2732         // Testing feature - The previousSibling attribute contains the node \r
2733         //                   immediately preceding this node.\r
2734         //\r
2735         // Testing approach - Retrieve the second child of the second employee and \r
2736         //                    examine its previousSibling attribute.  It should be set \r
2737         //                    to a node whose tag name is "employeeId".\r
2738         //\r
2739         // Semantic Requirements: 28 \r
2740         //\r
2741         //----------------------------------------------------------------------------\r
2742 \r
2743         [Test]\r
2744         public void core0059NO()\r
2745         {\r
2746             string computedValue = "";\r
2747             string expectedValue = "employeeId";\r
2748             System.Xml.XmlNode testNode = null;\r
2749             System.Xml.XmlNode itsPreviousSibling = null;\r
2750 \r
2751             testResults results = new testResults("Core0059NO");\r
2752             try\r
2753             {\r
2754                 results.description = "The previousSibling attribute contains the node "+\r
2755                     "immediately preceding this node.";\r
2756                 //\r
2757                 // Retrieve the targeted data and accesss its previousiSibling attribute.\r
2758                 //\r
2759                 testNode = util.nodeObject(util.SECOND,util.SECOND);\r
2760                 itsPreviousSibling = testNode.PreviousSibling;//.node.\r
2761                 //\r
2762                 // Its previousSibling attribute should have a tag name = "employeeId".\r
2763                 //\r
2764                 computedValue = itsPreviousSibling.Name;\r
2765             }\r
2766             catch(System.Exception ex)\r
2767             {\r
2768                 computedValue = "Exception " + ex.Message;\r
2769             }\r
2770 \r
2771             //\r
2772             // Write out results.\r
2773             //\r
2774             results.expected = expectedValue;\r
2775             results.actual = computedValue;\r
2776 \r
2777             Assert.AreEqual (results.expected, results.actual);\r
2778         }\r
2779 \r
2780         //------------------------ End test case core-0059NO --------------------------\r
2781         //\r
2782         //------------------------- test case core-0060NO -----------------------------\r
2783         //\r
2784         // Testing feature - If there is no immediately preceding node then the \r
2785         //                   previousSibling attribute returns null.\r
2786         //\r
2787         // Testing approach - Retrieve the first child of the of the second employee\r
2788         //                    employee and examine its previousSibling attribute.  \r
2789         //                    It should be set to null.\r
2790         //\r
2791         // Semantic Requirements: 29\r
2792         //\r
2793         //----------------------------------------------------------------------------\r
2794 \r
2795         [Test]\r
2796         public void core0060NO()\r
2797         {\r
2798             object computedValue = null;\r
2799             object expectedValue = null;\r
2800             System.Xml.XmlNode testNode = null;\r
2801 \r
2802             testResults results = new testResults("Core0060NO");\r
2803             try\r
2804             {\r
2805                 results.description = "If there is no node immediately preceding this "+\r
2806                     "node then the previousSibling attribute returns "+\r
2807                     "null.";\r
2808                 //\r
2809                 // Retrieve the targeted data.\r
2810                 //\r
2811                 testNode = util.nodeObject(util.SECOND,util.FIRST);\r
2812                 //\r
2813                 // Its previousSibling attribute should be equal to null.\r
2814                 //\r
2815                 computedValue = testNode.PreviousSibling;//.node.\r
2816             }\r
2817             catch(System.Exception ex)\r
2818             {\r
2819                 computedValue = "Exception " + ex.Message;\r
2820             }\r
2821 \r
2822             //\r
2823             // Write out results.\r
2824             //\r
2825             results.expected = (expectedValue == null).ToString();\r
2826             results.actual = (computedValue == null).ToString();\r
2827 \r
2828             Assert.AreEqual (results.expected, results.actual);\r
2829         }\r
2830 \r
2831         //------------------------ End test case core-0060NO --------------------------\r
2832         //\r
2833         //------------------------- test case core-0061NO -----------------------------\r
2834         //\r
2835         // Testing feature - The nextSibling attribute contains the node\r
2836         //                   immediately following this node.\r
2837         //\r
2838         // Testing approach - Retrieve the first child of the second employee and\r
2839         //                    examine its nextSibling attribute.  It should be set\r
2840         //                    to a node whose tag name is "name".\r
2841         //\r
2842         // Semantic Requirements: 30 \r
2843         //\r
2844         //----------------------------------------------------------------------------\r
2845 \r
2846         [Test]\r
2847         public void core0061NO()\r
2848         {\r
2849             string computedValue = "";\r
2850             string expectedValue = "name";\r
2851             System.Xml.XmlNode testNode = null;\r
2852             System.Xml.XmlNode itsNextSibling = null;\r
2853 \r
2854             testResults results = new testResults("Core0061NO");\r
2855             try\r
2856             {\r
2857                 results.description = "The nextSibling attribute contains the node "+\r
2858                     "immediately following this node.";\r
2859                 //\r
2860                 // Retrieve the targeted data and access its nextSibling attribute.\r
2861                 //\r
2862                 testNode = util.nodeObject(util.SECOND,util.FIRST);\r
2863                 itsNextSibling = testNode.NextSibling;//.node.\r
2864                 //\r
2865                 // Its nextSibling attribute should be a node with tag name = "name".\r
2866                 //\r
2867                 computedValue = itsNextSibling.Name;\r
2868             }\r
2869             catch(System.Exception ex)\r
2870             {\r
2871                 computedValue = "Exception " + ex.Message;\r
2872             }\r
2873 \r
2874             //\r
2875             // Write out results.\r
2876             //\r
2877             results.expected = expectedValue;\r
2878             results.actual = computedValue;\r
2879 \r
2880             Assert.AreEqual (results.expected, results.actual);\r
2881         }\r
2882 \r
2883         //------------------------ End test case core-0061NO --------------------------\r
2884         //\r
2885         //------------------------- test case core-0062NO -----------------------------\r
2886         //\r
2887         // Testing feature - If there is no node immediately following this node \r
2888         //                   then the nextSibling attribute returns null.\r
2889         //\r
2890         // Testing approach - Retrieve the last child of the second employee\r
2891         //                    and examine its nextSibling attribute.  It should \r
2892         //                    be set to null.\r
2893         //\r
2894         // Semantic Requirements: 31 \r
2895         //\r
2896         //----------------------------------------------------------------------------\r
2897 \r
2898         [Test]\r
2899         public void core0062NO()\r
2900         {\r
2901             object computedValue = null;\r
2902             object expectedValue = null;\r
2903             System.Xml.XmlNode testNode = null;\r
2904 \r
2905             testResults results = new testResults("Core0062NO");\r
2906             try\r
2907             {\r
2908                 results.description = "If there is no node immediately following this "+\r
2909                     "node then the nextSibling attribute returns null.";\r
2910                 //\r
2911                 // Retrieve the targeted data.\r
2912                 //\r
2913                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
2914                 //\r
2915                 // Its NextSibling attribute should be equal to null.\r
2916                 //\r
2917                 computedValue = testNode.NextSibling;//.node.\r
2918             }\r
2919             catch(System.Exception ex)\r
2920             {\r
2921                 computedValue = "Exception " + ex.Message;\r
2922             }\r
2923 \r
2924             //\r
2925             //  Write out results.\r
2926             //\r
2927             results.expected = (expectedValue == null).ToString();\r
2928             results.actual = (computedValue == null).ToString();\r
2929 \r
2930             Assert.AreEqual (results.expected, results.actual);\r
2931         }\r
2932 \r
2933         //------------------------ End test case core-0062NO --------------------------\r
2934         //\r
2935         //------------------------- test case core-0063NO -----------------------------\r
2936         //\r
2937         // Testing feature - The ownerDocument attribute contains the Document \r
2938         //                   associated with this node.\r
2939         //\r
2940         // Testing approach - Retrieve the second employee and examine its\r
2941         //                    ownerDocument attribute.  It should contain a\r
2942         //                    document whose documentElement attribute is equal\r
2943         //                    to "staff".\r
2944         //\r
2945         // Semantic Requirements: 32\r
2946         //\r
2947         //----------------------------------------------------------------------------\r
2948 \r
2949         [Test]\r
2950         public void core0063NO()\r
2951         {\r
2952             string computedValue = "";\r
2953             string expectedValue = "staff";\r
2954             System.Xml.XmlNode testNode = null;\r
2955             System.Xml.XmlDocument ownerDoc = null;\r
2956 \r
2957             testResults results = new testResults("Core0063NO");\r
2958 \r
2959             results.description = "The ownerDocument attribute contains the Document "+\r
2960                 "associated with this node.";\r
2961             //\r
2962             // Retrieve the targeted data and access its ownerDocument attribute.\r
2963             //\r
2964             testNode = util.nodeObject(util.SECOND,-1);\r
2965             ownerDoc = testNode.OwnerDocument;//.node.\r
2966             //\r
2967             // the nodeName of its root node should be "staff"; \r
2968             //\r
2969             computedValue = ownerDoc.DocumentElement.Name;\r
2970             //\r
2971             // Write out results.\r
2972             //\r
2973             results.expected = expectedValue;\r
2974             results.actual = computedValue;\r
2975 \r
2976             Assert.AreEqual (results.expected, results.actual);\r
2977         }\r
2978 \r
2979         //------------------------ End test case core-0063NO --------------------------\r
2980         //\r
2981         //------------------------- test case core-0064NO -----------------------------\r
2982         //\r
2983         // Testing feature - The ownerDocument attribute returns null if the\r
2984         //                   target node is itself a Document. \r
2985         //\r
2986         // Testing approach - Retrieve the master document by invoking the \r
2987         //                    "getDOMDocument()" method then examine the\r
2988         //                    ownerDocument attribute of the returned object.\r
2989         //                    It should be null.\r
2990         //\r
2991         // Semantic Requirements: 33\r
2992         //\r
2993         //----------------------------------------------------------------------------\r
2994 \r
2995         [Test]\r
2996         public void core0064NO()\r
2997         {\r
2998             object computedValue = null;\r
2999             object expectedValue = null;\r
3000             System.Xml.XmlNode testNode = null;\r
3001 \r
3002             testResults results = new testResults("Core0064NO");\r
3003 \r
3004             results.description = "The ownerDocument attribute returns null if the "+\r
3005                 "target node is itself a Document.";\r
3006             //\r
3007             // Retrieve the targeted data.\r
3008             //\r
3009             testNode = util.getDOMDocument();\r
3010             //\r
3011             //  Its ownerDocument attribute should be null. \r
3012             //\r
3013             computedValue = testNode.OwnerDocument;\r
3014             //\r
3015             // Write out results.\r
3016             //\r
3017             results.expected = (expectedValue == null).ToString();\r
3018             results.actual = (computedValue == null).ToString();\r
3019 \r
3020             Assert.AreEqual (results.expected, results.actual);\r
3021         }\r
3022 \r
3023         //------------------------ End test case core-0064NO --------------------------\r
3024         //\r
3025         //------------------------- test case core-0065NO -----------------------------\r
3026         //\r
3027         // Testing feature - The insertBefore(newChild,refChild) method inserts the\r
3028         //                   node newChild before the node refChild. \r
3029         //\r
3030         // Testing approach - Insert a newly created Element node before the fourth \r
3031         //                    child of the second employee and examine the new child\r
3032         //                    and the reference child after the insertion for correct\r
3033         //                    placement.  \r
3034         //\r
3035         // Semantic Requirements: 34\r
3036         //\r
3037         //----------------------------------------------------------------------------\r
3038 \r
3039         [Test]\r
3040         public void core0065NO()\r
3041         {\r
3042             string computedValue = "";\r
3043             string expectedValue = "newChild salary";\r
3044             System.Xml.XmlNode refChild = null;\r
3045             System.Xml.XmlElement newChild = null;\r
3046             System.Xml.XmlElement testNode = null;\r
3047 \r
3048             testResults results = new testResults("Core0065NO");\r
3049             try\r
3050             {\r
3051                 results.description = "The insertBefore(newChild,refChild) method inserts "+\r
3052                     "the node newChild before the node refChild.";\r
3053                 //\r
3054                 // Retrieve targeted data, create a new Element node to insert, define the \r
3055                 // reference node, and insert the newly created element.\r
3056                 //\r
3057                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3058                 refChild = util.nodeObject(util.SECOND,util.FOURTH);\r
3059                 newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
3060                 testNode.InsertBefore(newChild, refChild);//.node.\r
3061                 //\r
3062                 // Check that each node is in the proper position.\r
3063                 //\r
3064                 computedValue += util.getSubNodes(testNode).Item(util.FOURTH).Name+" ";\r
3065                 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;\r
3066             }\r
3067             catch(System.Exception ex)\r
3068             {\r
3069                 computedValue = "Exception " + ex.Message;\r
3070             }\r
3071             //\r
3072             // Write out results.\r
3073             //\r
3074             results.expected = expectedValue;\r
3075             results.actual = computedValue;\r
3076 \r
3077             util.resetData();\r
3078             Assert.AreEqual (results.expected, results.actual);\r
3079         }\r
3080 \r
3081         //------------------------ End test case core-0065NO --------------------------\r
3082         //\r
3083         //------------------------- test case core-0066NO -----------------------------\r
3084         //\r
3085         // Testing feature - If the refChild is null then the \r
3086         //                   insertBefore(newChild,refChild) method inserts the\r
3087         //                   node newChild at the end of the list of children.\r
3088         //\r
3089         // Testing approach - Retrieve the second employee and invoke the the \r
3090         //                    insertBefore(newChild,refChild) method with \r
3091         //                    refChild = null.  Under these conditions the\r
3092         //                    newChild should be added at the end of the list.\r
3093         //                    The last item in the list is examined after the \r
3094         //                    insertion.  The last Element node of the list \r
3095         //                    should be "newChild".\r
3096         //\r
3097         // Semantic Requirements: 35\r
3098         //\r
3099         //----------------------------------------------------------------------------\r
3100 \r
3101         [Test]\r
3102         public void core0066NO()\r
3103         {\r
3104             string computedValue = "";\r
3105             string expectedValue = "newChild";\r
3106             System.Xml.XmlNode refChild = null;\r
3107             System.Xml.XmlNode newChild = null;\r
3108             System.Xml.XmlNode testNode = null;\r
3109 \r
3110             testResults results = new testResults("Core0066NO");\r
3111 \r
3112             results.description = "If refChild is null then the insertBefore("+\r
3113                 "newChild,refChild) method inserts the node "+\r
3114                 "newChild at the end of the list.";\r
3115             //\r
3116             // Retrieve targeted data, create a new Element node to insert, define \r
3117             // the reference node and insert the newly created element\r
3118             //\r
3119             testNode = util.nodeObject(util.SECOND,-1);\r
3120             newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3121             testNode.InsertBefore(newChild, refChild);//.node.\r
3122             //\r
3123             // Retrieve the node at the end of the list.\r
3124             //\r
3125             computedValue = testNode.LastChild.Name;//.node.\r
3126             //\r
3127             // Write out results.\r
3128             //\r
3129             results.expected = expectedValue;\r
3130             results.actual = computedValue;\r
3131 \r
3132             util.resetData();\r
3133             Assert.AreEqual (results.expected, results.actual);\r
3134         }\r
3135 \r
3136         //------------------------ End test case core-0066NO --------------------------\r
3137         //\r
3138         //------------------------- test case core-0067NO -----------------------------\r
3139         //\r
3140         // Testing feature - If the refChild is a DocumentFragment object then all\r
3141         //                   its children are inserted in the same order before\r
3142         //                   the refChild. \r
3143         //\r
3144         // Testing approach - Create a DocumentFragment object and populate it with\r
3145         //                    two element nodes.  Retrieve the second employee\r
3146         //                    and insert the newly created DocumentFragment before\r
3147         //                    its fourth child.  The second employee should now\r
3148         //                    have two extra children ("childNode1" and "childNode2")\r
3149         //                    at positions fourth and fifth respectively.\r
3150         //\r
3151         // Semantic Requirements: 36\r
3152         //\r
3153         //----------------------------------------------------------------------------\r
3154 \r
3155         [Test]\r
3156         public void core0067NO()\r
3157         {\r
3158             string computedValue = "";\r
3159             string expectedValue = "newChild1 newChild2";\r
3160             System.Xml.XmlElement testNode = null;\r
3161             System.Xml.XmlNode refChild = null;\r
3162             System.Xml.XmlDocumentFragment newDocFragment = util.getDOMDocument().CreateDocumentFragment();\r
3163 \r
3164             testResults results = new testResults("Core0067NO");\r
3165             try\r
3166             {\r
3167                 results.description = "If newChild is a DocumentFragment object, then all "+\r
3168                     "its children are inserted in the same order before "+\r
3169                     "the refChild node.";\r
3170                 //\r
3171                 // Populate the DocumentFragment object.\r
3172                 //\r
3173                 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild1"));\r
3174                 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild2"));\r
3175                 //\r
3176                 // Retrieve targeted data, define reference node and insert new child.\r
3177                 //\r
3178                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3179                 refChild = util.nodeObject(util.SECOND,util.FOURTH);\r
3180                 testNode.InsertBefore(newDocFragment,refChild);//.node.\r
3181                 //\r
3182                 // Check that all the new nodes are in the proper position.\r
3183                 //\r
3184                 computedValue += util.getSubNodes(testNode).Item(util.FOURTH).Name+" ";\r
3185                 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name; \r
3186             }\r
3187             catch(System.Exception ex)\r
3188             {\r
3189                 computedValue = "Exception " + ex.Message;\r
3190             }\r
3191             //\r
3192             // Write out results.\r
3193             //\r
3194             results.expected = expectedValue;\r
3195             results.actual = computedValue;\r
3196 \r
3197             util.resetData();\r
3198             Assert.AreEqual (results.expected, results.actual);\r
3199         }\r
3200 \r
3201         //------------------------ End test case core-0067NO --------------------------\r
3202         //\r
3203         //------------------------- test case core-0068NO -----------------------------\r
3204         //\r
3205         // Testing feature - The insertBefore(newChild,refChild) method returns the\r
3206         //                   node being inserted.\r
3207         //\r
3208         // Testing approach - Insert an Element node before the fourth child\r
3209         //                    of the second employee and examine the returned\r
3210         //                    node from the method.  The node Element node \r
3211         //                    returned by the method should be "newChild".\r
3212         //\r
3213         // Semantic Requirements: 37\r
3214         //\r
3215         //----------------------------------------------------------------------------\r
3216 \r
3217         [Test]\r
3218         public void core0068NO()\r
3219         {\r
3220             string computedValue = "";\r
3221             string expectedValue = "newChild";\r
3222             System.Xml.XmlNode testNode = null;\r
3223             System.Xml.XmlNode refChild = null;\r
3224             System.Xml.XmlNode newChild = null;\r
3225             System.Xml.XmlNode insertedNode = null;\r
3226 \r
3227             testResults results = new testResults("Core0068NO");\r
3228             try\r
3229             {\r
3230                 results.description = "The insertBefore(newChild,refChild) method returns "+\r
3231                     "the node being inserted.";\r
3232                 //\r
3233                 // Retrieve targeted data, define reference and new child nodes and insert\r
3234                 // new child.\r
3235                 //\r
3236                 testNode = util.nodeObject(util.SECOND,-1);\r
3237                 refChild = util.nodeObject(util.SECOND,util.FOURTH);\r
3238                 newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3239                 insertedNode = testNode.InsertBefore(newChild,refChild);//.node.\r
3240                 //\r
3241                 // the returned node should have a nodeName = "newChild" \r
3242                 //\r
3243                 computedValue = insertedNode.Name;\r
3244             }\r
3245             catch(System.Exception ex)\r
3246             {\r
3247                 computedValue = "Exception " + ex.Message;\r
3248             }\r
3249             //\r
3250             // Write out results.\r
3251             //\r
3252             results.expected = expectedValue;\r
3253             results.actual = computedValue;\r
3254 \r
3255             util.resetData();\r
3256             Assert.AreEqual (results.expected, results.actual);\r
3257         }\r
3258 \r
3259         //------------------------ End test case core-0068NO --------------------------\r
3260         //\r
3261         //------------------------- test case core-0069NO -----------------------------\r
3262         //\r
3263         // Testing feature - If the newChild is already in the tree, The \r
3264         //                   insertBefore(newChild,refChild) method first\r
3265         //                   remove it before the insertion takes place.\r
3266         //\r
3267         // Testing approach - Insert a node element (employeeId tag) that is already \r
3268         //                    present in the tree.  The existing node should be\r
3269         //                    remove first and the new one inserted.  The node is\r
3270         //                    inserted at a different position in the tree to assure\r
3271         //                    that it was indeed inserted.\r
3272         //\r
3273         // Semantic Requirements: 38\r
3274         //\r
3275         //----------------------------------------------------------------------------\r
3276 \r
3277         [Test]\r
3278         public void core0069NO()\r
3279         {\r
3280             string computedValue = "";\r
3281             string expectedValue = "name employeeId";\r
3282             System.Xml.XmlNode refChild = null;\r
3283             System.Xml.XmlNode newChild = null;\r
3284             System.Xml.XmlElement testNode = null;\r
3285 \r
3286             testResults results = new testResults("Core0069NO");\r
3287             try\r
3288             {\r
3289                 results.description = "If newChild is already in the tree, it is first "+\r
3290                     "removed before the insertion (from insertBefore"+\r
3291                     "(newChild,refChild) method) takes place.";\r
3292                 //\r
3293                 // Retrieve targeted data, define reference and new child and insert the\r
3294                 // new child.\r
3295                 //\r
3296                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3297                 newChild = util.nodeObject(util.SECOND,util.FIRST);\r
3298                 refChild = util.nodeObject(util.SECOND,util.SIXTH);\r
3299                 testNode.InsertBefore(newChild,refChild);//.node.\r
3300                 //\r
3301                 // the newChild should now be the previous to the last item and the\r
3302                 // first child should be one that used to be at the second position.\r
3303                 //\r
3304                 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";\r
3305                 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;\r
3306             }\r
3307             catch(System.Exception ex)\r
3308             {\r
3309                 computedValue = "Exception " + ex.Message;\r
3310             }\r
3311             //\r
3312             // Write out results.\r
3313             //\r
3314             results.expected = expectedValue;\r
3315             results.actual = computedValue;\r
3316 \r
3317             util.resetData();\r
3318             Assert.AreEqual (results.expected, results.actual);\r
3319         }\r
3320 \r
3321         //------------------------ End test case core-0069NO --------------------------\r
3322         //\r
3323         //------------------------- test case core-0070NO -----------------------------\r
3324         //\r
3325         // Testing feature - The replaceChild(newChild,oldChild) method replaces \r
3326         //                   the node oldChild with the node newChild.\r
3327         //\r
3328         // Testing approach - Replace the first element of the second employee\r
3329         //                    with a newly created node element and examine the\r
3330         //                    first position after the replacement operation is\r
3331         //                    done.  The new element should be "newChild". \r
3332         //\r
3333         // Semantic Requirements: 39\r
3334         //\r
3335         //----------------------------------------------------------------------------\r
3336 \r
3337         [Test]\r
3338         public void core0070NO()\r
3339         {\r
3340             string computedValue = "";\r
3341             string expectedValue = "newChild";\r
3342             System.Xml.XmlElement testNode = null;\r
3343             System.Xml.XmlNode refChild = null;\r
3344             System.Xml.XmlNode newChild = null;\r
3345             System.Xml.XmlNode oldChild = null;\r
3346 \r
3347             testResults results = new testResults("Core0070NO");\r
3348             try\r
3349             {\r
3350                 results.description = "The replaceChild(newChild,oldChild) method "+\r
3351                     "replaces the node oldChild with the node newChild";\r
3352                 //\r
3353                 // Create a new Element node to replace, define the node to be\r
3354                 // replaced and replace it.\r
3355                 //\r
3356                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3357                 oldChild = util.nodeObject(util.SECOND,util.FIRST);\r
3358                 newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3359                 testNode.ReplaceChild(newChild,oldChild);//.node.\r
3360                 //\r
3361                 // Check that the first position contains the new node.\r
3362                 //\r
3363                 computedValue = util.getSubNodes(testNode).Item(util.FIRST).Name;\r
3364             }\r
3365             catch(System.Exception ex)\r
3366             {\r
3367                 computedValue = "Exception " + ex.Message;\r
3368             }\r
3369             //\r
3370             // Write out results.\r
3371             //\r
3372             results.expected = expectedValue;\r
3373             results.actual = computedValue;\r
3374 \r
3375             util.resetData();\r
3376             Assert.AreEqual (results.expected, results.actual);\r
3377         }\r
3378 \r
3379         //------------------------ End test case core-0070NO ------------------------\r
3380         //\r
3381         //------------------------- test case core-0071NO ---------------------------\r
3382         //\r
3383         // Testing feature - If the newChild is already in the tree, it is\r
3384         //                   first removed before the new one is added \r
3385         //\r
3386         // Testing approach - Retrieve the second employee and replace its last child\r
3387         //                    with its first child.  After the replacement operation\r
3388         //                    The first child should now be the one that used to be at \r
3389         //                    the second position in the list and the last one should\r
3390         //                    be the one that used to be at the first position.\r
3391         //\r
3392         // Semantic Requirements: 40 \r
3393         //\r
3394         //----------------------------------------------------------------------------\r
3395 \r
3396         [Test]\r
3397         public void core0071NO()\r
3398         {\r
3399             string computedValue = "";\r
3400             string expectedValue = "name employeeId";\r
3401             System.Xml.XmlElement testNode = null;\r
3402             System.Xml.XmlNode oldChild = null;\r
3403             System.Xml.XmlNode newChild = null;\r
3404 \r
3405             testResults results = new testResults("Core0071NO");\r
3406             try\r
3407             {\r
3408                 results.description = "If newChild is already in the tree, it is first "+\r
3409                     "removed before the replace(from replaceChild"+\r
3410                     "(newChild,oldChild) method) takes place.";\r
3411                 //\r
3412                 // Retrieve targeted data, identify new and old children and replace\r
3413                 // last child with the new child.\r
3414                 //\r
3415                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3416                 newChild = util.nodeObject(util.SECOND,util.FIRST);\r
3417                 oldChild = util.nodeObject(util.SECOND,util.SIXTH);\r
3418                 testNode.ReplaceChild(newChild,oldChild);//.node.\r
3419                 //\r
3420                 // The first item in the list should be the one that used to be at the\r
3421                 // second position and the last one should be the one that used to be at\r
3422                 // the first position in the list.\r
3423                 //\r
3424                 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";\r
3425                 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;\r
3426             }\r
3427             catch(System.Exception ex)\r
3428             {\r
3429                 computedValue = "Exception " + ex.Message;\r
3430             }\r
3431             //\r
3432             // Write out results.\r
3433             //\r
3434             results.expected = expectedValue;\r
3435             results.actual = computedValue;\r
3436 \r
3437             util.resetData();\r
3438             Assert.AreEqual (results.expected, results.actual);\r
3439         }\r
3440 \r
3441         //------------------------ End test case core-0071NO --------------------------\r
3442         //\r
3443         //------------------------- test case core-0072NO -----------------------------\r
3444         //\r
3445         // Testing feature - The replaceChild(newChild,oldChild) method returns\r
3446         //                   the node being replaced.\r
3447         //\r
3448         // Testing approach - Replace the first element of the second employee\r
3449         //                    with a newly created node element and examine the\r
3450         //                    the value returned by the replaceChild(newChild,oldChild)\r
3451         //                    after the replacement operation is done.  The returned \r
3452         //                    node should have a nodeName equal to "employeeId".\r
3453         //\r
3454         // Semantic Requirements: 41 \r
3455         //\r
3456         //----------------------------------------------------------------------------\r
3457 \r
3458         [Test]\r
3459         public void core0072NO()\r
3460         {\r
3461             string computedValue = "";\r
3462             string expectedValue = "employeeId";\r
3463             System.Xml.XmlNode testNode = null;\r
3464             System.Xml.XmlNode oldChild = null;\r
3465             System.Xml.XmlNode newChild = null;\r
3466             System.Xml.XmlNode replacedNode = null;\r
3467 \r
3468             testResults results = new testResults("Core0072NO");\r
3469             try\r
3470             {\r
3471                 results.description = "The replaceChild(newChild,oldChild) method returns "+\r
3472                     "the node being replaced.";\r
3473                 //\r
3474                 // Retrieve the targeted data, define new and old children and replace\r
3475                 // old child with new child.\r
3476                 //\r
3477                 testNode = util.nodeObject(util.SECOND,-1);\r
3478                 oldChild = util.nodeObject(util.SECOND,util.FIRST);\r
3479                 newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3480                 replacedNode = testNode.ReplaceChild(newChild, oldChild);//.node.\r
3481                 //\r
3482                 // The returned node should be the one being replaced.\r
3483                 //\r
3484                 computedValue = replacedNode.Name;\r
3485             }\r
3486             catch(System.Exception ex)\r
3487             {\r
3488                 computedValue = "Exception " + ex.Message;\r
3489             }\r
3490             //\r
3491             // Write out results.\r
3492             //\r
3493             results.expected = expectedValue;\r
3494             results.actual = computedValue;\r
3495 \r
3496             util.resetData();\r
3497             Assert.AreEqual (results.expected, results.actual);\r
3498         }\r
3499 \r
3500         //------------------------ End test case core-0072NO --------------------------\r
3501         //\r
3502         //------------------------- test case core-0073NO -----------------------------\r
3503         //\r
3504         // Testing feature - The removeChild(oldChild) method removes the node\r
3505         //                   indicated by oldChild.\r
3506         //\r
3507         // Testing approach - Retrieve the second employee and remove its first\r
3508         //                    child. After the removal operation takes place, the\r
3509         //                    second employee should have 5 children and the first\r
3510         //                    one should be the one that used to be at the second\r
3511         //                    position in the list.\r
3512         //\r
3513         // Semantic Requirements: 42 \r
3514         //\r
3515         //----------------------------------------------------------------------------\r
3516 \r
3517         [Test]\r
3518         public void core0073NO()\r
3519         {\r
3520             string computedValue = "";\r
3521             string expectedValue = "name 5";\r
3522             System.Xml.XmlElement testNode = null;\r
3523             System.Xml.XmlNode oldChild = null;\r
3524 \r
3525             testResults results = new testResults("Core0073NO");\r
3526             try\r
3527             {\r
3528                 results.description = "The removeChild(oldChild) method removes the "+\r
3529                     "node indicated by oldChild.";\r
3530                 //\r
3531                 // Retrieve targeted data, identify old child and remove it from the\r
3532                 // list of children.\r
3533                 //\r
3534                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3535                 oldChild = util.nodeObject(util.SECOND,util.FIRST);  \r
3536                 testNode.RemoveChild(oldChild);//.node.\r
3537                 //\r
3538                 // Check that the node was indeed removed from the list.\r
3539                 //\r
3540                 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";\r
3541                 computedValue += util.getSubNodes(testNode).Count;\r
3542             }\r
3543             catch(System.Exception ex)\r
3544             {\r
3545                 computedValue = "Exception " + ex.Message;\r
3546             }\r
3547             //\r
3548             // Write out results.\r
3549             //\r
3550             results.expected = expectedValue;\r
3551             results.actual = computedValue;\r
3552 \r
3553             util.resetData();\r
3554             Assert.AreEqual (results.expected, results.actual);\r
3555         }\r
3556 \r
3557         //------------------------ End test case core-0073NO --------------------------\r
3558         //\r
3559         //------------------------- test case core-0074NO -----------------------------\r
3560         //\r
3561         // Testing feature - The removeChild(oldChild) method returns the node\r
3562         //                   removed.\r
3563         //\r
3564         // Testing approach - Remove the first element of the second employee\r
3565         //                    and examine the value returned by the \r
3566         //                    removeChild(oldChild) after removal operation is \r
3567         //                    done.  The returned node should have a tag name equal\r
3568         //                    to "employeeId".\r
3569         //\r
3570         // Semantic Requirements: 43\r
3571         //\r
3572         //----------------------------------------------------------------------------\r
3573 \r
3574         [Test]\r
3575         public void core0074NO()\r
3576         {\r
3577             string computedValue = "";\r
3578             string expectedValue = "employeeId";\r
3579             System.Xml.XmlNode testNode = null;\r
3580             System.Xml.XmlNode oldChild = null;\r
3581             System.Xml.XmlNode removedNode = null;\r
3582 \r
3583             testResults results = new testResults("Core0074NO");\r
3584             try\r
3585             {\r
3586                 results.description = "The removeChild(oldChild) method returns the "+\r
3587                     "node removed.";\r
3588                 //\r
3589                 // Retrieve the targeted data and remove it.\r
3590                 //\r
3591                 testNode = util.nodeObject(util.SECOND,-1);\r
3592                 oldChild = util.nodeObject(util.SECOND,util.FIRST);\r
3593                 removedNode = testNode.RemoveChild(oldChild);//.node.\r
3594                 //\r
3595                 // The returned node should be the node removed.\r
3596                 //\r
3597                 computedValue = removedNode.Name;\r
3598             }\r
3599             catch(System.Exception ex)\r
3600             {\r
3601                 computedValue = "Exception " + ex.Message;\r
3602             }\r
3603             //\r
3604             // Write out results.\r
3605             //\r
3606             results.expected = expectedValue;\r
3607             results.actual = computedValue;\r
3608 \r
3609             util.resetData();\r
3610             Assert.AreEqual (results.expected, results.actual);\r
3611         }\r
3612 \r
3613         //------------------------ End test case core-0074NO --------------------------\r
3614         //\r
3615         //------------------------- test case core-0075NO -----------------------------\r
3616         //\r
3617         // Testing feature - The appendChild(newChild) method adds the node newChild \r
3618         //                   the end of the list of children of the node.\r
3619         //\r
3620         // Testing approach - Retrieve the second employee and append a new Element \r
3621         //                    node to its list of children.  The last node in the\r
3622         //                    list is then retrieved and its nodeName attribute\r
3623         //                    examined.  It should be equal to "newChild". \r
3624         //\r
3625         // Semantic Requirements: 44 \r
3626         //\r
3627         //----------------------------------------------------------------------------\r
3628 \r
3629         [Test]\r
3630         public void core0075NO()\r
3631         {\r
3632             string computedValue = "";\r
3633             string expectedValue = "newChild";\r
3634             System.Xml.XmlElement testNode = null;\r
3635             System.Xml.XmlNode newChild = null;\r
3636 \r
3637             testResults results = new testResults("Core0075NO");\r
3638             try\r
3639             {\r
3640                 results.description = "The appendChild(newChild) method adds the node "+\r
3641                     "newChild to the end of the list of children of "+\r
3642                     "the node.";\r
3643                 //\r
3644                 // Create a new Element node and append it to the end of the list.\r
3645                 //\r
3646                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3647                 newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3648                 testNode.AppendChild(newChild);//.node.\r
3649                 //\r
3650                 // Retrieve the new last child.\r
3651                 //\r
3652                 computedValue = util.getSubNodes(testNode).Item(util.SEVENTH).Name;\r
3653             }\r
3654             catch(System.Exception ex)\r
3655             {\r
3656                 computedValue = "Exception " + ex.Message;\r
3657             }\r
3658             //\r
3659             // Write out results.\r
3660             //\r
3661             results.expected = expectedValue;\r
3662             results.actual = computedValue;\r
3663 \r
3664             util.resetData();\r
3665             Assert.AreEqual (results.expected, results.actual);\r
3666         }\r
3667 \r
3668         //------------------------ End test case core-0075NO ------------------------\r
3669         //\r
3670         //------------------------- test case core-0076NO ---------------------------\r
3671         //\r
3672         // Testing feature - If the newChild is already in the tree, it is first \r
3673         //                   removed before the new one is appended.\r
3674         //\r
3675         // Testing approach - Retrieve the second employee and its first child, then \r
3676         //                    append the first child to the end of the list.  After\r
3677         //                    the append operation is done, retrieve the element at\r
3678         //                    at the top of the list and the one at the end of the \r
3679         //                    list.  The last node should be the one that used to be\r
3680         //                    at the top of the list and the first one should be the\r
3681         //                    one that used to be second in the list.\r
3682         //\r
3683         // Semantic Requirements: 45\r
3684         //\r
3685         //----------------------------------------------------------------------------\r
3686 \r
3687         [Test]\r
3688         public void core0076NO()\r
3689         {\r
3690             string computedValue = "";\r
3691             string expectedValue = "name employeeId";\r
3692             System.Xml.XmlElement testNode = null;\r
3693             System.Xml.XmlNode newChild = null;\r
3694 \r
3695             testResults results = new testResults("Core0076NO");\r
3696             try\r
3697             {\r
3698                 results.description = "If newChild is already in the tree, it is first " + "removed before the append takes place.";\r
3699                 //\r
3700                 // Retrieve targeted data, define the new child and append it to the\r
3701                 // end of the list.\r
3702                 //\r
3703                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3704                 newChild = util.nodeObject(util.SECOND,util.FIRST);\r
3705                 testNode.AppendChild(newChild);//.node.\r
3706                 //\r
3707                 // Access the relevant new nodes and its nodeName attributes.\r
3708                 //\r
3709                 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";\r
3710                 computedValue += util.getSubNodes(testNode).Item(util.SIXTH).Name;\r
3711             }\r
3712             catch(System.Exception ex)\r
3713             {\r
3714                 computedValue = "Exception " + ex.Message;\r
3715             }\r
3716             //\r
3717             // Write out results.\r
3718             //\r
3719             results.expected = expectedValue;\r
3720             results.actual = computedValue;\r
3721 \r
3722             util.resetData();\r
3723             Assert.AreEqual (results.expected, results.actual);\r
3724         }\r
3725 \r
3726         //------------------------ End test case core-0076NO --------------------------\r
3727         //\r
3728         //------------------------- test case core-0077NO -----------------------------\r
3729         //\r
3730         // Testing feature - If the newChild is a DocumentFragment object then all\r
3731         //                   its content is added to the child list of this node.\r
3732         //\r
3733         // Testing approach - Create and populate a new DocumentFragment object and\r
3734         //                    append it to the second employee.  After the append\r
3735         //                    operation is done then retrieve the new nodes at the\r
3736         //                    end of the list, they should be the two Element nodes\r
3737         //                    from the DocumentFragment.\r
3738         //\r
3739         // Semantic Requirements: 46\r
3740         //\r
3741         //----------------------------------------------------------------------------\r
3742 \r
3743         [Test]\r
3744         public void core0077NO()\r
3745         {\r
3746             string computedValue = "";\r
3747             string expectedValue = "newChild1 newChild2";\r
3748             System.Xml.XmlElement testNode = null;\r
3749             System.Xml.XmlDocumentFragment newDocFragment = util.getDOMDocument().CreateDocumentFragment();\r
3750 \r
3751             testResults results = new testResults("Core0077NO");\r
3752             try\r
3753             {\r
3754                 results.description = "If newChild is a DocumentFragment object, then the "+\r
3755                     "entire content of the DocumentFragment is appended "+\r
3756                     "to the child list of this node.";\r
3757                 //\r
3758                 // Populate the DocumentFragment object.\r
3759                 //\r
3760                 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild1"));\r
3761                 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild2"));\r
3762                 //\r
3763                 // Retrieve targeted data and append new DocumentFragment object. \r
3764                 //\r
3765                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
3766                 testNode.AppendChild(newDocFragment);//.node.\r
3767                 //\r
3768                 // Retrieve all the new nodes from the proper position.\r
3769                 //\r
3770                 computedValue += util.getSubNodes(testNode).Item(util.SEVENTH).Name+" ";\r
3771                 computedValue += util.getSubNodes(testNode).Item(util.EIGHT).Name;\r
3772             }\r
3773             catch(System.Exception ex)\r
3774             {\r
3775                 computedValue = "Exception " + ex.Message;\r
3776             }\r
3777             //\r
3778             // Write out results.\r
3779             //\r
3780             results.expected = expectedValue;\r
3781             results.actual = computedValue;\r
3782 \r
3783             util.resetData();\r
3784             Assert.AreEqual (results.expected, results.actual);\r
3785         }\r
3786 \r
3787         //------------------------ End test case core-0077NO --------------------------\r
3788         //\r
3789         //------------------------- test case core-0078NO -----------------------------\r
3790         //\r
3791         // Testing feature - The appendChild(newChild) method returns the node\r
3792         //                   added.\r
3793         //\r
3794         // Testing approach - Append a newly created node to the child list of the \r
3795         //                    second employee and examine the returned value\r
3796         //                    The returned value should be "newChild".\r
3797         //\r
3798         // Semantic Requirements: 47\r
3799         //\r
3800         //----------------------------------------------------------------------------\r
3801 \r
3802         [Test]\r
3803         public void core0078NO()\r
3804         {\r
3805             string computedValue = "";\r
3806             string expectedValue = "newChild";\r
3807             System.Xml.XmlNode testNode = null;\r
3808             System.Xml.XmlNode appendedNode = null;\r
3809             System.Xml.XmlNode newChild = null;\r
3810 \r
3811             testResults results = new testResults("Core0078NO");\r
3812 \r
3813             results.description = "The appendChild(newChild) method returns the node "+\r
3814                 "added.";\r
3815             //\r
3816             // Retrieve the targeted data and append a new node to it.\r
3817             //\r
3818             testNode = util.nodeObject(util.SECOND,-1);\r
3819             newChild = util.createNode(util.ELEMENT_NODE,"newChild");\r
3820             appendedNode = testNode.AppendChild(newChild);//.node.\r
3821             //\r
3822             // The returned node should be the node appended.\r
3823             //\r
3824             computedValue = appendedNode.Name;\r
3825             //\r
3826             // Write out results.\r
3827             //\r
3828             results.expected = expectedValue;\r
3829             results.actual = computedValue;\r
3830 \r
3831             util.resetData();\r
3832             Assert.AreEqual (results.expected, results.actual);\r
3833         }\r
3834 \r
3835         //------------------------ End test case core-0078NO --------------------------\r
3836         //\r
3837         //------------------------- test case core-0079NO -----------------------------\r
3838         //\r
3839         // Testing feature - The hasChildNodes method returns true if the node has\r
3840         //                   any children. \r
3841         //\r
3842         // Testing approach - Retrieve the root node (tag name = "staff") and\r
3843         //                    invoke its hasChildNodes.Item() method.  It should return\r
3844         //                    the value true.\r
3845         //\r
3846         // Semantic Requirements: 48\r
3847         //\r
3848         //----------------------------------------------------------------------------\r
3849 \r
3850         [Test]\r
3851         public void core0079NO()\r
3852         {\r
3853             string computedValue = "";\r
3854             string expectedValue = "True";\r
3855             System.Xml.XmlNode testNode = null;\r
3856 \r
3857             testResults results = new testResults("Core0079NO");\r
3858 \r
3859             results.description = "The hasChildNodes method returns true if the "+\r
3860                 "node has any children.";\r
3861             //\r
3862             // Retrieve the targeted data and access its hasChilNodes method.\r
3863             //\r
3864             testNode = util.nodeObject(util.SECOND,-1);\r
3865             computedValue = testNode.HasChildNodes.ToString();//.Item();//.node.\r
3866             //\r
3867             // Write out results.\r
3868             //\r
3869             results.expected = expectedValue;\r
3870             results.actual = computedValue;\r
3871 \r
3872             Assert.AreEqual (results.expected, results.actual);\r
3873         }\r
3874 \r
3875         //------------------------ End test case core-0079NO --------------------------\r
3876         //\r
3877         //------------------------- test case core-0080NO -----------------------------\r
3878         //\r
3879         // Testing feature - The hasChildNodes method returns false if the node has\r
3880         //                   no children.\r
3881         //\r
3882         // Testing approach - Retrieve the Text node inside the first child of the\r
3883         //                    second employee and invoke its hasChildNodes.Item() method.  \r
3884         //                    It should return the value false as this node has no\r
3885         //                    children.\r
3886         //\r
3887         // Semantic Requirements: 49\r
3888         //\r
3889         //----------------------------------------------------------------------------\r
3890 \r
3891         [Test]\r
3892         public void core0080NO()\r
3893         {\r
3894             string computedValue = "";\r
3895             string expectedValue = "False";\r
3896             System.Xml.XmlNode testNode = null;\r
3897 \r
3898             testResults results = new testResults("Core0080NO");\r
3899             try\r
3900             {\r
3901                 results.description = "The hasChildNodes method returns false if the "+\r
3902                     "node has no children.";\r
3903                 //\r
3904                 // Retrieve the targeted data and access its hasChildNodes method.\r
3905                 //\r
3906                 testNode = util.nodeObject(util.SECOND,util.FIRST);\r
3907                 System.Xml.XmlNode textNode = testNode.FirstChild;//.node.\r
3908                 computedValue = textNode.HasChildNodes.ToString();//.Item();\r
3909             }\r
3910             catch(System.Exception ex)\r
3911             {\r
3912                 computedValue = "Exception " + ex.Message;\r
3913             }\r
3914             //\r
3915             // Write out results.\r
3916             //\r
3917             results.expected = expectedValue;\r
3918             results.actual = computedValue;\r
3919 \r
3920             Assert.AreEqual (results.expected, results.actual);\r
3921         }\r
3922 \r
3923         //------------------------ End test case core-0080NO --------------------------\r
3924         //\r
3925         //------------------------- test case core-0081NO -----------------------------\r
3926         //\r
3927         // Testing feature - The cloneNode(deep) method returns a copy of the node only\r
3928         //                   if deep = false.\r
3929         //\r
3930         // Testing approach - Retrieve the second employee and invoke its \r
3931         //                    cloneNode(deep) method with deep = false.  The\r
3932         //                    method should clone this node only.  The nodeName,\r
3933         //                    and length of the childNode list are checked, \r
3934         //                    they should be "employee" and 0.\r
3935         //\r
3936         // Semantic Requirements: 50 \r
3937         //\r
3938         //----------------------------------------------------------------------------\r
3939 \r
3940         [Test]\r
3941         public void core0081NO()\r
3942         {\r
3943             string computedValue = "";\r
3944             string expectedValue = "employee 0";\r
3945             System.Xml.XmlNode testNode = null;\r
3946             System.Xml.XmlNode clonedNode = null;\r
3947 \r
3948             testResults results = new testResults("Core0081NO");\r
3949             try\r
3950             {\r
3951                 results.description = "The cloneNode(deep) method returns a copy of this "+\r
3952                     "node only if deep = false.";\r
3953                 //\r
3954                 // Retrieve the targeted data and access its cloneNode method.\r
3955                 //\r
3956                 testNode = util.nodeObject(util.SECOND,-1);\r
3957                 clonedNode = testNode.CloneNode(false);//.node.\r
3958                 //\r
3959                 // Retrieve values of the cloned node.\r
3960                 //      \r
3961                 computedValue += clonedNode.Name+" ";\r
3962                 computedValue += clonedNode.ChildNodes.Count; \r
3963             }\r
3964             catch(System.Exception ex)\r
3965             {\r
3966                 computedValue = "Exception " + ex.Message;\r
3967             }\r
3968             //\r
3969             // Write out results.\r
3970             //\r
3971             results.expected = expectedValue;\r
3972             results.actual = computedValue;\r
3973 \r
3974             Assert.AreEqual (results.expected, results.actual);\r
3975         }\r
3976 \r
3977         //------------------------ End test case core-0081NO --------------------------\r
3978         //\r
3979         //------------------------- test case core-0082NO -----------------------------\r
3980         //\r
3981         // Testing feature - The cloneNode(deep) method returns a copy of the node and \r
3982         //                   the subtree under it if deep = true.\r
3983         //\r
3984         // Testing approach - Retrieve the second employee and invoke its\r
3985         //                    cloneNode(deep) method with deep = true.  The\r
3986         //                    method should clone this node and the subtree under\r
3987         //                    it.  The tag name of each child of the returned\r
3988         //                    node is checked to insure the entire subtree under\r
3989         //                    the second employee was cloned.  \r
3990         //\r
3991         // Semantic Requirements: 51\r
3992         //\r
3993         //----------------------------------------------------------------------------\r
3994 \r
3995         [Test]\r
3996         public void core0082NO()\r
3997         {\r
3998             string computedValue = "";\r
3999             string expectedValue = "employeeId name position salary gender address ";\r
4000             System.Xml.XmlNode testNode = null;\r
4001             System.Xml.XmlNodeList subTree = null;\r
4002             System.Xml.XmlNode clonedNode = null;\r
4003 \r
4004             testResults results = new testResults("Core0082NO");\r
4005             try\r
4006             {\r
4007                 results.description = "The cloneNode(deep) method returns a copy of this "+\r
4008                     "node and the subtree under it if deep = true.";\r
4009                 //\r
4010                 // Retrieve the targeted data and invoke its cloneNode method.\r
4011                 //\r
4012                 testNode = util.nodeObject(util.SECOND,-1);\r
4013                 clonedNode = testNode.CloneNode(true);//.node.\r
4014                 subTree = clonedNode.ChildNodes;\r
4015                 //\r
4016                 // Retrieve the cloned node children.\r
4017                 //\r
4018                 for (int index = 0;index < subTree.Count; index++) \r
4019                     computedValue += subTree.Item(index).Name+" ";\r
4020             }\r
4021             catch(System.Exception ex)\r
4022             {\r
4023                 computedValue = "Exception " + ex.Message;\r
4024             }\r
4025             //\r
4026             // Write out results.\r
4027             //\r
4028             results.expected = expectedValue;\r
4029             results.actual = computedValue;\r
4030 \r
4031             Assert.AreEqual (results.expected, results.actual);\r
4032         }\r
4033 \r
4034         //------------------------ End test case core-0082NO --------------------------\r
4035         //\r
4036         //------------------------- test case core-0083NO -----------------------------\r
4037         //\r
4038         // Testing feature - The duplicate node returned by the cloneNode(deep) method \r
4039         //                   has no parent (parentNode = null).\r
4040         //\r
4041         // Testing approach - Retrieve the second employee and invoke its\r
4042         //                    cloneNode(deep) method with deep = false.  The\r
4043         //                    duplicate node returned by the method should have its \r
4044         //                    parentNode attribute set to null.\r
4045         //\r
4046         // Semantic Requirements: 52\r
4047         //\r
4048         //----------------------------------------------------------------------------\r
4049 \r
4050         [Test]\r
4051         public void core0083NO()\r
4052         {\r
4053             object computedValue = null;\r
4054             object expectedValue = null;\r
4055             System.Xml.XmlNode testNode = null;\r
4056             System.Xml.XmlNode clonedNode = null;\r
4057 \r
4058             testResults results = new testResults("Core0083NO");\r
4059             try\r
4060             {\r
4061                 results.description = "The duplicate node returned by the cloneNode(deep) "+\r
4062                     "method has no parent (parentNode = null).";\r
4063                 //\r
4064                 // Retrieve the targeted data and invoke the cloneNode method.\r
4065                 //\r
4066                 testNode = util.nodeObject(util.SECOND,-1);\r
4067                 clonedNode = testNode.CloneNode(false);//.node.\r
4068                 //\r
4069                 // Its parentNode attribute should be null.\r
4070                 //\r
4071                 computedValue = clonedNode.ParentNode;\r
4072             }\r
4073             catch(System.Exception ex)\r
4074             {\r
4075                 computedValue = "Exception " + ex.Message;\r
4076             }\r
4077             //\r
4078             // Write out results.\r
4079             //\r
4080             results.expected = (expectedValue == null).ToString();\r
4081             results.actual = (computedValue == null).ToString();\r
4082 \r
4083             util.resetData();\r
4084             Assert.AreEqual (results.expected, results.actual);\r
4085         }\r
4086 \r
4087         //------------------------ End test case core-0083NO --------------------------\r
4088         //\r
4089         //------------------------- test case core-0084NO -----------------------------\r
4090         //\r
4091         // Testing feature - The cloneNode(deep) method does not copy text unless it is\r
4092         //                   deep cloned. (test for deep clone = false)\r
4093         //\r
4094         // Testing approach - Retrieve the fourth child of the second employee and \r
4095         //                    invoke its cloneNode(deep) method with deep = false.  The\r
4096         //                    duplicate node returned by the method should not copy any\r
4097         //                    text data contained in this node. \r
4098         //\r
4099         // Semantic Requirements: 53\r
4100         //\r
4101         //----------------------------------------------------------------------------\r
4102 \r
4103         [Test]\r
4104         public void core0084NO()\r
4105         {\r
4106             string testName = "core-0084NO";\r
4107             object computedValue = null;\r
4108             object expectedValue = null;\r
4109             System.Xml.XmlNode testNode = null;\r
4110             System.Xml.XmlNode clonedNode = null;\r
4111 \r
4112             testResults results = new testResults("Core0084NO");\r
4113             try\r
4114             {\r
4115                 results.description = "The cloneNode(deep) method does not copy any text "+\r
4116                     "unless it is deep cloned(deep = false).";\r
4117                 //\r
4118                 // Retrieve the targeted data and invoke its clonedNode method.\r
4119                 //\r
4120                 testNode = util.nodeObject(util.SECOND,util.FOURTH);\r
4121                 clonedNode = testNode.CloneNode(false);//.node.\r
4122                 //\r
4123                 // The cloned node should have no text data in it.\r
4124                 //\r
4125                 computedValue = clonedNode.LastChild;\r
4126             }\r
4127             catch(System.Exception ex)\r
4128             {\r
4129                 computedValue = "Exception " + ex.Message;\r
4130             }\r
4131             //\r
4132             //  Write out results.\r
4133             //\r
4134             results.expected = (expectedValue == null).ToString();\r
4135             results.actual = (computedValue == null).ToString();\r
4136 \r
4137             Assert.AreEqual (results.expected, results.actual);\r
4138         }\r
4139 \r
4140         //------------------------ End test case core-0084NO --------------------------\r
4141         //\r
4142         //------------------------- test case core-0085NO -----------------------------\r
4143         //\r
4144         // Testing feature - The cloneNode(deep) method does not copy text unless it is\r
4145         //                   deep cloned. (test for deep clone = true)\r
4146         //\r
4147         // Testing approach - Retrieve the fourth child of the second employee and\r
4148         //                    invoke its cloneNode(deep) method with deep = true.  The\r
4149         //                    duplicate node returned by the method should copy any\r
4150         //                    text data contained in this node.\r
4151         //\r
4152         // Semantic Requirements: 53\r
4153         //\r
4154         //----------------------------------------------------------------------------\r
4155 \r
4156         [Test]\r
4157         public void core0085NO()\r
4158         {\r
4159             string computedValue = "";\r
4160             string expectedValue = "35,000";\r
4161             System.Xml.XmlNode testNode = null;\r
4162             System.Xml.XmlNode clonedNode = null;\r
4163 \r
4164             testResults results = new testResults("Core0085NO");\r
4165             try\r
4166             {\r
4167                 results.description = "The cloneNode(deep) method does not copy any text "+\r
4168                     "unless it is deep cloned(deep = true).";\r
4169                 //\r
4170                 // Retrieve the targeted data and invoke its cloneNode method.\r
4171                 //\r
4172                 testNode = util.nodeObject(util.SECOND,util.FOURTH);\r
4173                 clonedNode = testNode.CloneNode(true);//.node.\r
4174                 //\r
4175                 // Retrieve the text data inside the cloned node.\r
4176                 //\r
4177                 computedValue = clonedNode.LastChild.Value;\r
4178             }\r
4179             catch(System.Exception ex)\r
4180             {\r
4181                 computedValue = "Exception " + ex.Message;\r
4182             }\r
4183             //\r
4184             // Write out results.\r
4185             //\r
4186             results.expected = expectedValue;\r
4187             results.actual = computedValue;\r
4188 \r
4189             Assert.AreEqual (results.expected, results.actual);\r
4190         }\r
4191 \r
4192         //------------------------ End test case core-0085NO --------------------------\r
4193         //\r
4194         //------------------------- test case core-0086NO -----------------------------\r
4195         //\r
4196         // Testing feature - If the cloneNode(deep) method was used to clone an Element\r
4197         //                   node, all the attributes of the Element are copied (and\r
4198         //                   their values).\r
4199         //\r
4200         // Testing approach - Retrieve the last child of the second employee and\r
4201         //                    invoke its cloneNode(deep) method with deep = true.  The\r
4202         //                    duplicate node returned by the method should copy the\r
4203         //                    attributes associated with this node. \r
4204         //\r
4205         // Semantic Requirements: 54\r
4206         //\r
4207         //----------------------------------------------------------------------------\r
4208 \r
4209         [Test]\r
4210         public void core0086NO()\r
4211         {\r
4212             string testName = "core-0086NO";\r
4213             string computedValue = "";\r
4214             string expectedValue = "";\r
4215             System.Xml.XmlNode testNode = null;\r
4216             System.Xml.XmlNode clonedNode = null;\r
4217 \r
4218             testResults results = new testResults("Core0086NO");\r
4219             try\r
4220             {\r
4221                 results.description = "If the cloneNode(deep) method was used to clone an "+\r
4222                     "Element node then all the attributes associated "+\r
4223                     "associated with this node are copied too."; \r
4224                 //\r
4225                 // Retrieve the targeted data and invoke its cloneNode method.\r
4226                 //\r
4227                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
4228                 clonedNode = testNode.CloneNode(true);//.node.\r
4229                 //\r
4230                 // Retreive cloned node and its attributes.\r
4231                 //\r
4232                 computedValue += clonedNode.Attributes.Item(0).Name+" ";\r
4233                 computedValue += clonedNode.Attributes.Item(1).Name;\r
4234                 //\r
4235                 // Determine order of NamedNodeMap items.\r
4236                 //\r
4237                 if (computedValue.Substring(0,1) == "d" && computedValue.Substring(1,1) == "o")\r
4238                     expectedValue = "domestic street";\r
4239                 else\r
4240                     expectedValue = "street domestic";\r
4241             }\r
4242             catch(Exception ex)\r
4243             {\r
4244                 computedValue = "Exception " + ex.Message;\r
4245             }\r
4246 \r
4247             //\r
4248             // Write out results.\r
4249             //\r
4250             results.expected = expectedValue;\r
4251             results.actual = computedValue;\r
4252 \r
4253             Assert.AreEqual (results.expected, results.actual);\r
4254         }\r
4255 \r
4256         //------------------------ End test case core-0086NO --------------------------\r
4257         //\r
4258         //------------------------- test case core-0087NO -----------------------------\r
4259         //\r
4260         // Testing feature - The "nodeValue" attribute of a node raises a\r
4261         //                   NO_MODIFICATION_ALLOWED_ERR DOM exception\r
4262         //                   if the node is readonly. \r
4263         //\r
4264         // Testing approach - Retrieve the Text node inside the Entity node named \r
4265         //                    "ent1" and attempt to change its nodeValue attribute.\r
4266         //                    Since the descendants of Entity nodes are readonly, the\r
4267         //                    desired exception should be raised.\r
4268         //\r
4269         // Semantic Requirements: 55 \r
4270         //\r
4271         //----------------------------------------------------------------------------\r
4272 \r
4273         [Test]\r
4274         public void core0087NO()\r
4275         {\r
4276             string computedValue = "";\r
4277             System.Xml.XmlEntity testNode = null;\r
4278             System.Xml.XmlText entityDesc = null;\r
4279             string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;\r
4280 \r
4281             testResults results = new testResults("Core0087NO");\r
4282             try\r
4283             {\r
4284                 results.description = "The \"Value\" attribute of a node raises a "+\r
4285                     "NO_MODIFICATION_ALLOWED_ERR Exception if the "+\r
4286                     "node is readonly.";\r
4287                 //\r
4288                 // Retrieve the targeted data.\r
4289                 //\r
4290                 testNode = util.getEntity("ent1");\r
4291                 entityDesc = (System.Xml.XmlText)testNode.FirstChild;\r
4292                 //\r
4293                 // attempt to set a value on a readonly node should raise an exception.\r
4294                 //\r
4295                 try \r
4296                 {\r
4297                     entityDesc.Value = "ABCD"; \r
4298                 }\r
4299                 catch(System.Exception ex) \r
4300                 {\r
4301                     computedValue = ex.GetType ().FullName; \r
4302                 }\r
4303             }\r
4304             catch(System.Exception ex)\r
4305             {\r
4306                 computedValue = "Exception " + ex.Message;\r
4307             }\r
4308 \r
4309             results.expected = expectedValue;\r
4310             results.actual = computedValue;\r
4311 \r
4312             util.resetData();\r
4313             Assert.AreEqual (results.expected, results.actual);\r
4314         }\r
4315 \r
4316         //------------------------ End test case core-0087NO -------------------------\r
4317         //\r
4318         //------------------------- test case core-0088NO -----------------------------\r
4319         //\r
4320         // Testing feature - The "insertBefore" method of a node raises a\r
4321         //                   NO_MODIFICATION_ALLOWED_ERR Exception if \r
4322         //                   the node is readonly.\r
4323         //\r
4324         // Testing approach - Retrieve the first EntityReference inside the second \r
4325         //                    employee and invoke the insertBefore(newChild,refChild) \r
4326         //                    method on its first descendant.  Descendants of\r
4327         //                    EntityReference nodes are readonly and therefore the\r
4328         //                    desired exception should be raised.  This test also \r
4329         //                    makes use of the "createElement" method from the \r
4330         //                    Document interface.\r
4331         //\r
4332         // Semantic Requirements: 56\r
4333         //\r
4334         //----------------------------------------------------------------------------\r
4335 \r
4336         [Test]\r
4337         public void core0088NO()\r
4338         {\r
4339             string computedValue = "";\r
4340             System.Xml.XmlNode testNode = null;\r
4341             System.Xml.XmlEntityReference entityRefNode = null;\r
4342             System.Xml.XmlNode refChild = null;\r
4343             System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
4344             string expectedValue = "System.InvalidOperationException";//util.NO_MODIFICATION_ALLOWED_ERR;\r
4345  \r
4346             testResults results = new testResults("Core0088NO");\r
4347             try\r
4348             {\r
4349                 results.description = "The \"insertBefore()\" method of a node raises "+\r
4350                     "a NO_MODIFICATION_ALLOWED_ERR Exception "+\r
4351                     "if this node is readonly.";\r
4352                 //\r
4353                 // Retrieve targeted data and define reference child.\r
4354                 //\r
4355                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
4356                 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.\r
4357                 refChild = entityRefNode.FirstChild;\r
4358                 //\r
4359                 // Attempt to insert a node to an EntityReference descendant should raise \r
4360                 // an exception.\r
4361                 //\r
4362                 try \r
4363                 {\r
4364                     entityRefNode.InsertBefore(newChild,refChild);\r
4365                 }\r
4366                 catch(InvalidOperationException ex) \r
4367                 {\r
4368                     computedValue = ex.GetType ().FullName; \r
4369                 }\r
4370             }\r
4371             catch(System.Exception ex)\r
4372             {\r
4373                 computedValue = "Exception " + ex.Message;\r
4374             }\r
4375             results.expected = expectedValue;\r
4376             results.actual = computedValue;\r
4377 \r
4378             util.resetData();\r
4379             Assert.AreEqual (results.expected, results.actual);\r
4380         }\r
4381 \r
4382         //------------------------ End test case core-0088NO -------------------------\r
4383         //\r
4384         //------------------------- test case core-0089NO ----------------------------\r
4385         //\r
4386         // Testing feature - The "replaceChild" method of a node raises a\r
4387         //                   NO_MODIFICATION_ALLOWED_ERR Exception if the \r
4388         //                   node is readonly.\r
4389         //\r
4390         // Testing approach - Retrieve the first EntityReference inside the second\r
4391         //                    employee and invoke the replaceChild(newChild,oldChild)\r
4392         //                    method where oldChild is one of the EntityReference \r
4393         //                    descendants.  Descendants of EntityReference nodes are \r
4394         //                    readonly and therefore the desired exception should be \r
4395         //                    raised.  This test also makes use of the "createElement" \r
4396         //                    method from the Document interface.\r
4397         //\r
4398         // Semantic Requirements: 57\r
4399         //\r
4400         //----------------------------------------------------------------------------\r
4401 \r
4402         [Test]\r
4403         public void core0089NO()\r
4404         {\r
4405             string computedValue = "";\r
4406             System.Xml.XmlNode testNode = null;\r
4407             System.Xml.XmlEntityReference entityRefNode = null;\r
4408             System.Xml.XmlNode oldChild = null;\r
4409             System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
4410             string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;\r
4411 \r
4412             testResults results = new testResults("Core0089NO");\r
4413             try\r
4414             {\r
4415                 results.description =  "The \"replaceChild(newChild, oldChild)\" method "+\r
4416                     "of a node raises a<br>NO_MODIFICATION_ALLOWED_ERR "+\r
4417                     " Exception if this node is readonly.";\r
4418                 //\r
4419                 // Retrieve targeted data and define oldChild.\r
4420                 //\r
4421                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
4422                 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild; //.node.\r
4423                 oldChild = entityRefNode.FirstChild;\r
4424                 //\r
4425                 // Attempt to replace a descendant of an EntityReference should raise an\r
4426                 // exception.\r
4427                 //\r
4428                 try \r
4429                 {\r
4430                     entityRefNode.ReplaceChild(newChild,oldChild);\r
4431                 }\r
4432                 catch(ArgumentException ex) \r
4433                 {\r
4434                     computedValue = ex.GetType ().FullName; \r
4435                 }\r
4436             }\r
4437             catch(System.Exception ex)\r
4438             {\r
4439                 computedValue = "Exception " + ex.Message;\r
4440             }\r
4441             results.expected = expectedValue;\r
4442             results.actual = computedValue;\r
4443 \r
4444             util.resetData();\r
4445             Assert.AreEqual (results.expected, results.actual);\r
4446         }\r
4447 \r
4448         //------------------------ End test case core-0089NO -------------------------\r
4449         //\r
4450         //------------------------- test case core-0090NO ----------------------------\r
4451         //\r
4452         // Testing feature - The "removeChild" method of a node raises a\r
4453         //                   NO_MODIFICATION_ALLOWED_ERR Exception if the \r
4454         //                   node is readonly.\r
4455         //\r
4456         // Testing approach - Retrieve the first EntityReference inside the second\r
4457         //                    employee and invoke its removeChild(oldChild) method\r
4458         //                    where oldChild is one of the EntityReference descendants.\r
4459         //                    Descendants of EntityReference nodes are readonly and\r
4460         //                    therefore the desired exception should be raised. \r
4461         //\r
4462         // Semantic Requirements: 58\r
4463         //\r
4464         //----------------------------------------------------------------------------\r
4465 \r
4466         [Test]\r
4467         public void core0090NO()\r
4468         {\r
4469             string computedValue = "";\r
4470             System.Xml.XmlEntityReference entityRefNode = null;\r
4471             System.Xml.XmlNode testNode = null;\r
4472             System.Xml.XmlNode oldChild = null;\r
4473             string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;\r
4474 \r
4475             testResults results = new testResults("Core0090NO");\r
4476             try\r
4477             {\r
4478                 results.description = "The \"removeChild(oldChild)\" method of a node "+\r
4479                     "raises NO_MODIFICATION_ALLOWED_ERR Exception "+\r
4480                     "if this node is readonly.";\r
4481                 //\r
4482                 // Retreive targeted data and define oldChild.\r
4483                 //\r
4484                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
4485                 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.\r
4486                 oldChild = entityRefNode.FirstChild;\r
4487                 //\r
4488                 // Attempt to remove a descendant of an EntityReference node should\r
4489                 // raise an exception.\r
4490                 //\r
4491                 try \r
4492                 {\r
4493                     entityRefNode.RemoveChild(oldChild);\r
4494                 }\r
4495                 catch(ArgumentException ex) \r
4496                 {\r
4497                     computedValue = ex.GetType ().FullName; \r
4498                 }\r
4499             }\r
4500             catch(System.Exception ex)\r
4501             {\r
4502                 computedValue = "Exception " + ex.Message;\r
4503             }\r
4504 \r
4505             results.expected = expectedValue;\r
4506             results.actual = computedValue;\r
4507 \r
4508             util.resetData();\r
4509             Assert.AreEqual (results.expected, results.actual);\r
4510         }\r
4511 \r
4512         //------------------------ End test case core-0090NO -------------------------\r
4513         //\r
4514         //------------------------- test case core-0091NO ----------------------------\r
4515         //\r
4516         // Testing feature - The "appendChild" method of a node raises a\r
4517         //                   NO_MODIFICATION_ALLOWED_ERR Exception if \r
4518         //                   the node is readonly.\r
4519         //\r
4520         // Testing approach - Retrieve the first EntityReference inside the second\r
4521         //                    employee and invoke its append(newChild) method.  \r
4522         //                    Descendants of EntityReference nodes are readonly and\r
4523         //                    therefore attempts to append nodes to such podes  \r
4524         //                    should raise the desired exception.  This test \r
4525         //                    also makes use of the "createElement" method from\r
4526         //                    the Document interface.\r
4527         //\r
4528         // Semantic Requirements: 59\r
4529         //\r
4530         //----------------------------------------------------------------------------\r
4531 \r
4532         [Test]\r
4533         public void core0091NO()\r
4534         {\r
4535             string computedValue = "";\r
4536             System.Xml.XmlEntityReference entityRefNode = null;\r
4537             System.Xml.XmlNode testNode = null;\r
4538             System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
4539             string expectedValue = "System.InvalidOperationException";//util.NO_MODIFICATION_ALLOWED_ERR;\r
4540 \r
4541             testResults results = new testResults("Core0091NO");\r
4542             try\r
4543             {\r
4544                 results.description = "The \"appendChild(newChild)\" method of a node "+\r
4545                     "raises NO_MODIFICATION_ALLOWED_ERR Exception "+\r
4546                     "if this node is readonly.";\r
4547                 //\r
4548                 // Retrieve targeted data. \r
4549                 //\r
4550                 testNode = util.nodeObject(util.SECOND,util.SIXTH);\r
4551                 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.\r
4552                 //\r
4553                 // Attempt to append nodes to descendants of EntityReference nodes should \r
4554                 // raise an exception.\r
4555                 //\r
4556                 try \r
4557                 {\r
4558                     entityRefNode.AppendChild(newChild);\r
4559                 }\r
4560                 catch(InvalidOperationException ex) \r
4561                 {\r
4562                     computedValue = ex.GetType ().FullName; \r
4563                 }\r
4564             }\r
4565             catch(System.Exception ex)\r
4566             {\r
4567                 computedValue = "Exception " + ex.Message;\r
4568             }\r
4569             results.expected = expectedValue;\r
4570             results.actual = computedValue;\r
4571 \r
4572             util.resetData();\r
4573             Assert.AreEqual (results.expected, results.actual);\r
4574         }\r
4575 \r
4576         //------------------------ End test case core-0091NO -------------------------\r
4577         //\r
4578         //------------------------- test case core-0092NO -----------------------------\r
4579         //\r
4580         // Testing feature - The "insertBefore()" method of a node raises\r
4581         //                   a System.ArgumentException Exception if this node\r
4582         //                   is of a type that does not allow children of the\r
4583         //                   type of "newChild" to be inserted.\r
4584         //\r
4585         // Testing Approach - Retrieve the root node and attempt to insert a newly \r
4586         //                    created Attr node.  An Element node can not have\r
4587         //                    children of the "Attr" type, therefore the desired\r
4588         //                    exception should be raised. \r
4589         //\r
4590         // Semantic Requirements: 60\r
4591         //\r
4592         //----------------------------------------------------------------------------\r
4593 \r
4594         [Test]\r
4595         public void core0092NO()\r
4596         {\r
4597             string computedValue = "";\r
4598             System.Xml.XmlElement rootNode = null;\r
4599             System.Xml.XmlAttribute newChild = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"newAttribute");\r
4600             System.Xml.XmlNode refChild = null;\r
4601             string expectedValue = "System.InvalidOperationException";\r
4602 \r
4603             testResults results = new testResults("Core0092NO");\r
4604             try\r
4605             {\r
4606                 results.description = "The \"insertBefore()\" method of a node raises "+\r
4607                     "a System.ArgumentException Exception if this node "+\r
4608                     "does not allow nodes of type of \"newChild\" to be "+\r
4609                     "inserted.";\r
4610                 //\r
4611                 // Retrieve targeted data.\r
4612                 //\r
4613                 rootNode = util.getRootNode();\r
4614                 refChild = util.nodeObject(util.SECOND,-1);\r
4615                 //\r
4616                 // Attempt to insert an invalid child should raise an exception.\r
4617                 //\r
4618                 try \r
4619                 {\r
4620                     rootNode.InsertBefore(newChild,refChild);//.node\r
4621                 }\r
4622                 catch(System.Exception ex) \r
4623                 {\r
4624                     computedValue = ex.GetType().ToString(); \r
4625                 }\r
4626             }\r
4627             catch(System.Exception ex)\r
4628             {\r
4629                 computedValue = "Exception " + ex.Message;\r
4630             }\r
4631 \r
4632             results.expected = expectedValue;\r
4633             results.actual = computedValue;\r
4634 \r
4635             util.resetData();\r
4636             Assert.AreEqual (results.expected, results.actual);\r
4637         }\r
4638 \r
4639         //------------------------ End test case core-0092NO -------------------------\r
4640         //\r
4641         //------------------------- test case core-0093NO ----------------------------\r
4642         //\r
4643         // Testing feature - The "insertBefore()" method of a node raises\r
4644         //                   a System.ArgumentException Exception if the node\r
4645         //                   to be inserted is one of this node's ancestors.\r
4646         //\r
4647         // Testing Approach - Retrieve the second employee and attempt to insert\r
4648         //                    a node that is one of its ancestors (root node).\r
4649         //                    An attempt to insert such a node should raise the\r
4650         //                    desired exception.\r
4651         //\r
4652         // Semantic Requirements: 61\r
4653         //\r
4654         //----------------------------------------------------------------------------\r
4655 \r
4656         [Test]\r
4657         public void core0093NO()\r
4658         {\r
4659             string computedValue = "";\r
4660             System.Xml.XmlNode newChild = null;\r
4661             System.Xml.XmlNode refChild = null;\r
4662             string expectedValue = "System.ArgumentException";\r
4663 \r
4664             testResults results = new testResults("Core0093NO");\r
4665             try\r
4666             {\r
4667                 results.description = "The \"insertBefore()\" method of a node raises "+\r
4668                     "an System.ArgumentException Exception if the node "+\r
4669                     "to be inserted is one of this node's ancestors.";\r
4670                 //\r
4671                 // Retrieve targeted data and define reference and new childs.\r
4672                 //\r
4673                 newChild = util.getRootNode();\r
4674                 System.Xml.XmlElement testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
4675                 refChild = util.getSubNodes(testNode).Item(util.FIRST);\r
4676                 //\r
4677                 // Attempt to insert a node that is one of this node ancestors should\r
4678                 // raise an exception.\r
4679                 //\r
4680                 try \r
4681                 {\r
4682                     testNode.InsertBefore(newChild, refChild);//.node.\r
4683                 }\r
4684                 catch(System.Exception ex) \r
4685                 {\r
4686                     computedValue = ex.GetType().ToString();\r
4687                 }\r
4688 \r
4689             }\r
4690             catch(System.Exception ex)\r
4691             {\r
4692                 computedValue = "Exception " + ex.Message;\r
4693             }\r
4694             results.expected = expectedValue;\r
4695             results.actual = computedValue;\r
4696 \r
4697             util.resetData();\r
4698 \r
4699             Assert.AreEqual (results.expected, results.actual);\r
4700         }\r
4701 \r
4702         //------------------------ End test case core-0093NO -------------------------\r
4703         //\r
4704         //------------------------- test case core-0094NO -----------------------------\r
4705         //\r
4706         // Testing feature - The "replaceChild" method of a node raises a\r
4707         //                   System.ArgumentException Exception if this node\r
4708         //                   is of a type that does not allow children of the\r
4709         //                   type of "newChild" to be inserted.\r
4710         //\r
4711         // Testing Approach - Retrieve the root node and attempt to replace one of\r
4712         //                    its children with a newly created Attr node.  An \r
4713         //                    Element node can not have children of the "Attr"\r
4714         //                    type, therefore the desired exception should be raised.\r
4715         //\r
4716         // Semantic Requirements: 62\r
4717         //\r
4718         //----------------------------------------------------------------------------\r
4719 \r
4720         [Test]\r
4721         public void core0094NO()\r
4722         {\r
4723             string computedValue = "";\r
4724             System.Xml.XmlElement rootNode = null;\r
4725             System.Xml.XmlAttribute newChild = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"newAttribute");\r
4726             System.Xml.XmlNode oldChild = null;\r
4727             string expectedValue = "System.InvalidOperationException";\r
4728 \r
4729             testResults results = new testResults("Core0094NO");\r
4730             try\r
4731             {\r
4732                 results.description = "The \"replaceChild()\" method of a node raises "+\r
4733                     "a System.ArgumentException Exception if this node "+\r
4734                     "does not allow nodes of type of \"newChild\".";\r
4735                 //\r
4736                 // Retrieve targeted data and define oldChild. \r
4737                 //\r
4738                 rootNode = util.getRootNode();\r
4739                 oldChild = util.nodeObject(util.SECOND,-1);\r
4740                 //\r
4741                 // Attempt to replace a child with an invalid child should raise an exception.\r
4742                 //\r
4743                 try \r
4744                 {\r
4745                     rootNode.ReplaceChild(newChild,oldChild);\r
4746                 }\r
4747                 catch(System.Exception ex) \r
4748                 {\r
4749                     computedValue = ex.GetType().ToString(); \r
4750                 }\r
4751     \r
4752             }\r
4753             catch(System.Exception ex) \r
4754             {\r
4755                 computedValue = ex.Message; \r
4756             }\r
4757             results.expected = expectedValue;\r
4758             results.actual = computedValue;\r
4759 \r
4760             util.resetData();\r
4761 \r
4762             Assert.AreEqual (results.expected, results.actual);\r
4763         }\r
4764 \r
4765         //------------------------ End test case core-0094NO -------------------------\r
4766         //\r
4767         //------------------------- test case core-0095NO ----------------------------\r
4768         //\r
4769         // Testing feature - The "replaceChild()" method of a node raises\r
4770         //                   a System.ArgumentException Exception if the node\r
4771         //                   to be inserted is one of this node's ancestors.\r
4772         //\r
4773         // Testing Approach - Retrieve the second employee and attempt to replace one\r
4774         //                    of its children with an ancestor node (root node).\r
4775         //                    An attempt to make such a replacement should raise the\r
4776         //                    desired exception.\r
4777         //\r
4778         // Semantic Requirements: 63\r
4779         //\r
4780         //----------------------------------------------------------------------------\r
4781 \r
4782         [Test]\r
4783         public void core0095NO()\r
4784         {\r
4785             string computedValue = "";\r
4786             System.Xml.XmlNode newChild = null;\r
4787             System.Xml.XmlNode oldChild = null;\r
4788             System.Xml.XmlElement testNode = null;\r
4789             string expectedValue = "System.InvalidOperationException";\r
4790 \r
4791             testResults results = new testResults("Core0095NO");\r
4792             try\r
4793             {\r
4794                 results.description = "The \"replaceChild()\" method of a node raises "+\r
4795                     "a System.ArgumentException Exception if the node "+\r
4796                     "to be put is one of this node's ancestors.";\r
4797                 //\r
4798                 // Retrieve targeted data and define new and old childs. \r
4799                 //\r
4800                 newChild = util.getRootNode();\r
4801                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
4802                 oldChild = util.getSubNodes(testNode).Item(util.FIRST);\r
4803                 //\r
4804                 // Attempt to replace a child with an ancestor should raise an exception.\r
4805                 //\r
4806                 try \r
4807                 {\r
4808                     testNode.ReplaceChild(newChild,oldChild);//.node.\r
4809                 }\r
4810                 catch(InvalidOperationException ex) \r
4811                 {\r
4812                     computedValue = ex.GetType().ToString(); \r
4813                 }\r
4814 \r
4815             }\r
4816             catch(System.Exception ex)\r
4817             {\r
4818                 computedValue = "Exception " + ex.Message;\r
4819             }\r
4820 \r
4821             results.expected = expectedValue;\r
4822             results.actual = computedValue;\r
4823 \r
4824             util.resetData();\r
4825 \r
4826             Assert.AreEqual (results.expected, results.actual);\r
4827         }\r
4828 \r
4829         //------------------------ End test case core-0095NO -------------------------\r
4830         //\r
4831         //------------------------- test case core-0096NO ----------------------------\r
4832         //\r
4833         // Testing feature - The "appendChild" method of a node raises a\r
4834         //                   System.ArgumentException Exception if this node\r
4835         //                   is of a type that does not allow children of the\r
4836         //                   type of "newChild".\r
4837         //\r
4838         // Testing Approach - Retrieve the root node and attempt to append a\r
4839         //                    newly created Attr node to it.  An Element\r
4840         //                    node can not have children of the "Attr" type,\r
4841         //                    therefore the desired exception should be raised.\r
4842         //\r
4843         // Semantic Requirements: 64\r
4844         //\r
4845         //----------------------------------------------------------------------------\r
4846 \r
4847         [Test]\r
4848         public void core0096NO()\r
4849         {\r
4850             string computedValue = "";\r
4851             System.Xml.XmlElement rootNode = null;\r
4852             System.Xml.XmlAttribute newChild = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"newAttribute");\r
4853             string expectedValue = "System.InvalidOperationException";\r
4854 \r
4855             testResults results = new testResults("Core0096NO");\r
4856             try\r
4857             {\r
4858                 results.description = "The \"appendChild()\" method of a node raises "+\r
4859                     "a System.ArgumentException Exception if this node "+\r
4860                     "does not allow nodes of type of \"newChild\".";\r
4861                 //\r
4862                 // Retrieve the targeted data.\r
4863                 //\r
4864                 rootNode = util.getRootNode();\r
4865                 //\r
4866                 // Attempt to append an invalid child should raise an exception.\r
4867                 //\r
4868                 try \r
4869                 {\r
4870                     rootNode.AppendChild(newChild);\r
4871                 }\r
4872                 catch(System.Exception ex) \r
4873                 {\r
4874                     computedValue = ex.GetType().ToString(); \r
4875                 }\r
4876     \r
4877             }\r
4878             catch(System.Exception ex)\r
4879             {\r
4880                 computedValue = "Exception " + ex.Message;\r
4881             }\r
4882             results.expected = expectedValue;\r
4883             results.actual = computedValue;\r
4884 \r
4885                         util.resetData();\r
4886 \r
4887             Assert.AreEqual (results.expected, results.actual);\r
4888         }\r
4889 \r
4890         //------------------------ End test case core-0096NO -------------------------\r
4891         //\r
4892         //------------------------- test case core-0097NO ----------------------------\r
4893         //\r
4894         // Testing feature - The "appendChild" method of a node raises\r
4895         //                   an System.ArgumentException Exception if the node\r
4896         //                   to be appended is one of this node's ancestors.\r
4897         //\r
4898         // Testing Approach - Retrieve the second employee and attempt to append to \r
4899         //                    it an ancestor node (root node). An attempt to make \r
4900         //                    such an insertion should raise the desired exception.\r
4901         //\r
4902         // Semantic Requirements: 65\r
4903         //\r
4904         //----------------------------------------------------------------------------\r
4905 \r
4906         [Test]\r
4907         public void core0097NO()\r
4908         {\r
4909             string computedValue = "";\r
4910             System.Xml.XmlNode newChild = null;\r
4911             System.Xml.XmlNode testNode = null;\r
4912             string expectedValue = "System.ArgumentException";\r
4913 \r
4914             testResults results = new testResults("Core0097NO");\r
4915             try\r
4916             {\r
4917                 results.description = "The \"appendChild()\" method of a node raises "+\r
4918                     "a System.ArgumentException Exception if the node "+\r
4919                     "to append is one of this node's ancestors.";\r
4920                 //\r
4921                 // Retrieve the targeted data and define the new child.\r
4922                 //\r
4923                 newChild = util.getRootNode();\r
4924                 testNode = util.nodeObject(util.SECOND,-1);\r
4925                 //\r
4926                 // Attempt to replace a child with an ancestor should raise an exception.\r
4927                 //\r
4928                 try \r
4929                 {\r
4930                     testNode.AppendChild(newChild);//.node.\r
4931                 }\r
4932                 catch(System.Exception ex) \r
4933                 {\r
4934                     computedValue = ex.GetType().ToString(); \r
4935                 }\r
4936             }\r
4937             catch(System.Exception ex)\r
4938             {\r
4939                 computedValue = "Exception " + ex.Message;\r
4940             }\r
4941 \r
4942             results.expected = expectedValue;\r
4943             results.actual = computedValue;\r
4944 \r
4945             util.resetData();\r
4946 \r
4947             Assert.AreEqual (results.expected, results.actual);\r
4948         }\r
4949 \r
4950         //------------------------ End test case core-0097NO -------------------------\r
4951         //\r
4952         //------------------------- test case core-0098NO ----------------------------\r
4953         //\r
4954         // Testing feature - The "insertBefore" method of a node raises a\r
4955         //                   NOT_FOUND_ERR Exception if the reference child is not\r
4956         //                   child of this node.\r
4957         //\r
4958         // Testing Approach - Retrieve the second employee and attempt to insert\r
4959         //                    a new node before a reference node that is not\r
4960         //                    a child of this node.  An attempt to insert before a\r
4961         //                    non child node should raise the desired exception.\r
4962         //\r
4963         // Semantic Requirements: 66\r
4964         //\r
4965         //----------------------------------------------------------------------------\r
4966 \r
4967         [Test]\r
4968         public void core0098NO()\r
4969         {\r
4970             string computedValue = "";\r
4971             System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
4972             System.Xml.XmlElement refChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"refChild");\r
4973             System.Xml.XmlNode testNode = null;\r
4974             string expectedValue = "System.ArgumentException";//util.NOT_FOUND2_ERR;\r
4975 \r
4976             testResults results = new testResults("Core0098NO");\r
4977             try\r
4978             {\r
4979                 results.description = "The \"insertBefore\" method of a node raises "+\r
4980                     "a NOT_FOUND_ERR Exception if the reference "+\r
4981                     "child is not a child of this node.";\r
4982                 //\r
4983                 // Retrieve targeted data.\r
4984                 //\r
4985                 testNode = util.nodeObject(util.SECOND,-1);\r
4986                 //\r
4987                 // Attempt to insert before a reference child that is not a child of\r
4988                 // this node should raise an exception.\r
4989                 //\r
4990                 try \r
4991                 {\r
4992                     testNode.InsertBefore(newChild,refChild);//.node.\r
4993                 }\r
4994                 catch(ArgumentException ex) \r
4995                 {\r
4996                     computedValue = ex.GetType ().FullName; \r
4997                 }\r
4998             }\r
4999             catch(System.Exception ex)\r
5000             {\r
5001                 computedValue = "Exception " + ex.Message;\r
5002             }\r
5003             results.expected = expectedValue;\r
5004             results.actual = computedValue;\r
5005 \r
5006             util.resetData();\r
5007 \r
5008             Assert.AreEqual (results.expected, results.actual);\r
5009         }\r
5010 \r
5011         //------------------------ End test case core-0098NO -----------------------\r
5012         //\r
5013         //------------------------- test case core-0099NO --------------------------\r
5014         //\r
5015         // Testing feature - The "replaceChild" method of a node raises a\r
5016         //                   NOT_FOUND_ERR Exception if the old child is not\r
5017         //                   child of this node.\r
5018         //\r
5019         // Testing Approach - Retrieve the second employee and attempt to replace \r
5020         //                    a node that is not one of its children.  An attempt \r
5021         //                    to replace such a node should raise the desired \r
5022         //                    exception.\r
5023         //\r
5024         // Semantic Requirements: 67\r
5025         //\r
5026         //----------------------------------------------------------------------------\r
5027 \r
5028         [Test]\r
5029         public void core0099NO()\r
5030         {\r
5031             string computedValue = "";\r
5032             System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild");\r
5033             System.Xml.XmlElement oldChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"oldChild");\r
5034             System.Xml.XmlNode testNode = null;\r
5035             string expectedValue = "System.ArgumentException";//util.NOT_FOUND2_ERR;\r
5036 \r
5037             testResults results = new testResults("Core0099NO");\r
5038             try\r
5039             {\r
5040                 results.description = "The \"replaceChild\" method of a node raises "+\r
5041                     "a NOT_FOUND_ERR Exception if the old child "+\r
5042                     "is not a child of this node.";\r
5043                 //\r
5044                 // Retrieve the targeted data..\r
5045                 //\r
5046                 testNode = util.nodeObject(util.SECOND,-1);\r
5047                 //\r
5048                 // Attempt to replace a non child node should raise an exception.\r
5049                 //\r
5050                 try \r
5051                 {\r
5052                     testNode.ReplaceChild(newChild,oldChild);//.node.\r
5053                 }\r
5054                 catch(ArgumentException ex) \r
5055                 {\r
5056                     computedValue = ex.GetType ().FullName; \r
5057                 }\r
5058             }\r
5059             catch(System.Exception ex)\r
5060             {\r
5061                 computedValue = "Exception " + ex.Message;\r
5062             }\r
5063             results.expected = expectedValue;\r
5064             results.actual = computedValue;\r
5065 \r
5066             util.resetData();\r
5067 \r
5068             Assert.AreEqual (results.expected, results.actual);\r
5069         }\r
5070 \r
5071         //------------------------ End test case core-0099NO -----------------------\r
5072         //\r
5073         //------------------------- test case core-0100NO --------------------------\r
5074         //\r
5075         // Testing feature - The "removeChild" method of a node raises a\r
5076         //                   NOT_FOUND_ERR Exception if the old child is not\r
5077         //                   child of this node.\r
5078         //\r
5079         // Testing Approach - Retrieve the second employee and attempt to remove\r
5080         //                    a node that is not one of its children.  An attempt\r
5081         //                    to remove such a node should raise the desired\r
5082         //                    exception.\r
5083         //\r
5084         // Semantic Requirements: 68\r
5085         //\r
5086         //----------------------------------------------------------------------------\r
5087 \r
5088         [Test]\r
5089         public void core0100NO()\r
5090         {\r
5091             string computedValue = "";\r
5092             System.Xml.XmlElement oldChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"oldChild");\r
5093             System.Xml.XmlNode testNode = null;\r
5094             string expectedValue = typeof (ArgumentException).FullName;//util.NOT_FOUND3_ERR;\r
5095 \r
5096             testResults results = new testResults("Core0100NO");\r
5097             try\r
5098             {\r
5099                 results.description = "The \"removeChild\" method of a node raises "+\r
5100                     "a NOT_FOUND_ERR Exception if the old "+\r
5101                     "child is not a child of this node.";\r
5102                 //\r
5103                 // Retrieve targeted data.\r
5104                 //\r
5105                 testNode = util.nodeObject(util.SECOND,-1);\r
5106                 //\r
5107                 // Attempt to remove a non child node should raise an exception.\r
5108                 //\r
5109                 try \r
5110                 {\r
5111                     testNode.RemoveChild(oldChild);//.node.\r
5112                 }\r
5113                 catch(ArgumentException ex) \r
5114                 {\r
5115                     computedValue = ex.GetType ().FullName; \r
5116                 }\r
5117             }\r
5118             catch(System.Exception ex)\r
5119             {\r
5120                 computedValue = "Exception " + ex.Message;\r
5121             }\r
5122             results.expected = expectedValue;\r
5123             results.actual = computedValue;\r
5124 \r
5125                         util.resetData();\r
5126 \r
5127             Assert.AreEqual (results.expected, results.actual);\r
5128         }\r
5129 \r
5130         //------------------------ End test case core-0100NO -----------------------\r
5131         //\r
5132         //------------------------- test case core-0101NO ----------------------------\r
5133         //\r
5134         // Testing feature - The "insertBefore" method of a node raises a\r
5135         //                   System.ArgumentException Exception if the new child was\r
5136         //                   created from a different document than the one that \r
5137         //                   created this node.\r
5138         //\r
5139         // Testing Approach - Retrieve the second employee and attempt to insert\r
5140         //                    a new child that was created from a different\r
5141         //                    document than the one that created the second employee.\r
5142         //                    An attempt to insert such a child should raise \r
5143         //                    the desired exception.\r
5144         //\r
5145         // Semantic Requirements: 69\r
5146         //\r
5147         //----------------------------------------------------------------------------\r
5148 \r
5149         [Test]\r
5150         public void core0101NO()\r
5151         {\r
5152             string computedValue = "";\r
5153             System.Xml.XmlElement newChild = util.getOtherDOMDocument().CreateElement("newChild");\r
5154             System.Xml.XmlNode refChild = null;\r
5155             System.Xml.XmlElement testNode = null;\r
5156             string expectedValue = "System.ArgumentException";\r
5157 \r
5158             testResults results = new testResults("Core0101NO");\r
5159             try\r
5160             {\r
5161                 results.description = "The \"insertBefore\" method of a node raises "+\r
5162                     "a System.ArgumentException Exception if the new "+\r
5163                     "child was created from a document different "+\r
5164                     "from the one that created this node.";\r
5165                 //\r
5166                 // Retrieve targeted data and define reference child.\r
5167                 //\r
5168                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
5169                 refChild = util.getSubNodes(testNode).Item(util.FOURTH);\r
5170                 //\r
5171                 // Attempt to insert a child from a different document should raise an\r
5172                 // exception.\r
5173                 //\r
5174                 try \r
5175                 {\r
5176                     testNode.InsertBefore(newChild,refChild);//.node.\r
5177                 }\r
5178                 catch(System.Exception ex) \r
5179                 {\r
5180                     computedValue = ex.GetType().ToString(); \r
5181                 }\r
5182             }\r
5183             catch(System.Exception ex)\r
5184             {\r
5185                 computedValue = "Exception " + ex.Message;\r
5186             }\r
5187 \r
5188             results.expected = expectedValue;\r
5189             results.actual = computedValue;\r
5190 \r
5191                         util.resetData();\r
5192             Assert.AreEqual (results.expected, results.actual);\r
5193         }\r
5194 \r
5195         //------------------------ End test case core-0101NO -----------------------\r
5196         //\r
5197         //------------------------- test case core-0102NO --------------------------\r
5198         //\r
5199         // Testing feature - The "replaceChild" method of a node raises a\r
5200         //                   System.ArgumentException Exception if the new child was\r
5201         //                   created from a different document than the one that\r
5202         //                   created this node.\r
5203         //\r
5204         // Testing Approach - Retrieve the second employee and attempt to  \r
5205         //                    replace one of its children with a node created\r
5206         //                    from a different document.  An attempt to make such\r
5207         //                    replacement should raise the desired exception.\r
5208         //\r
5209         // Semantic Requirements: 70\r
5210         //\r
5211         //----------------------------------------------------------------------------\r
5212 \r
5213         [Test]\r
5214         public void core0102NO()\r
5215         {\r
5216             string computedValue = "";\r
5217             System.Xml.XmlElement newChild = util.getOtherDOMDocument().CreateElement("newChild");\r
5218             System.Xml.XmlNode oldChild = null;\r
5219             System.Xml.XmlElement testNode = null;\r
5220             string expectedValue = "System.ArgumentException";\r
5221 \r
5222             testResults results = new testResults("Core0102NO");\r
5223             try\r
5224             {\r
5225                 results.description = "The \"replaceChild\" method of a node raises "+\r
5226                     "a System.ArgumentException Exception if the new "+\r
5227                     "child was created from a document different "+\r
5228                     "from the one that created this node.";\r
5229                 //\r
5230                 // Retrieve targeted data and define oldChild.\r
5231                 //\r
5232                 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);\r
5233                 oldChild = util.getSubNodes(testNode).Item(util.FIRST);\r
5234                 //\r
5235                 // Attempt to replace a child with a child from a different document\r
5236                 // should raise an exception.\r
5237                 //\r
5238                 try \r
5239                 {\r
5240                     testNode.ReplaceChild(newChild,oldChild);//.node.\r
5241                 }\r
5242                 catch(System.Exception ex) \r
5243                 {\r
5244                     computedValue = ex.GetType().ToString(); \r
5245                 }\r
5246             }\r
5247             catch(System.Exception ex)\r
5248             {\r
5249                 computedValue = "Exception " + ex.Message;\r
5250             }\r
5251 \r
5252             results.expected = expectedValue;\r
5253             results.actual = computedValue;\r
5254 \r
5255                 util.resetData();\r
5256                         Assert.AreEqual (results.expected, results.actual);\r
5257         }\r
5258 \r
5259         //------------------------ End test case core-0102NO -----------------------\r
5260         //\r
5261         //------------------------- test case core-0103NO --------------------------\r
5262         //\r
5263         // Testing feature - The "appendChild" method of a node raises a\r
5264         //                   System.ArgumentException Exception if the new child was\r
5265         //                   created from a different document than the one that\r
5266         //                   created this node.\r
5267         //\r
5268         // Testing Approach - Retrieve the second employee and attempt to append \r
5269         //                    to it a node that was created from different\r
5270         //                    document.  An attempt to make such an insertion \r
5271         //                    should raise the desired exception.\r
5272         //\r
5273         // Semantic Requirements: 71\r
5274         //\r
5275         //----------------------------------------------------------------------------\r
5276 \r
5277         [Test]\r
5278         public void core0103NO()\r
5279         {\r
5280             string computedValue = "";\r
5281             System.Xml.XmlElement newChild = util.getOtherDOMDocument().CreateElement("newChild");\r
5282             System.Xml.XmlNode testNode = null;\r
5283             string expectedValue = "System.ArgumentException";\r
5284 \r
5285             testResults results = new testResults("Core0103NO");\r
5286             try\r
5287             {\r
5288                 results.description = "The \"appendChild\" method of a node raises a "+\r
5289                     "a System.ArgumentException Exception if the new "+\r
5290                     "child was created from a document different "+\r
5291                     "from the one that created this node.";\r
5292                 //\r
5293                 // Retrieve the targeted data.\r
5294                 //\r
5295                 testNode = util.nodeObject(util.SECOND,-1);\r
5296                 //\r
5297                 // Attempt to append a child from a different document should raise an\r
5298                 // exception.\r
5299                 //\r
5300                 try \r
5301                 {\r
5302                     testNode.AppendChild(newChild);//.node.\r
5303                 }\r
5304                 catch(System.Exception ex) \r
5305                 {\r
5306                     computedValue = ex.GetType().ToString(); \r
5307                 }\r
5308             }\r
5309             catch(System.Exception ex)\r
5310             {\r
5311                 computedValue = "Exception " + ex.Message;\r
5312             }\r
5313             results.expected = expectedValue;\r
5314             results.actual = computedValue;\r
5315                 \r
5316                         util.resetData();\r
5317             Assert.AreEqual (results.expected, results.actual);\r
5318         }\r
5319 \r
5320         //------------------------ End test case core-0103NO -----------------------\r
5321     }\r
5322 }