1 //**************************************************************************
\r
4 // National Institute Of Standards and Technology
\r
9 // Written by: Carmelo Montanez
\r
10 // Modified by: Mary Brady
\r
12 // Ported to System.Xml by: Mizrahi Rafael rafim@mainsoft.com
\r
13 // Mainsoft Corporation (c) 2003-2004
\r
14 //**************************************************************************
\r
19 using NUnit.Framework;
\r
21 namespace nist_dom.fundamental
\r
24 public class NodeTest
\r
26 public static int i = 2;
\r
28 public testResults[] RunTests()
\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
61 //------------------------ test case core-0001NO------------------------
\r
63 // Testing feature - The "nodeType" attribute for an Element node is
\r
64 // 1 (ELEMENT_NODE).
\r
66 // Testing approach - Retrieve the root node and check its "nodeType"
\r
67 // attribute. It should be set to 1.
\r
69 // Semantic Requirements: 1, 14
\r
71 //----------------------------------------------------------------------------
\r
74 public void core0001NO()
\r
76 int computedValue = 0;
\r
77 int expectedValue = util.ELEMENT_NODE;
\r
79 testResults results = new testResults("Core0001NO");
\r
81 results.description = "The nodeType attribute for an Element Node "+
\r
82 " should be set to the constant 1.";
\r
84 // The nodeType attribute for the root node should be set to the value 1.
\r
86 computedValue = (int)util.getRootNode().NodeType;
\r
88 // write out results.
\r
90 results.expected = expectedValue.ToString();
\r
91 results.actual = computedValue.ToString();
\r
92 Assert.AreEqual (results.expected, results.actual);
\r
95 //------------------------ End test case core-0001NO --------------------------
\r
97 //------------------------- test case core-0002NO -----------------------------
\r
99 // Testing feature - The "nodeType" attribute for an Attribute node is
\r
100 // 2 (ATTRIBUTE_NODE).
\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
106 // Semantic Requirements: 2, 14
\r
108 //----------------------------------------------------------------------------
\r
111 public void core0002NO()
\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
118 testResults results = new testResults("Core0002NO");
\r
121 results.description = "The nodeType attribute for an Attribute Node "+
\r
122 " should be set to the constant 2.";
\r
124 // Retrieve the targeted data and its type.
\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
130 catch(System.Exception ex)
\r
132 computedValue = "Exception " + ex.Message;
\r
135 // write out results.
\r
137 results.expected = expectedValue.ToString();
\r
138 results.actual = computedValue;
\r
140 Assert.AreEqual (results.expected, results.actual);
\r
143 //------------------------ End test case core-0002NO --------------------------
\r
145 //------------------------- test case core-0003NO -----------------------------
\r
147 // Testing feature - The "nodeType" attribute for a Text node is
\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
154 // Semantic Requirements: 3, 14
\r
156 //----------------------------------------------------------------------------
\r
159 public void core0003NO()
\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
166 testResults results = new testResults("Core0003NO");
\r
169 results.description = "The nodeType attribute for a Text Node "+
\r
170 " should be set to the constant 3.";
\r
173 // Retrieve the targeted data.
\r
175 testNode = util.nodeObject(util.FIRST,util.SIXTH);
\r
176 textNode = testNode.FirstChild;//.node.
\r
178 // The nodeType attribute should be set to the value 3.
\r
180 computedValue = ((int)textNode.NodeType).ToString();
\r
182 catch(System.Exception ex)
\r
184 computedValue = "Exception " + ex.Message;
\r
187 // write out results.
\r
189 results.expected = expectedValue.ToString();
\r
190 results.actual = computedValue;
\r
192 Assert.AreEqual (results.expected, results.actual);
\r
195 //------------------------ End test case core-0003NO --------------------------
\r
197 //------------------------- test case core-0004NO -----------------------------
\r
199 // Testing feature - The "nodeType" attribute for a CDATASection node is
\r
200 // 4 (CDATA_SECTION_NODE).
\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
207 // Semantic Requirements: 4, 14
\r
209 //----------------------------------------------------------------------------
\r
212 public void core0004NO()
\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
219 testResults results = new testResults("Core0004NO");
\r
222 results.description = "The nodeType attribute for a CDATASection Node "+
\r
223 " should be set to the constant 4.";
\r
225 // Retrieve the targeted data.
\r
227 testNode = util.nodeObject(util.SECOND,util.SECOND);
\r
228 cDataNode = testNode.LastChild; //.node.
\r
230 // The nodeType attribute should be set to the value 3.
\r
232 computedValue = ((int)cDataNode.NodeType).ToString();
\r
234 catch(System.Exception ex)
\r
236 computedValue = "Exception " + ex.Message;
\r
239 // write out results.
\r
241 results.expected = expectedValue.ToString();
\r
242 results.actual = computedValue.ToString();
\r
244 Assert.AreEqual (results.expected, results.actual);
\r
247 //------------------------ End test case core-0004NO --------------------------
\r
249 //------------------------- test case core-0005NO -----------------------------
\r
251 // Testing feature - The "nodeType" attribute for an EntityReference node
\r
252 // is 5 (ENTITY_REFERENCE_NODE).
\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
258 // Semantic Requirements: 5, 14
\r
260 //----------------------------------------------------------------------------
\r
263 public void core0005NO()
\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
270 testResults results = new testResults("Core0005NO");
\r
273 results.description = "The nodeType attribute for an EntityReference Node "+
\r
274 " should be set to the constant 5.";
\r
277 // Retrieve the targeted data.
\r
279 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
280 entRefNode = testNode.FirstChild;//.node.
\r
282 // The nodeType attribute should be set to the value 5.
\r
284 computedValue = entRefNode.NodeType.ToString();
\r
286 catch(System.Exception ex)
\r
288 computedValue = "Exception " + ex.Message;
\r
291 // write out results.
\r
293 results.expected = expectedValue.ToString();
\r
294 results.actual = computedValue.ToString();
\r
296 Assert.AreEqual (results.expected, results.actual);
\r
299 //------------------------ End test case core-0005NO --------------------------
\r
301 //------------------------- test case core-0006NO -----------------------------
\r
303 // Testing feature - The "nodeType" attribute for an Entity node
\r
304 // 6 (ENTITY_NODE).
\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
310 // Semantic Requirements: 6, 14
\r
312 //----------------------------------------------------------------------------
\r
315 public void core0006NO()
\r
317 int computedValue = 0;
\r
318 System.Xml.XmlNode testNode = null;
\r
319 int expectedValue = util.ENTITY_NODE;
\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
325 // Get the targeted data and its type.
\r
327 testNode = util.getEntity("ent1");
\r
329 // The nodeType attribute should be set to the value 6.
\r
331 computedValue = (int)testNode.NodeType;
\r
334 // write out results.
\r
336 results.expected = expectedValue.ToString();
\r
337 results.actual = computedValue.ToString();
\r
339 Assert.AreEqual (results.expected, results.actual);
\r
342 //------------------------ End test case core-0006NO --------------------------
\r
344 //------------------------- test case core-0007NO -----------------------------
\r
346 // Testing feature - The "nodeType" attribute for a ProcessingInstruction.
\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
352 // Semantic Requirements: 7, 14
\r
354 //----------------------------------------------------------------------------
\r
357 public void core0007NO()
\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
363 testResults results = new testResults("Core0007NO");
\r
364 results.description = "The nodeType attribute for an ProcessingInstruction Node.";
\r
366 // Get the targeted data.
\r
368 testNode = util.getDOMDocument().ChildNodes.Item(0);
\r
370 // The nodeType attribute should be set to the value 7.
\r
372 computedValue = ((int)testNode.NodeType).ToString();
\r
374 // write out results.
\r
376 results.expected = expectedValue.ToString();
\r
377 results.actual = computedValue.ToString();
\r
379 Assert.AreEqual (results.expected, results.actual);
\r
382 //------------------------ End test case core-0007NO --------------------------
\r
384 //------------------------- test case core-0008NO -----------------------------
\r
386 // Testing feature - The "nodeType" attribute for a comment node is
\r
387 // 8 (COMMENT_NODE).
\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
393 // Semantic Requirements: 8, 14
\r
395 //----------------------------------------------------------------------------
\r
398 public void core0008NO()
\r
400 int computedValue = 0;
\r
401 System.Xml.XmlNode testNode = null;
\r
402 int expectedValue = util.COMMENT_NODE;
\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
408 // Get the targeted data.
\r
410 testNode = util.getDOMDocument().ChildNodes.Item(2);
\r
412 // The nodeType attribute should be set to the value 8.
\r
414 computedValue = (int)testNode.NodeType;
\r
416 // write out results.
\r
418 results.expected = expectedValue.ToString();
\r
419 results.actual = computedValue.ToString();
\r
421 Assert.AreEqual (results.expected, results.actual);
\r
424 //------------------------ End test case core-0008NO --------------------------
\r
426 //------------------------- test case core-0009NO -----------------------------
\r
428 // Testing feature - The "nodeType" attribute for a Document node is
\r
429 // 9 (DOCUMENT_NODE).
\r
431 // Testing approach - Retrieve the DOM Document and examine its
\r
432 // "nodeType" attribute. It should be set to 9.
\r
434 // Semantic Requirements: 9, 14
\r
436 //----------------------------------------------------------------------------
\r
439 public void core0009NO()
\r
441 int computedValue = 0;
\r
442 System.Xml.XmlNode testNode = null;
\r
443 int expectedValue = util.DOCUMENT_NODE;
\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
449 // Get the targeted data.
\r
451 testNode = util.getDOMDocument();
\r
453 // The nodeType attribute should be set to the value 9.
\r
455 computedValue = (int)testNode.NodeType;
\r
457 // write out results.
\r
459 results.expected = expectedValue.ToString();
\r
460 results.actual = computedValue.ToString();
\r
462 Assert.AreEqual (results.expected, results.actual);
\r
465 //------------------------ End test case core-0009NO --------------------------
\r
467 //------------------------- test case core-0010NO -----------------------------
\r
469 // Testing feature - The "nodeType" attribute for a DocumentType node is
\r
470 // 10 (DOCUMENT_TYPE_NODE).
\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
476 // Semantic Requirements: 10, 14
\r
478 //----------------------------------------------------------------------------
\r
481 public void core0010NO()
\r
483 int computedValue = 0;
\r
484 System.Xml.XmlNode testNode = null;
\r
485 int expectedValue = util.DOCUMENT_TYPE_NODE;
\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
491 // Get the targeted data.
\r
493 testNode = util.getDocType();
\r
495 // The nodeType attribute should be set to the value 10.
\r
497 computedValue = (int)testNode.NodeType;
\r
499 // write out results.
\r
501 results.expected = expectedValue.ToString();
\r
502 results.actual = computedValue.ToString();
\r
504 Assert.AreEqual (results.expected, results.actual);
\r
507 //------------------------ End test case core-0010NO --------------------------
\r
509 //------------------------- test case core-0011NO -----------------------------
\r
511 // Testing feature - The "nodeType" attribute for a DocumentFragment node
\r
512 // is 11 (DOCUMENT_FRAGMENT_NODE).
\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
519 // Semantic Requirements: 11, 14
\r
521 //----------------------------------------------------------------------------
\r
524 public void core0011NO()
\r
526 int computedValue = 0;
\r
527 System.Xml.XmlNode testNode = null;
\r
528 int expectedValue = util.DOCUMENT_FRAGMENT_NODE;
\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
534 // Get the targeted data.
\r
536 testNode = util.getDOMDocument().CreateDocumentFragment();
\r
538 // The nodeType attribute should be set to the value 11.
\r
540 computedValue = (int)testNode.NodeType;
\r
542 // write out results.
\r
544 results.expected = expectedValue.ToString();
\r
545 results.actual = computedValue.ToString();
\r
547 Assert.AreEqual (results.expected, results.actual);
\r
550 //------------------------ End test case core-0011NO --------------------------
\r
552 //------------------------- test case core-0012NO -----------------------------
\r
554 // Testing feature - The "nodeType" attribute for a notation node is
\r
555 // 12 (NOTATION_NODE).
\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
561 // Semantic Requirements: 12, 14
\r
563 //----------------------------------------------------------------------------
\r
566 public void core0012NO()
\r
568 string computedValue = "";
\r
569 System.Xml.XmlNode testNode = null;
\r
570 string expectedValue = util.NOTATION_NODE.ToString();
\r
572 testResults results = new testResults("Core0012NO");
\r
575 results.description = "The nodeType attribute for a Notation Node "+
\r
576 " should be set to the constant 12.";
\r
578 // Get the targeted data.
\r
580 testNode = util.getNotation("notation1");
\r
582 // The nodeType attribute should be set to the value 12.
\r
584 computedValue = ((int)testNode.NodeType).ToString();
\r
586 catch(System.Exception ex)
\r
588 computedValue = "Exception " + ex.Message;
\r
591 // write out results.
\r
593 results.expected = expectedValue.ToString();
\r
594 results.actual = computedValue.ToString();
\r
596 Assert.AreEqual (results.expected, results.actual);
\r
599 //------------------------ End test case core-0012NO --------------------------
\r
601 //------------------------ test case core-0013NO ----------------------------
\r
603 // Testing feature - The "nodeName" attribute for an Element node is
\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
610 // Semantic Requirements: 13, 15
\r
612 //----------------------------------------------------------------------------
\r
615 public void core0013NO()
\r
617 string computedValue = "0";
\r
618 string expectedValue = "staff";
\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
624 // The nodeName attribute should be set to "staff".
\r
626 computedValue = util.getRootNode().Name;
\r
628 // write out results.
\r
630 results.expected = expectedValue;
\r
631 results.actual = computedValue;
\r
633 Assert.AreEqual (results.expected, results.actual);
\r
636 //------------------------ End test case core-0013NO --------------------------
\r
638 //------------------------- test case core-0014NO -----------------------------
\r
640 // Testing feature - The "nodeName" attribute for an Attribute node is
\r
641 // the name of the attribute.
\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
647 // Semantic Requirements: 13, 15
\r
649 //----------------------------------------------------------------------------
\r
652 public void core0014NO()
\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
659 testResults results = new testResults("Core0014NO");
\r
662 results.description = "The nodeName attribute for an Attribute Node " +
\r
663 "should be set to the name of the attribute.";
\r
665 // Retrieve the targeted data.
\r
667 testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
\r
668 attrNode = testNode.GetAttributeNode("domestic"); //.node.
\r
670 // The nodeName attribute should be set to the value "domestic".
\r
672 computedValue = attrNode.Name;
\r
674 catch(System.Exception ex)
\r
676 computedValue = "Exception " + ex.Message;
\r
679 // write out results.
\r
681 results.expected = expectedValue;
\r
682 results.actual = computedValue;
\r
684 Assert.AreEqual (results.expected, results.actual);
\r
687 //------------------------ End test case core-0014NO --------------------------
\r
689 //------------------------- test case core-0015NO -----------------------------
\r
691 // Testing feature - The "nodeName" attribute for a text node is
\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
698 // Semantic Requirements: 13, 15
\r
700 //----------------------------------------------------------------------------
\r
703 public void core0015NO()
\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
710 testResults results = new testResults("Core0015NO");
\r
713 results.description = "The nodeName attribute for a Text Node " +
\r
714 "should be set to \"#text\".";
\r
716 // Retrieve the targeted data.
\r
718 testNode = util.nodeObject(util.FIRST,util.SIXTH);
\r
719 textNode = testNode.FirstChild;//.node.
\r
721 // The nodeName attribute should be set to the value "#text".
\r
723 computedValue = textNode.Name;
\r
725 catch(System.Exception ex)
\r
727 computedValue = "Exception " + ex.Message;
\r
730 // write out results.
\r
732 results.expected = expectedValue;
\r
733 results.actual = computedValue;
\r
735 Assert.AreEqual (results.expected, results.actual);
\r
738 //------------------------ End test case core-0015NO --------------------------
\r
740 //------------------------- test case core-0016NO -----------------------------
\r
742 // Testing feature - The "nodeName" attribute for a CDATASection node is
\r
743 // "#cdata-section".
\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
749 // Semantic Requirements: 13, 15
\r
751 //----------------------------------------------------------------------------
\r
754 public void core0016NO()
\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
761 testResults results = new testResults("Core0016NO");
\r
764 results.description = "The nodeName attribute for a CDATASection Node " +
\r
765 "should be set to \"#cdata-section\".";
\r
767 // Retrieve the targeted data.
\r
769 testNode = util.nodeObject(util.SECOND,util.SECOND);
\r
770 cDataNode = testNode.LastChild;;//.node.
\r
772 // The nodeName attribute should be set to "#cdata-section".
\r
774 computedValue = cDataNode.Name;
\r
776 catch(System.Exception ex)
\r
778 computedValue = "Exception " + ex.Message;
\r
781 // write out results.
\r
783 results.expected = expectedValue;
\r
784 results.actual = computedValue;
\r
786 Assert.AreEqual (results.expected, results.actual);
\r
789 //------------------------ End test case core-0016NO --------------------------
\r
791 //------------------------- test case core-0017NO -----------------------------
\r
793 // Testing feature - The "nodeName" attribute for an EntityReference node
\r
794 // is the name of the entity referenced.
\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
800 // Semantic Requirements: 13, 15
\r
802 //----------------------------------------------------------------------------
\r
805 public void core0017NO()
\r
807 string computedValue = "";
\r
808 string expectedValue = "ent2";
\r
809 System.Xml.XmlNode testNode = null;
\r
810 System.Xml.XmlNode entRefNode = null;
\r
812 testResults results = new testResults("Core0017NO");
\r
815 results.description = "The nodeName attribute for an EntityReference Node " +
\r
816 "should be set to the name of the entity referenced.";
\r
818 // Retrieve the targeted data.
\r
820 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
821 entRefNode = testNode.FirstChild;//.node.
\r
823 // The nodeName attribute should be set to "ent2".
\r
825 computedValue = entRefNode.Name;
\r
827 catch(System.Exception ex)
\r
829 computedValue = "Exception " + ex.Message;
\r
832 // write out results.
\r
834 results.expected = expectedValue;
\r
835 results.actual = computedValue;
\r
837 Assert.AreEqual (results.expected, results.actual);
\r
839 //------------------------ End test case core-0017NO --------------------------
\r
841 //------------------------- test case core-0018NO -----------------------------
\r
843 // Testing feature - The "nodeName" attribute for an Entity node is
\r
844 // the entity name.
\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
851 // Semantic Requirements: 13, 15
\r
853 //----------------------------------------------------------------------------
\r
856 public void core0018NO()
\r
858 string computedValue = "";
\r
859 string expectedValue = "ent1";
\r
860 System.Xml.XmlNode testNode = null;
\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
866 // Get the targeted data.
\r
868 testNode = util.getEntity("ent1");
\r
870 // The nodeName attribute should be set to "ent1".
\r
872 computedValue = testNode.Name;
\r
874 // write out results.
\r
876 results.expected = expectedValue;
\r
877 results.actual = computedValue;
\r
879 Assert.AreEqual (results.expected, results.actual);
\r
882 //------------------------ End test case core-0018NO --------------------------
\r
884 //------------------------- test case core-0019NO -----------------------------
\r
886 // Testing feature - The "nodeName" attribute for a ProcessingInstruction
\r
887 // node is the target.
\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
893 // Semantic Requirements: 13, 15
\r
895 //----------------------------------------------------------------------------
\r
898 public void core0019NO()
\r
900 string computedValue = "0";
\r
901 string expectedValue = "xml";
\r
902 System.Xml.XmlNode testNode = null;
\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
908 // Get the targeted data.
\r
910 testNode = util.getDOMDocument().ChildNodes.Item(0);
\r
912 // The nodeName attribute should be set to "xml".
\r
914 computedValue = testNode.Name;
\r
916 // write out results.
\r
918 results.expected = expectedValue;
\r
919 results.actual = computedValue;
\r
921 Assert.AreEqual (results.expected, results.actual);
\r
924 //------------------------ End test case core-0019NO --------------------------
\r
926 //------------------------- test case core-0020NO -----------------------------
\r
928 // Testing feature - The "nodeName" attribute for a comment node is
\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
935 // Semantic Requirements: 13, 15
\r
937 //----------------------------------------------------------------------------
\r
940 public void core0020NO()
\r
942 string computedValue = "0";
\r
943 string expectedValue = "#comment";
\r
944 System.Xml.XmlNode testNode = null;
\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
950 // Get the targeted data.
\r
952 testNode = util.getDOMDocument().ChildNodes.Item(2);
\r
954 // The nodeName attribute should be set to "#comment".
\r
956 computedValue = testNode.Name;
\r
958 // write out results.
\r
960 results.expected = expectedValue;
\r
961 results.actual = computedValue;
\r
963 Assert.AreEqual (results.expected, results.actual);
\r
966 //------------------------ End test case core-0020NO --------------------------
\r
968 //------------------------- test case core-0021NO -----------------------------
\r
970 // Testing feature - The "nodeName" attribute for a Document node is
\r
973 // Testing approach - Retrieve the DOM Document and examine its
\r
974 // "nodeName" attribute. It should be set to "#document".
\r
976 // Semantic Requirements: 13, 15
\r
978 //----------------------------------------------------------------------------
\r
981 public void core0021NO()
\r
983 string computedValue = "";
\r
984 string expectedValue = "#document";
\r
985 System.Xml.XmlNode testNodeNode = null;
\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
991 // Get the targeted data.
\r
993 System.Xml.XmlNode testNode = util.getDOMDocument();
\r
995 // The nodeName attribute should be set to "#document".
\r
997 computedValue = testNode.Name;
\r
999 // write out results.
\r
1001 results.expected = expectedValue;
\r
1002 results.actual = computedValue;
\r
1004 Assert.AreEqual (results.expected, results.actual);
\r
1007 //------------------------ End test case core-0021NO --------------------------
\r
1009 //------------------------- test case core-0022NO -----------------------------
\r
1011 // Testing feature - The "nodeName" attribute for a DocumentType node is
\r
1012 // the document type name.
\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
1018 // Semantic Requirements: 13, 15
\r
1020 //----------------------------------------------------------------------------
\r
1023 public void core0022NO()
\r
1025 string computedValue = "";
\r
1026 string expectedValue = "staff";
\r
1027 System.Xml.XmlNode testNode = null;
\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
1033 // Get the targeted data.
\r
1035 testNode = util.getDocType();
\r
1037 // The nodeName attribute should be set to "staff".
\r
1039 computedValue = testNode.Name;
\r
1041 // write out results.
\r
1043 results.expected = expectedValue;
\r
1044 results.actual = computedValue;
\r
1046 Assert.AreEqual (results.expected, results.actual);
\r
1049 //------------------------ End test case core-0022NO ------------------------
\r
1051 //------------------------- test case core-0023NO -----------------------------
\r
1053 // Testing feature - The "nodeName" attribute for a DocumentFragment node
\r
1054 // is "#document-fragment".
\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
1061 // Semantic Requirements: 13, 15
\r
1063 //----------------------------------------------------------------------------
\r
1066 public void core0023NO()
\r
1068 string computedValue = "";
\r
1069 string expectedValue = "#document-fragment";
\r
1070 System.Xml.XmlNode testNode = null;
\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
1076 // Get the targeted data.
\r
1078 testNode = util.getDOMDocument().CreateDocumentFragment();
\r
1080 // The nodeName attribute should be set to "#document-fragment".
\r
1082 computedValue = testNode.Name;
\r
1084 // write out results.
\r
1086 results.expected = expectedValue;
\r
1087 results.actual = computedValue;
\r
1089 Assert.AreEqual (results.expected, results.actual);
\r
1092 //------------------------ End test case core-0023NO --------------------------
\r
1094 //------------------------- test case core-0024NO -----------------------------
\r
1096 // Testing feature - The "nodeName" attribute for a notation node is
\r
1097 // the name of the notation.
\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
1103 // Semantic Requirements: 13, 15
\r
1105 //----------------------------------------------------------------------------
\r
1108 public void core0024NO()
\r
1110 string computedValue = "";
\r
1111 string expectedValue = "notation1";
\r
1112 System.Xml.XmlNode testNode = null;
\r
1114 testResults results = new testResults("Core0024NO");
\r
1117 results.description = "The nodeName attribute for a Notation Node " +
\r
1118 "should be set to the notation name.";
\r
1120 // Get the targeted data.
\r
1122 testNode = util.getNotation("notation1");
\r
1124 // The nodeName attribute should be set to "notation1".
\r
1126 computedValue = testNode.Name;
\r
1128 catch(System.Exception ex)
\r
1130 computedValue = "Exception " + ex.Message;
\r
1133 // write out results.
\r
1135 results.expected = expectedValue;
\r
1136 results.actual = computedValue;
\r
1138 Assert.AreEqual (results.expected, results.actual);
\r
1141 //------------------------ End test case core-0024NO --------------------------
\r
1143 //------------------------ test case core-0025NO ----------------------------
\r
1145 // Testing feature - The "nodeValue" attribute for an Element node is
\r
1148 // Testing approach - Retrieve the root node of the DOM object and check
\r
1149 // its "nodeValue" attribute. It should be equal
\r
1152 // Semantic Requirements: 13, 16
\r
1154 //----------------------------------------------------------------------------
\r
1157 public void core0025NO()
\r
1159 object computedValue = null;
\r
1160 object expectedValue = null;
\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
1166 // The nodeValue attribute should be set to null.
\r
1168 computedValue = util.getRootNode().Value;
\r
1170 // write out results.
\r
1172 results.expected = (expectedValue == null).ToString();
\r
1173 results.actual = (computedValue == null).ToString();
\r
1175 Assert.AreEqual (results.expected, results.actual);
\r
1178 //------------------------ End test case core-0025NO --------------------------
\r
1180 //------------------------- test case core-0026NO -----------------------------
\r
1182 // Testing feature - The "nodeValue" attribute for an Attribute node is
\r
1183 // the value of the attribute.
\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
1189 // Semantic Requirements: 13, 16
\r
1191 //----------------------------------------------------------------------------
\r
1194 public void core0026NO()
\r
1196 string computedValue = "";
\r
1197 string expectedValue = "Yes";
\r
1198 System.Xml.XmlElement testNode = null;
\r
1199 System.Xml.XmlAttribute attrNode = null;
\r
1201 testResults results = new testResults("Core0026NO");
\r
1204 results.description = "The nodeValue attribute for an Attribute Node " +
\r
1205 "should be set to the value of the attribute.";
\r
1207 // Get the targeted data.
\r
1209 testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
\r
1210 attrNode = testNode.GetAttributeNode("domestic");//.node.
\r
1212 // The nodeType attribute should be set to "Yes".
\r
1214 computedValue = attrNode.Value;
\r
1216 catch(System.Exception ex)
\r
1218 computedValue = "Exception " + ex.Message;
\r
1221 // write out results.
\r
1223 results.expected = expectedValue;
\r
1224 results.actual = computedValue;
\r
1226 Assert.AreEqual (results.expected, results.actual);
\r
1229 //------------------------ End test case core-0026NO --------------------------
\r
1231 //------------------------- test case core-0027NO -----------------------------
\r
1233 // Testing feature - The "nodeValue" attribute for a Text node is
\r
1234 // content of the Text node.
\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
1241 // Semantic Requirements: 13, 16
\r
1243 //----------------------------------------------------------------------------
\r
1246 public void core0027NO()
\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
1253 testResults results = new testResults("Core0027NO");
\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
1259 // Get the targeted data.
\r
1261 testNode = util.nodeObject(util.FIRST,util.SIXTH);
\r
1262 textNode = testNode.FirstChild;//.node.
\r
1264 // Retrieve the nodeValue attribute.
\r
1266 computedValue = textNode.Value;
\r
1268 catch(System.Exception ex)
\r
1270 computedValue = "Exception " + ex.Message;
\r
1273 // write out results.
\r
1275 results.expected = expectedValue;
\r
1276 results.actual = computedValue;
\r
1278 Assert.AreEqual (results.expected, results.actual);
\r
1281 //------------------------ End test case core-0027NO --------------------------
\r
1283 //------------------------- test case core-0028NO -----------------------------
\r
1285 // Testing feature - The "nodeValue" attribute for a CDATASection node is
\r
1286 // the content of the CDATASection.
\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
1293 // Semantic Requirements: 13, 16
\r
1295 //----------------------------------------------------------------------------
\r
1298 public void core0028NO()
\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
1305 testResults results = new testResults("Core0028NO");
\r
1308 results.description = "The nodeValue attribute for a CDATASection Node "+
\r
1309 "should be set to the contents of the CDATASection.";
\r
1311 // Retrieve the targeted data.
\r
1313 testNode = util.nodeObject(util.SECOND,util.SECOND);
\r
1314 cDataNode = testNode.ChildNodes.Item(1);//.node.
\r
1316 // Get the "nodeValue" attribute.
\r
1318 computedValue = cDataNode.Value;
\r
1320 catch(System.Exception ex)
\r
1322 computedValue = "Exception " + ex.Message;
\r
1325 // write out results.
\r
1327 results.expected = expectedValue;
\r
1328 results.actual = computedValue;
\r
1330 Assert.AreEqual (results.expected, results.actual);
\r
1333 //------------------------ End test case core-0028NO --------------------------
\r
1335 //------------------------- test case core-0029NO -----------------------------
\r
1337 // Testing feature - The "nodeValue" attribute for an EntityReference node
\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
1344 // Semantic Requirements: 13, 16
\r
1346 //----------------------------------------------------------------------------
\r
1349 public void core0029NO()
\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
1356 testResults results = new testResults("Core0029NO");
\r
1359 results.description = "The nodeValue attribute for an EntityReference "+
\r
1360 "node should be set to null.";
\r
1362 // Get the targeted data.
\r
1364 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
1365 entRefNode = testNode.FirstChild;//.node.
\r
1367 // The nodeValue attribute should be set to null.
\r
1369 computedValue = entRefNode.Value;
\r
1371 catch(System.Exception ex)
\r
1373 computedValue = "Exception " + ex.Message;
\r
1376 // write out results.
\r
1378 results.expected = (expectedValue == null).ToString();
\r
1379 results.actual = (computedValue == null).ToString();
\r
1381 Assert.AreEqual (results.expected, results.actual);
\r
1384 //------------------------ End test case core-0029NO --------------------------
\r
1386 //------------------------- test case core-0030NO -----------------------------
\r
1388 // Testing feature - The "nodeValue" attribute for an Entity node
\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
1396 // Semantic Requirements: 13, 16
\r
1398 //----------------------------------------------------------------------------
\r
1401 public void core0030NO()
\r
1403 object computedValue = null;
\r
1404 object expectedValue = null;
\r
1405 System.Xml.XmlNode testNode = null;
\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
1411 // Get the targeted data.
\r
1413 testNode = util.getEntity("ent1");;
\r
1415 // The nodeValue attribute should be set to null.
\r
1417 computedValue = testNode.Value;
\r
1419 // write out results.
\r
1421 results.expected = (expectedValue == null).ToString();
\r
1422 results.actual = (computedValue == null).ToString();
\r
1424 Assert.AreEqual (results.expected, results.actual);
\r
1427 //------------------------ End test case core-0030NO --------------------------
\r
1429 //------------------------- test case core-0031NO -----------------------------
\r
1431 // Testing feature - The "nodeValue" attribute for a ProcessingInstruction
\r
1432 // node is the entire content excluding the target.
\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
1438 // Semantic Requirements: 13, 16
\r
1440 //----------------------------------------------------------------------------
\r
1443 public void core0031NO()
\r
1445 string computedValue = "";
\r
1446 string expectedValue = "version=\"1.0\"";
\r
1447 System.Xml.XmlNode testNode = null;
\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
1453 // Get the targeted data.
\r
1455 testNode = util.getDOMDocument().ChildNodes.Item(0);
\r
1457 // The nodeValue attribute should be set to "version="1.0"".
\r
1459 computedValue = testNode.Value;
\r
1461 // write out results.
\r
1463 results.expected = expectedValue;
\r
1464 results.actual = computedValue;
\r
1466 Assert.AreEqual (results.expected, results.actual);
\r
1469 //------------------------ End test case core-0031NO --------------------------
\r
1471 //------------------------- test case core-0032NO -----------------------------
\r
1473 // Testing feature - The "nodeValue" attribute for a comment node is
\r
1474 // the content of the comment.
\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
1480 // Semantic Requirements: 13, 16
\r
1482 //----------------------------------------------------------------------------
\r
1485 public void core0032NO()
\r
1487 string computedValue = "";
\r
1488 string expectedValue = " This is comment number 1.";
\r
1489 System.Xml.XmlNode testNode = null;
\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
1495 // Get the targeted data.
\r
1497 testNode = util.getDOMDocument().ChildNodes.Item(2);
\r
1499 // The nodeValue attribute should be set to " This is comment number 1."
\r
1501 computedValue = testNode.Value;
\r
1503 // write out results.
\r
1505 results.expected = expectedValue;
\r
1506 results.actual = computedValue;
\r
1508 Assert.AreEqual (results.expected, results.actual);
\r
1511 //------------------------ End test case core-0032NO --------------------------
\r
1513 //------------------------- test case core-0033NO -----------------------------
\r
1515 // Testing feature - The "nodeValue" attribute for a Document node is
\r
1518 // Testing approach - Retrieve the DOM Document and examine its
\r
1519 // "nodeValue" attribute. It should be set to null.
\r
1521 // Semantic Requirements: 13, 16
\r
1523 //----------------------------------------------------------------------------
\r
1526 public void core0033NO()
\r
1528 object computedValue = null;
\r
1529 object expectedValue = null;
\r
1530 System.Xml.XmlNode testNode = null;
\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
1536 // Get the targeted data.
\r
1538 testNode = util.getDOMDocument();
\r
1540 // The nodeValue attribute should be set to null.
\r
1542 computedValue = testNode.Value;
\r
1544 // write out results.
\r
1546 results.expected = (expectedValue == null).ToString();
\r
1547 results.actual = (computedValue == null).ToString();
\r
1549 Assert.AreEqual (results.expected, results.actual);
\r
1552 //------------------------ End test case core-0033NO --------------------------
\r
1554 //------------------------- test case core-0034NO -----------------------------
\r
1556 // Testing feature - The "nodeValue" attribute for a DocumentType node is
\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
1563 // Semantic Requirements: 13, 16
\r
1565 //----------------------------------------------------------------------------
\r
1568 public void core0034NO()
\r
1570 object computedValue = null;
\r
1571 object expectedValue = null;
\r
1572 System.Xml.XmlNode testNode = null;
\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
1578 // Get the targeted data.
\r
1580 testNode = util.getDOMDocument().ChildNodes.Item(1);
\r
1582 // The nodeValue attribute should be set to null.
\r
1584 computedValue = testNode.Value;
\r
1586 // write out results.
\r
1588 results.expected = (expectedValue == null).ToString();
\r
1589 results.actual = (computedValue == null).ToString();
\r
1591 Assert.AreEqual (results.expected, results.actual);
\r
1594 //------------------------ End test case core-0034NO ------------------------
\r
1596 //------------------------- test case core-0035NO -----------------------------
\r
1598 // Testing feature - The "nodeValue" attribute for a DocumentFragment node
\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
1606 // Semantic Requirements: 13, 16
\r
1608 //----------------------------------------------------------------------------
\r
1611 public void core0035NO()
\r
1613 object computedValue = null;
\r
1614 object expectedValue = null;
\r
1615 System.Xml.XmlNode testNode = null;
\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
1621 // Get the targeted data.
\r
1623 testNode = util.getDOMDocument().CreateDocumentFragment();
\r
1625 // The nodeValue attribute should be set to null.
\r
1627 computedValue = testNode.Value;
\r
1629 // write out results.
\r
1631 results.expected = (expectedValue == null).ToString();
\r
1632 results.actual = (computedValue == null).ToString();
\r
1634 Assert.AreEqual (results.expected, results.actual);
\r
1637 //------------------------ End test case core-0035NO --------------------------
\r
1639 //------------------------- test case core-0036NO -----------------------------
\r
1641 // Testing feature - The "nodeValue" attribute for a notation node is
\r
1642 // the name of the notation.
\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
1648 // Semantic Requirements: 13, 16
\r
1650 //----------------------------------------------------------------------------
\r
1653 public void core0036NO()
\r
1655 object computedValue = null;
\r
1656 object expectedValue = null;
\r
1657 System.Xml.XmlNode testNode = null;
\r
1659 testResults results = new testResults("Core0036NO");
\r
1662 results.description = "The nodeValue attribute for a Notation node " +
\r
1663 "should be set to null.";
\r
1665 // Get the targeted data.
\r
1667 testNode = util.getNotation("notation1");
\r
1669 // The nodeValue attribute should be set to null.
\r
1671 computedValue = testNode.Value;
\r
1673 catch(System.Exception ex)
\r
1675 computedValue = "Exception " + ex.Message;
\r
1678 // write out results.
\r
1680 results.expected = (expectedValue == null).ToString();
\r
1681 results.actual = (computedValue == null).ToString();
\r
1683 Assert.AreEqual (results.expected, results.actual);
\r
1686 //------------------------ End test case core-0036NO --------------------------
\r
1688 //------------------------ test case core-0037NO ----------------------------
\r
1690 // Testing feature - The "attributes" attribute for an Element node is
\r
1691 // a NamedNodeMap.
\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
1697 // Semantic Requirements: 13, 17
\r
1699 //----------------------------------------------------------------------------
\r
1702 public void core0037NO()
\r
1704 string computedValue = "";
\r
1705 string expectedValue = "";
\r
1706 System.Xml.XmlNode testNode = null;
\r
1707 string testName = "core-0037NO";
\r
1709 testResults results = new testResults("core0037NO");
\r
1712 results.description += "The \"attributes\" attribute for an Element node";
\r
1713 results.description += " should be set to a NamedNodeMap. ";
\r
1716 // Retrieve the targeted data and its attributes.
\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
1722 // Determine the order of the NamedNodeMap items.
\r
1724 if (computedValue.Substring(0,1) == "d" && computedValue.Substring(1,1) == "o")
\r
1725 expectedValue = "domestic street";
\r
1727 expectedValue = "street domestic";
\r
1729 catch(System.Exception ex)
\r
1731 computedValue = "Exception " + ex.Message;
\r
1734 // write out results.
\r
1736 results.expected = expectedValue;
\r
1737 results.actual = computedValue;
\r
1739 Assert.AreEqual (results.expected, results.actual);
\r
1742 //------------------------ End test case core-0037NO --------------------------
\r
1744 //------------------------- test case core-0038NO -----------------------------
\r
1746 // Testing feature - The "attributes" attribute for an Attribute node is
\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
1753 // Semantic Requirements: 13, 17
\r
1755 //----------------------------------------------------------------------------
\r
1758 public void core0038NO()
\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
1765 testResults results = new testResults("Core0038NO");
\r
1768 results.description = "The \"attributes\" attribute for an Attribute node " +
\r
1769 "should be set to null.";
\r
1771 // Retrieve the targeted data.
\r
1773 testNode = util.nodeObject(util.FIRST,util.SIXTH);
\r
1774 attrNode = (System.Xml.XmlAttribute)testNode.Attributes.Item(util.FIRST);
\r
1776 // The "attributes" attribute should be set to null.
\r
1778 computedValue = attrNode.Attributes;
\r
1780 catch(System.Exception ex)
\r
1782 computedValue = "Exception " + ex.Message;
\r
1785 // write out results.
\r
1787 results.expected = (expectedValue == null).ToString();
\r
1788 results.actual = (computedValue == null).ToString();
\r
1790 Assert.AreEqual (results.expected, results.actual);
\r
1793 //------------------------ End test case core-0038NO --------------------------
\r
1795 //------------------------- test case core-0039NO -----------------------------
\r
1797 // Testing feature - The "attributes" attribute for a Text node is
\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
1804 // Semantic Requirements: 13, 17
\r
1806 //----------------------------------------------------------------------------
\r
1809 public void core0039NO()
\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
1816 testResults results = new testResults("Core0039NO");
\r
1819 results.description = "The \"attributes\" attribute for a Text node "+
\r
1820 "should be set to null.";
\r
1822 // Retrieve the targeted data.
\r
1824 testNode = util.nodeObject(util.FIRST,util.SIXTH);
\r
1825 textNode = testNode.FirstChild;//.node.
\r
1827 // The "attributes" attribute should be set to null
\r
1829 computedValue = textNode.Attributes;
\r
1831 catch(System.Exception ex)
\r
1833 computedValue = "Exception " + ex.Message;
\r
1836 // write out results.
\r
1838 results.expected = (expectedValue == null).ToString();
\r
1839 results.actual = (computedValue == null).ToString();
\r
1841 Assert.AreEqual (results.expected, results.actual);
\r
1844 //------------------------ End test case core-0039NO --------------------------
\r
1846 //------------------------- test case core-0040NO -----------------------------
\r
1848 // Testing feature - The "attributes" attribute for a CDATASection node is
\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
1856 // Semantic Requirements: 13, 17
\r
1858 //----------------------------------------------------------------------------
\r
1861 public void core0040NO()
\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
1868 testResults results = new testResults("Core0040NO");
\r
1871 results.description = "The \"attributes\" attribute for a CDATASection "+
\r
1872 "node should be set to null.";
\r
1874 // Retrieve the targeted data.
\r
1876 testNode = util.nodeObject(util.SECOND,util.SECOND);
\r
1877 cDataNode = testNode.LastChild;//.node.
\r
1879 // The "attributes" attribute should be set to null.
\r
1881 computedValue = cDataNode.Attributes;
\r
1883 catch(System.Exception ex)
\r
1885 computedValue = "Exception " + ex.Message;
\r
1888 // write out results.
\r
1890 results.expected = (expectedValue == null).ToString();
\r
1891 results.actual = (computedValue == null).ToString();
\r
1893 Assert.AreEqual (results.expected, results.actual);
\r
1896 //------------------------ End test case core-0040NO --------------------------
\r
1898 //------------------------- test case core-0041NO -----------------------------
\r
1900 // Testing feature - The "attributes" attribute for an EntityReference node
\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
1907 // Semantic Requirements: 13, 17
\r
1909 //----------------------------------------------------------------------------
\r
1912 public void core0041NO()
\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
1919 testResults results = new testResults("Core0041NO");
\r
1922 results.description = "The \"attributes\" attribute for an "+
\r
1923 "EntityReference node should be set to null.";
\r
1925 // Retrieve the targeted data.
\r
1927 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
1928 entRefNode = testNode.FirstChild;//.node.
\r
1930 // The \"attributes\" attribute should be set to null.
\r
1932 computedValue = entRefNode.Attributes;
\r
1934 catch(System.Exception ex)
\r
1936 computedValue = "Exception " + ex.Message;
\r
1939 // write out results.
\r
1941 results.expected = (expectedValue == null).ToString();
\r
1942 results.actual = (computedValue == null).ToString();
\r
1944 Assert.AreEqual (results.expected, results.actual);
\r
1946 //------------------------ End test case core-0041NO --------------------------
\r
1948 //------------------------- test case core-0042NO -----------------------------
\r
1950 // Testing feature - The "attributes" attribute for an Entity node
\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
1958 // Semantic Requirements: 13, 17
\r
1960 //----------------------------------------------------------------------------
\r
1963 public void core0042NO()
\r
1965 object computedValue = null;
\r
1966 object expectedValue = null;
\r
1967 System.Xml.XmlNode testNode = null;
\r
1969 testResults results = new testResults("Core0042NO");
\r
1971 results.description = "The \"attributes\" attribute for an Entity node "+
\r
1972 "should be set to null.";
\r
1974 // Get the targeted data.
\r
1976 testNode = util.getEntity("ent1");
\r
1978 // The "attributes" attribute should be set to null.
\r
1980 computedValue = testNode.Attributes;
\r
1982 // write out results.
\r
1984 results.expected = (expectedValue == null).ToString();
\r
1985 results.actual = (computedValue == null).ToString();
\r
1987 Assert.AreEqual (results.expected, results.actual);
\r
1990 //------------------------ End test case core-0042NO --------------------------
\r
1992 //------------------------- test case core-0043NO -----------------------------
\r
1994 // Testing feature - The "attributes" attribute for a ProcessingInstruction
\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
2001 // Semantic Requirements: 13, 17
\r
2003 //----------------------------------------------------------------------------
\r
2006 public void core0043NO()
\r
2008 object computedValue = null;
\r
2009 object expectedValue = null;
\r
2010 System.Xml.XmlNode testNode = null;
\r
2012 testResults results = new testResults("Core0043NO");
\r
2014 results.description = "The \"attributes\" attribute for a "+
\r
2015 "ProcessingInstruction node is null.";
\r
2017 // Get the targeted data.
\r
2019 testNode = util.getDOMDocument().ChildNodes.Item(0);
\r
2021 // The "attributes" attribute should be set to null.
\r
2023 computedValue = testNode.Attributes;
\r
2025 // write out results.
\r
2027 results.expected = (expectedValue == null).ToString();
\r
2028 results.actual = (computedValue == null).ToString();
\r
2030 Assert.AreEqual (results.expected, results.actual);
\r
2033 //------------------------ End test case core-0043NO --------------------------
\r
2035 //------------------------- test case core-0044NO -----------------------------
\r
2037 // Testing feature - The "attributes" attribute for a comment node is
\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
2044 // Semantic Requirements: 13, 17
\r
2046 //----------------------------------------------------------------------------
\r
2049 public void core0044NO()
\r
2051 object computedValue = null;
\r
2052 object expectedValue = null;
\r
2053 System.Xml.XmlNode testNode = null;
\r
2055 testResults results = new testResults("Core0044NO");
\r
2057 results.description = "The \"attributes\" attribute for a comment node "+
\r
2058 "should be set to null.";
\r
2060 // Get the targeted data.
\r
2062 testNode = util.getDOMDocument().ChildNodes.Item(2);
\r
2064 // The "attributes" attribute should be set to null.
\r
2066 computedValue = testNode.Attributes;
\r
2068 // write out results.
\r
2070 results.expected = (expectedValue == null).ToString();
\r
2071 results.actual = (computedValue == null).ToString();
\r
2073 Assert.AreEqual (results.expected, results.actual);
\r
2076 //------------------------ End test case core-0044NO --------------------------
\r
2078 //------------------------- test case core-0045NO -----------------------------
\r
2080 // Testing feature - The "attributes" attribute for a Document node is
\r
2083 // Testing approach - Retrieve the DOM Document and examine its
\r
2084 // "attributes" attribute. It should be set to null.
\r
2086 // Semantic Requirements: 13, 17
\r
2088 //----------------------------------------------------------------------------
\r
2091 public void core0045NO()
\r
2093 object computedValue = null;
\r
2094 object expectedValue = null;
\r
2095 System.Xml.XmlNode testNode = null;
\r
2097 testResults results = new testResults("Core0045NO");
\r
2099 results.description = "The \"attributes\" attribute for a Document node "+
\r
2100 "should be set to null.";
\r
2102 // Get the targeted data.
\r
2104 testNode = util.getDOMDocument();
\r
2106 // The "attributes" attribute should be set to null.
\r
2108 computedValue = testNode.Attributes;
\r
2110 // write out results.
\r
2112 results.expected = (expectedValue == null).ToString();
\r
2113 results.actual = (computedValue == null).ToString();
\r
2115 Assert.AreEqual (results.expected, results.actual);
\r
2118 //------------------------ End test case core-0045NO --------------------------
\r
2120 //------------------------- test case core-0046NO -----------------------------
\r
2122 // Testing feature - The "attributes" attribute for a DocumentType node is
\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
2129 // Semantic Requirements: 13, 17
\r
2131 //----------------------------------------------------------------------------
\r
2134 public void core0046NO()
\r
2136 object computedValue = null;
\r
2137 object expectedValue = null;
\r
2138 System.Xml.XmlNode testNode = null;
\r
2140 testResults results = new testResults("Core0046NO");
\r
2142 results.description = "The \"attribute\" attribute for a DocumentType "+
\r
2143 "node should be set to null.";
\r
2145 // Get the targeted data.
\r
2147 testNode = util.getDocType();
\r
2149 // The "attributes" attribute should be set to null.
\r
2151 computedValue = testNode.Attributes;
\r
2153 // write out results.
\r
2155 results.expected = (expectedValue == null).ToString();
\r
2156 results.actual = (computedValue == null).ToString();
\r
2158 Assert.AreEqual (results.expected, results.actual);
\r
2161 //------------------------ End test case core-0046NO ------------------------
\r
2163 //------------------------- test case core-0047NO ---------------------------
\r
2165 // Testing feature - The "attributes" attribute for a DocumentFragment node
\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
2173 // Semantic Requirements: 13, 17
\r
2175 //----------------------------------------------------------------------------
\r
2178 public void core0047NO()
\r
2180 object computedValue = null;
\r
2181 object expectedValue = null;
\r
2182 System.Xml.XmlNode testNode = null;
\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
2188 // Get the targeted data.
\r
2190 testNode = util.getDOMDocument().CreateDocumentFragment();
\r
2192 // The "attributes" attribute should be set to null.
\r
2194 computedValue = testNode.Attributes;
\r
2196 // write out results.
\r
2198 results.expected = (expectedValue == null).ToString();
\r
2199 results.actual = (computedValue == null).ToString();
\r
2201 Assert.AreEqual (results.expected, results.actual);
\r
2204 //------------------------ End test case core-0047NO --------------------------
\r
2206 //------------------------- test case core-0048NO -----------------------------
\r
2208 // Testing feature - The "attributes" attribute for a notation node is
\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
2215 // Semantic Requirements: 13, 17
\r
2217 //----------------------------------------------------------------------------
\r
2220 public void core0048NO()
\r
2222 object computedValue = null;
\r
2223 object expectedValue = null;
\r
2224 System.Xml.XmlNode testNode = null;
\r
2226 testResults results = new testResults("Core0048NO");
\r
2229 results.description = "The \"attributes\" attribute for a Notation node "+
\r
2230 "should be set to null.";
\r
2232 // Get the targeted data.
\r
2234 testNode = util.getNotation("notation1");
\r
2236 // The "attributes" attribute should be set to null.
\r
2238 computedValue = testNode.Attributes;
\r
2240 catch(System.Exception ex)
\r
2242 computedValue = "Exception " + ex.Message;
\r
2245 // write out results.
\r
2247 results.expected = (expectedValue == null).ToString();
\r
2248 results.actual = (computedValue == null).ToString();
\r
2250 Assert.AreEqual (results.expected, results.actual);
\r
2253 //------------------------ End test case core-0048NO --------------------------
\r
2255 //------------------------- test case core-0049NO -----------------------------
\r
2257 // Testing feature - The "parentNode" attribute contains the parent of
\r
2260 // Testing approach - Retrieve the second employee and examine its
\r
2261 // "parentNode" attribute. It should be set
\r
2264 // Semantic Requirements: 18
\r
2266 //----------------------------------------------------------------------------
\r
2269 public void core0049NO()
\r
2271 string computedValue = "";
\r
2272 string expectedValue = "staff";
\r
2273 System.Xml.XmlNode testNode = null;
\r
2274 System.Xml.XmlNode testNodeParent = null;
\r
2276 testResults results = new testResults("Core0049NO");
\r
2279 results.description = "The parentNode attribute contains the parent "+
\r
2280 "node of this node.";
\r
2282 // Retrieve the targeted data and access its parent node.
\r
2284 testNode = util.nodeObject(util.SECOND,-1);
\r
2285 testNodeParent = testNode.ParentNode; //.node.
\r
2287 // The nodeName attribute should be "staff".
\r
2289 computedValue = testNodeParent.Name;
\r
2291 catch(System.Exception ex)
\r
2293 computedValue = "Exception " + ex.Message;
\r
2296 // Write out results
\r
2298 results.expected = expectedValue;
\r
2299 results.actual = computedValue;
\r
2301 Assert.AreEqual (results.expected, results.actual);
\r
2304 //------------------------ End test case core-0049NO --------------------------
\r
2306 //------------------------- test case core-0050NO -----------------------------
\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
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
2317 // Semantic Requirements: 19
\r
2319 //----------------------------------------------------------------------------
\r
2322 public void core0050NO()
\r
2324 object computedValue = null;
\r
2325 object expectedValue = null;
\r
2326 System.Xml.XmlNode testNode = null;
\r
2328 testResults results = new testResults("Core0050NO");
\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
2334 // Create new node and access its parentNode attribute.
\r
2336 testNode = util.createNode(util.ELEMENT_NODE,"employee");
\r
2337 computedValue = testNode.ParentNode;
\r
2339 // Write out results.
\r
2341 results.expected = (expectedValue == null).ToString();
\r
2342 results.actual = (computedValue == null).ToString();
\r
2345 Assert.AreEqual (results.expected, results.actual);
\r
2348 //------------------------ End test case core-0050NO --------------------------
\r
2350 //------------------------- test case core-0051NO -----------------------------
\r
2352 // Testing feature - The "parentNode" attribute of a node that has been
\r
2353 // been removed from the tree is null.
\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
2359 // Semantic Requirements: 20
\r
2361 //----------------------------------------------------------------------------
\r
2364 public void core0051NO()
\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
2371 testResults results = new testResults("Core0051NO");
\r
2373 results.description = "The parentNode attribute of a node that has "+
\r
2374 "been removed from the tree is null.";
\r
2376 // Remove the targeted data and access its parentNode attribute.
\r
2378 testNode = util.nodeObject(util.FIRST,-1);
\r
2379 removedNode = util.getRootNode().RemoveChild(testNode);//.node
\r
2380 computedValue = removedNode.ParentNode;
\r
2382 // Write out results.
\r
2384 results.expected = (expectedValue == null).ToString();
\r
2385 results.actual = (computedValue == null).ToString();
\r
2388 Assert.AreEqual (results.expected, results.actual);
\r
2391 //------------------------ End test case core-0051NO --------------------------
\r
2393 //------------------------- test case core-0052NO -----------------------------
\r
2395 // Testing feature - The "childNodes" attribute of a node contains a
\r
2396 // NodeList of all the children of this node.
\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
2403 // Semantic Requirements: 21
\r
2405 //----------------------------------------------------------------------------
\r
2408 public void core0052NO()
\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
2415 testResults results = new testResults("Core0052NO");
\r
2417 results.description = "The childNodes attribute of a node contains a "+
\r
2418 "NodeList of all the children of this node.";
\r
2420 // Retrieve targeted data and examine the list length.
\r
2422 testNode = util.nodeObject(util.SECOND,-1);
\r
2423 nodeList = testNode.ChildNodes;//.node.
\r
2424 computedValue = nodeList.Count;
\r
2426 // Write out results.
\r
2428 results.expected = expectedValue.ToString();
\r
2429 results.actual = computedValue.ToString();
\r
2431 Assert.AreEqual (results.expected, results.actual);
\r
2434 //------------------------ End test case core-0052NO --------------------------
\r
2436 //------------------------- test case core-0053NO -----------------------------
\r
2438 // Testing feature - If a node has no children then the NodeList returned
\r
2439 // by its childNodes attribute has no nodes.
\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
2446 // Semantic Requirements: 22
\r
2448 //----------------------------------------------------------------------------
\r
2451 public void core0053NO()
\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
2459 testResults results = new testResults("Core0053NO");
\r
2462 results.description = "If a node has no child nodes then the NodeList "+
\r
2463 "returned by its childNodes attribute has no "+
\r
2466 // Retrieve the targeted data and access its childNodes attribute.
\r
2468 testNode = util.nodeObject(util.SECOND,util.FIRST);
\r
2469 noChildNode = testNode.FirstChild.ChildNodes;//.node.
\r
2470 computedValue = noChildNode.Count.ToString();
\r
2472 catch(System.Exception ex)
\r
2474 computedValue = "Exception " + ex.Message;
\r
2477 // Write out results.
\r
2479 results.expected = expectedValue;
\r
2480 results.actual = computedValue;
\r
2482 Assert.AreEqual (results.expected, results.actual);
\r
2485 //------------------------ End test case core-0053NO --------------------------
\r
2487 //------------------------- test case core-0054NO -----------------------------
\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
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
2501 // Semantic Requirements: 23
\r
2503 //----------------------------------------------------------------------------
\r
2506 public void core0054NO()
\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
2513 testResults results = new testResults("Core0054NO");
\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
2519 // Retrieve the targeted data and append a new Element node to it.
\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
2526 // Write out results.
\r
2528 results.expected = expectedValue.ToString();
\r
2529 results.actual = computedValue.ToString();
\r
2532 Assert.AreEqual (results.expected, results.actual);
\r
2535 //------------------------ End test case core-0054NO --------------------------
\r
2537 //------------------------- test case core-0055NO -----------------------------
\r
2539 // Testing feature - The firstChild attribute contains the first child of this
\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
2546 // Semantic Requirements: 24
\r
2548 //----------------------------------------------------------------------------
\r
2551 public void core0055NO()
\r
2553 string computedValue = "";
\r
2554 string expectedValue = "employeeId";
\r
2555 System.Xml.XmlNode testNode = null;
\r
2556 System.Xml.XmlNode firstChildNode = null;
\r
2558 testResults results = new testResults("Core0055NO");
\r
2560 results.description = "The firstChild attribute contains the first "+
\r
2561 "child of this node.";
\r
2563 // Retrieve the targeted data.
\r
2565 testNode = util.nodeObject(util.SECOND,-1);
\r
2566 firstChildNode = testNode.FirstChild;//.node.
\r
2568 // Its firstChild attribute's tagName should be "employeeId".
\r
2570 computedValue = firstChildNode.Name;
\r
2572 // Write out results.
\r
2574 results.expected = expectedValue;
\r
2575 results.actual = computedValue;
\r
2577 Assert.AreEqual (results.expected, results.actual);
\r
2580 //------------------------ End test case core-0055NO --------------------------
\r
2582 //------------------------- test case core-0056NO -----------------------------
\r
2584 // Testing feature - If there is no first child then the firstChild attribute
\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
2591 // Semantic Requirements: 25
\r
2593 //----------------------------------------------------------------------------
\r
2596 public void core0056NO()
\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
2603 testResults results = new testResults("Core0056NO");
\r
2606 results.description = "If a node does not have a first child then its "+
\r
2607 "firstChild attribute returns null.";
\r
2609 // Get the targeted data.
\r
2611 testNode = util.nodeObject(util.FIRST,util.FIRST);
\r
2612 noChildNode = testNode.FirstChild;//.node.
\r
2614 // Its firstChild attribute should be equal to null.
\r
2616 computedValue = noChildNode.FirstChild;
\r
2618 catch(System.Exception ex)
\r
2620 computedValue = "Exception " + ex.Message;
\r
2624 // Write out results.
\r
2626 results.expected = (expectedValue == null).ToString();
\r
2627 results.actual = (computedValue == null).ToString();
\r
2629 Assert.AreEqual (results.expected, results.actual);
\r
2632 //------------------------ End test case core-0056NO --------------------------
\r
2634 //------------------------- test case core-0057NO -----------------------------
\r
2636 // Testing feature - The lastChild attribute contains the last child of this
\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
2643 // Semantic Requirements: 26
\r
2645 //----------------------------------------------------------------------------
\r
2648 public void core0057NO()
\r
2650 string computedValue = "";
\r
2651 string expectedValue = "address";
\r
2652 System.Xml.XmlNode testNode = null;
\r
2653 System.Xml.XmlNode lastChildNode = null;
\r
2655 testResults results = new testResults("Core0057NO");
\r
2657 results.description = "The lastChild attribute contains the last "+
\r
2658 "child of this node.";
\r
2660 // Retrieve the targeted data and access its lastChild attribute.
\r
2662 testNode = util.nodeObject(util.SECOND,-1);
\r
2664 // Its lastChild attribute should be equal to a node with tag name = "address".
\r
2666 lastChildNode = testNode.LastChild;//.node.
\r
2667 computedValue = lastChildNode.Name;
\r
2669 // Write out results.
\r
2671 results.expected = expectedValue;
\r
2672 results.actual = computedValue;
\r
2674 Assert.AreEqual (results.expected, results.actual);
\r
2677 //------------------------ End test case core-0057NO --------------------------
\r
2679 //------------------------- test case core-0058NO -----------------------------
\r
2681 // Testing feature - If there is no last child then the lastChild attribute
\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
2688 // Semantic Requirements: 27
\r
2690 //----------------------------------------------------------------------------
\r
2693 public void core0058NO()
\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
2700 testResults results = new testResults("Core0058NO");
\r
2703 results.description = "If a node does not have a last child then its "+
\r
2704 "lastChild attribute returns null.";
\r
2706 // Retrieve the targeted data.
\r
2708 testNode = util.nodeObject(util.SECOND,util.FIRST);
\r
2709 noChildNode = testNode.FirstChild;//.node.
\r
2711 // Its lastChild attribute should be equal to null.
\r
2713 computedValue = noChildNode.LastChild;
\r
2715 catch(System.Exception ex)
\r
2717 computedValue = "Exception " + ex.Message;
\r
2720 // Write out results.
\r
2722 results.expected = (expectedValue == null).ToString();
\r
2723 results.actual = (computedValue == null).ToString();
\r
2725 Assert.AreEqual (results.expected, results.actual);
\r
2728 //------------------------ End test case core-0058NO --------------------------
\r
2730 //------------------------- test case core-0059NO -----------------------------
\r
2732 // Testing feature - The previousSibling attribute contains the node
\r
2733 // immediately preceding this node.
\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
2739 // Semantic Requirements: 28
\r
2741 //----------------------------------------------------------------------------
\r
2744 public void core0059NO()
\r
2746 string computedValue = "";
\r
2747 string expectedValue = "employeeId";
\r
2748 System.Xml.XmlNode testNode = null;
\r
2749 System.Xml.XmlNode itsPreviousSibling = null;
\r
2751 testResults results = new testResults("Core0059NO");
\r
2754 results.description = "The previousSibling attribute contains the node "+
\r
2755 "immediately preceding this node.";
\r
2757 // Retrieve the targeted data and accesss its previousiSibling attribute.
\r
2759 testNode = util.nodeObject(util.SECOND,util.SECOND);
\r
2760 itsPreviousSibling = testNode.PreviousSibling;//.node.
\r
2762 // Its previousSibling attribute should have a tag name = "employeeId".
\r
2764 computedValue = itsPreviousSibling.Name;
\r
2766 catch(System.Exception ex)
\r
2768 computedValue = "Exception " + ex.Message;
\r
2772 // Write out results.
\r
2774 results.expected = expectedValue;
\r
2775 results.actual = computedValue;
\r
2777 Assert.AreEqual (results.expected, results.actual);
\r
2780 //------------------------ End test case core-0059NO --------------------------
\r
2782 //------------------------- test case core-0060NO -----------------------------
\r
2784 // Testing feature - If there is no immediately preceding node then the
\r
2785 // previousSibling attribute returns null.
\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
2791 // Semantic Requirements: 29
\r
2793 //----------------------------------------------------------------------------
\r
2796 public void core0060NO()
\r
2798 object computedValue = null;
\r
2799 object expectedValue = null;
\r
2800 System.Xml.XmlNode testNode = null;
\r
2802 testResults results = new testResults("Core0060NO");
\r
2805 results.description = "If there is no node immediately preceding this "+
\r
2806 "node then the previousSibling attribute returns "+
\r
2809 // Retrieve the targeted data.
\r
2811 testNode = util.nodeObject(util.SECOND,util.FIRST);
\r
2813 // Its previousSibling attribute should be equal to null.
\r
2815 computedValue = testNode.PreviousSibling;//.node.
\r
2817 catch(System.Exception ex)
\r
2819 computedValue = "Exception " + ex.Message;
\r
2823 // Write out results.
\r
2825 results.expected = (expectedValue == null).ToString();
\r
2826 results.actual = (computedValue == null).ToString();
\r
2828 Assert.AreEqual (results.expected, results.actual);
\r
2831 //------------------------ End test case core-0060NO --------------------------
\r
2833 //------------------------- test case core-0061NO -----------------------------
\r
2835 // Testing feature - The nextSibling attribute contains the node
\r
2836 // immediately following this node.
\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
2842 // Semantic Requirements: 30
\r
2844 //----------------------------------------------------------------------------
\r
2847 public void core0061NO()
\r
2849 string computedValue = "";
\r
2850 string expectedValue = "name";
\r
2851 System.Xml.XmlNode testNode = null;
\r
2852 System.Xml.XmlNode itsNextSibling = null;
\r
2854 testResults results = new testResults("Core0061NO");
\r
2857 results.description = "The nextSibling attribute contains the node "+
\r
2858 "immediately following this node.";
\r
2860 // Retrieve the targeted data and access its nextSibling attribute.
\r
2862 testNode = util.nodeObject(util.SECOND,util.FIRST);
\r
2863 itsNextSibling = testNode.NextSibling;//.node.
\r
2865 // Its nextSibling attribute should be a node with tag name = "name".
\r
2867 computedValue = itsNextSibling.Name;
\r
2869 catch(System.Exception ex)
\r
2871 computedValue = "Exception " + ex.Message;
\r
2875 // Write out results.
\r
2877 results.expected = expectedValue;
\r
2878 results.actual = computedValue;
\r
2880 Assert.AreEqual (results.expected, results.actual);
\r
2883 //------------------------ End test case core-0061NO --------------------------
\r
2885 //------------------------- test case core-0062NO -----------------------------
\r
2887 // Testing feature - If there is no node immediately following this node
\r
2888 // then the nextSibling attribute returns null.
\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
2894 // Semantic Requirements: 31
\r
2896 //----------------------------------------------------------------------------
\r
2899 public void core0062NO()
\r
2901 object computedValue = null;
\r
2902 object expectedValue = null;
\r
2903 System.Xml.XmlNode testNode = null;
\r
2905 testResults results = new testResults("Core0062NO");
\r
2908 results.description = "If there is no node immediately following this "+
\r
2909 "node then the nextSibling attribute returns null.";
\r
2911 // Retrieve the targeted data.
\r
2913 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
2915 // Its NextSibling attribute should be equal to null.
\r
2917 computedValue = testNode.NextSibling;//.node.
\r
2919 catch(System.Exception ex)
\r
2921 computedValue = "Exception " + ex.Message;
\r
2925 // Write out results.
\r
2927 results.expected = (expectedValue == null).ToString();
\r
2928 results.actual = (computedValue == null).ToString();
\r
2930 Assert.AreEqual (results.expected, results.actual);
\r
2933 //------------------------ End test case core-0062NO --------------------------
\r
2935 //------------------------- test case core-0063NO -----------------------------
\r
2937 // Testing feature - The ownerDocument attribute contains the Document
\r
2938 // associated with this node.
\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
2945 // Semantic Requirements: 32
\r
2947 //----------------------------------------------------------------------------
\r
2950 public void core0063NO()
\r
2952 string computedValue = "";
\r
2953 string expectedValue = "staff";
\r
2954 System.Xml.XmlNode testNode = null;
\r
2955 System.Xml.XmlDocument ownerDoc = null;
\r
2957 testResults results = new testResults("Core0063NO");
\r
2959 results.description = "The ownerDocument attribute contains the Document "+
\r
2960 "associated with this node.";
\r
2962 // Retrieve the targeted data and access its ownerDocument attribute.
\r
2964 testNode = util.nodeObject(util.SECOND,-1);
\r
2965 ownerDoc = testNode.OwnerDocument;//.node.
\r
2967 // the nodeName of its root node should be "staff";
\r
2969 computedValue = ownerDoc.DocumentElement.Name;
\r
2971 // Write out results.
\r
2973 results.expected = expectedValue;
\r
2974 results.actual = computedValue;
\r
2976 Assert.AreEqual (results.expected, results.actual);
\r
2979 //------------------------ End test case core-0063NO --------------------------
\r
2981 //------------------------- test case core-0064NO -----------------------------
\r
2983 // Testing feature - The ownerDocument attribute returns null if the
\r
2984 // target node is itself a Document.
\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
2991 // Semantic Requirements: 33
\r
2993 //----------------------------------------------------------------------------
\r
2996 public void core0064NO()
\r
2998 object computedValue = null;
\r
2999 object expectedValue = null;
\r
3000 System.Xml.XmlNode testNode = null;
\r
3002 testResults results = new testResults("Core0064NO");
\r
3004 results.description = "The ownerDocument attribute returns null if the "+
\r
3005 "target node is itself a Document.";
\r
3007 // Retrieve the targeted data.
\r
3009 testNode = util.getDOMDocument();
\r
3011 // Its ownerDocument attribute should be null.
\r
3013 computedValue = testNode.OwnerDocument;
\r
3015 // Write out results.
\r
3017 results.expected = (expectedValue == null).ToString();
\r
3018 results.actual = (computedValue == null).ToString();
\r
3020 Assert.AreEqual (results.expected, results.actual);
\r
3023 //------------------------ End test case core-0064NO --------------------------
\r
3025 //------------------------- test case core-0065NO -----------------------------
\r
3027 // Testing feature - The insertBefore(newChild,refChild) method inserts the
\r
3028 // node newChild before the node refChild.
\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
3035 // Semantic Requirements: 34
\r
3037 //----------------------------------------------------------------------------
\r
3040 public void core0065NO()
\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
3048 testResults results = new testResults("Core0065NO");
\r
3051 results.description = "The insertBefore(newChild,refChild) method inserts "+
\r
3052 "the node newChild before the node refChild.";
\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
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
3062 // Check that each node is in the proper position.
\r
3064 computedValue += util.getSubNodes(testNode).Item(util.FOURTH).Name+" ";
\r
3065 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;
\r
3067 catch(System.Exception ex)
\r
3069 computedValue = "Exception " + ex.Message;
\r
3072 // Write out results.
\r
3074 results.expected = expectedValue;
\r
3075 results.actual = computedValue;
\r
3078 Assert.AreEqual (results.expected, results.actual);
\r
3081 //------------------------ End test case core-0065NO --------------------------
\r
3083 //------------------------- test case core-0066NO -----------------------------
\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
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
3097 // Semantic Requirements: 35
\r
3099 //----------------------------------------------------------------------------
\r
3102 public void core0066NO()
\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
3110 testResults results = new testResults("Core0066NO");
\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
3116 // Retrieve targeted data, create a new Element node to insert, define
\r
3117 // the reference node and insert the newly created element
\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
3123 // Retrieve the node at the end of the list.
\r
3125 computedValue = testNode.LastChild.Name;//.node.
\r
3127 // Write out results.
\r
3129 results.expected = expectedValue;
\r
3130 results.actual = computedValue;
\r
3133 Assert.AreEqual (results.expected, results.actual);
\r
3136 //------------------------ End test case core-0066NO --------------------------
\r
3138 //------------------------- test case core-0067NO -----------------------------
\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
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
3151 // Semantic Requirements: 36
\r
3153 //----------------------------------------------------------------------------
\r
3156 public void core0067NO()
\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
3164 testResults results = new testResults("Core0067NO");
\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
3171 // Populate the DocumentFragment object.
\r
3173 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild1"));
\r
3174 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild2"));
\r
3176 // Retrieve targeted data, define reference node and insert new child.
\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
3182 // Check that all the new nodes are in the proper position.
\r
3184 computedValue += util.getSubNodes(testNode).Item(util.FOURTH).Name+" ";
\r
3185 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;
\r
3187 catch(System.Exception ex)
\r
3189 computedValue = "Exception " + ex.Message;
\r
3192 // Write out results.
\r
3194 results.expected = expectedValue;
\r
3195 results.actual = computedValue;
\r
3198 Assert.AreEqual (results.expected, results.actual);
\r
3201 //------------------------ End test case core-0067NO --------------------------
\r
3203 //------------------------- test case core-0068NO -----------------------------
\r
3205 // Testing feature - The insertBefore(newChild,refChild) method returns the
\r
3206 // node being inserted.
\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
3213 // Semantic Requirements: 37
\r
3215 //----------------------------------------------------------------------------
\r
3218 public void core0068NO()
\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
3227 testResults results = new testResults("Core0068NO");
\r
3230 results.description = "The insertBefore(newChild,refChild) method returns "+
\r
3231 "the node being inserted.";
\r
3233 // Retrieve targeted data, define reference and new child nodes and insert
\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
3241 // the returned node should have a nodeName = "newChild"
\r
3243 computedValue = insertedNode.Name;
\r
3245 catch(System.Exception ex)
\r
3247 computedValue = "Exception " + ex.Message;
\r
3250 // Write out results.
\r
3252 results.expected = expectedValue;
\r
3253 results.actual = computedValue;
\r
3256 Assert.AreEqual (results.expected, results.actual);
\r
3259 //------------------------ End test case core-0068NO --------------------------
\r
3261 //------------------------- test case core-0069NO -----------------------------
\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
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
3273 // Semantic Requirements: 38
\r
3275 //----------------------------------------------------------------------------
\r
3278 public void core0069NO()
\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
3286 testResults results = new testResults("Core0069NO");
\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
3293 // Retrieve targeted data, define reference and new child and insert the
\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
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
3304 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";
\r
3305 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;
\r
3307 catch(System.Exception ex)
\r
3309 computedValue = "Exception " + ex.Message;
\r
3312 // Write out results.
\r
3314 results.expected = expectedValue;
\r
3315 results.actual = computedValue;
\r
3318 Assert.AreEqual (results.expected, results.actual);
\r
3321 //------------------------ End test case core-0069NO --------------------------
\r
3323 //------------------------- test case core-0070NO -----------------------------
\r
3325 // Testing feature - The replaceChild(newChild,oldChild) method replaces
\r
3326 // the node oldChild with the node newChild.
\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
3333 // Semantic Requirements: 39
\r
3335 //----------------------------------------------------------------------------
\r
3338 public void core0070NO()
\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
3347 testResults results = new testResults("Core0070NO");
\r
3350 results.description = "The replaceChild(newChild,oldChild) method "+
\r
3351 "replaces the node oldChild with the node newChild";
\r
3353 // Create a new Element node to replace, define the node to be
\r
3354 // replaced and replace it.
\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
3361 // Check that the first position contains the new node.
\r
3363 computedValue = util.getSubNodes(testNode).Item(util.FIRST).Name;
\r
3365 catch(System.Exception ex)
\r
3367 computedValue = "Exception " + ex.Message;
\r
3370 // Write out results.
\r
3372 results.expected = expectedValue;
\r
3373 results.actual = computedValue;
\r
3376 Assert.AreEqual (results.expected, results.actual);
\r
3379 //------------------------ End test case core-0070NO ------------------------
\r
3381 //------------------------- test case core-0071NO ---------------------------
\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
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
3392 // Semantic Requirements: 40
\r
3394 //----------------------------------------------------------------------------
\r
3397 public void core0071NO()
\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
3405 testResults results = new testResults("Core0071NO");
\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
3412 // Retrieve targeted data, identify new and old children and replace
\r
3413 // last child with the new child.
\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
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
3424 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";
\r
3425 computedValue += util.getSubNodes(testNode).Item(util.FIFTH).Name;
\r
3427 catch(System.Exception ex)
\r
3429 computedValue = "Exception " + ex.Message;
\r
3432 // Write out results.
\r
3434 results.expected = expectedValue;
\r
3435 results.actual = computedValue;
\r
3438 Assert.AreEqual (results.expected, results.actual);
\r
3441 //------------------------ End test case core-0071NO --------------------------
\r
3443 //------------------------- test case core-0072NO -----------------------------
\r
3445 // Testing feature - The replaceChild(newChild,oldChild) method returns
\r
3446 // the node being replaced.
\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
3454 // Semantic Requirements: 41
\r
3456 //----------------------------------------------------------------------------
\r
3459 public void core0072NO()
\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
3468 testResults results = new testResults("Core0072NO");
\r
3471 results.description = "The replaceChild(newChild,oldChild) method returns "+
\r
3472 "the node being replaced.";
\r
3474 // Retrieve the targeted data, define new and old children and replace
\r
3475 // old child with new child.
\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
3482 // The returned node should be the one being replaced.
\r
3484 computedValue = replacedNode.Name;
\r
3486 catch(System.Exception ex)
\r
3488 computedValue = "Exception " + ex.Message;
\r
3491 // Write out results.
\r
3493 results.expected = expectedValue;
\r
3494 results.actual = computedValue;
\r
3497 Assert.AreEqual (results.expected, results.actual);
\r
3500 //------------------------ End test case core-0072NO --------------------------
\r
3502 //------------------------- test case core-0073NO -----------------------------
\r
3504 // Testing feature - The removeChild(oldChild) method removes the node
\r
3505 // indicated by oldChild.
\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
3513 // Semantic Requirements: 42
\r
3515 //----------------------------------------------------------------------------
\r
3518 public void core0073NO()
\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
3525 testResults results = new testResults("Core0073NO");
\r
3528 results.description = "The removeChild(oldChild) method removes the "+
\r
3529 "node indicated by oldChild.";
\r
3531 // Retrieve targeted data, identify old child and remove it from the
\r
3532 // list of children.
\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
3538 // Check that the node was indeed removed from the list.
\r
3540 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";
\r
3541 computedValue += util.getSubNodes(testNode).Count;
\r
3543 catch(System.Exception ex)
\r
3545 computedValue = "Exception " + ex.Message;
\r
3548 // Write out results.
\r
3550 results.expected = expectedValue;
\r
3551 results.actual = computedValue;
\r
3554 Assert.AreEqual (results.expected, results.actual);
\r
3557 //------------------------ End test case core-0073NO --------------------------
\r
3559 //------------------------- test case core-0074NO -----------------------------
\r
3561 // Testing feature - The removeChild(oldChild) method returns the node
\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
3570 // Semantic Requirements: 43
\r
3572 //----------------------------------------------------------------------------
\r
3575 public void core0074NO()
\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
3583 testResults results = new testResults("Core0074NO");
\r
3586 results.description = "The removeChild(oldChild) method returns the "+
\r
3589 // Retrieve the targeted data and remove it.
\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
3595 // The returned node should be the node removed.
\r
3597 computedValue = removedNode.Name;
\r
3599 catch(System.Exception ex)
\r
3601 computedValue = "Exception " + ex.Message;
\r
3604 // Write out results.
\r
3606 results.expected = expectedValue;
\r
3607 results.actual = computedValue;
\r
3610 Assert.AreEqual (results.expected, results.actual);
\r
3613 //------------------------ End test case core-0074NO --------------------------
\r
3615 //------------------------- test case core-0075NO -----------------------------
\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
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
3625 // Semantic Requirements: 44
\r
3627 //----------------------------------------------------------------------------
\r
3630 public void core0075NO()
\r
3632 string computedValue = "";
\r
3633 string expectedValue = "newChild";
\r
3634 System.Xml.XmlElement testNode = null;
\r
3635 System.Xml.XmlNode newChild = null;
\r
3637 testResults results = new testResults("Core0075NO");
\r
3640 results.description = "The appendChild(newChild) method adds the node "+
\r
3641 "newChild to the end of the list of children of "+
\r
3644 // Create a new Element node and append it to the end of the list.
\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
3650 // Retrieve the new last child.
\r
3652 computedValue = util.getSubNodes(testNode).Item(util.SEVENTH).Name;
\r
3654 catch(System.Exception ex)
\r
3656 computedValue = "Exception " + ex.Message;
\r
3659 // Write out results.
\r
3661 results.expected = expectedValue;
\r
3662 results.actual = computedValue;
\r
3665 Assert.AreEqual (results.expected, results.actual);
\r
3668 //------------------------ End test case core-0075NO ------------------------
\r
3670 //------------------------- test case core-0076NO ---------------------------
\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
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
3683 // Semantic Requirements: 45
\r
3685 //----------------------------------------------------------------------------
\r
3688 public void core0076NO()
\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
3695 testResults results = new testResults("Core0076NO");
\r
3698 results.description = "If newChild is already in the tree, it is first " + "removed before the append takes place.";
\r
3700 // Retrieve targeted data, define the new child and append it to the
\r
3701 // end of the list.
\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
3707 // Access the relevant new nodes and its nodeName attributes.
\r
3709 computedValue += util.getSubNodes(testNode).Item(util.FIRST).Name+" ";
\r
3710 computedValue += util.getSubNodes(testNode).Item(util.SIXTH).Name;
\r
3712 catch(System.Exception ex)
\r
3714 computedValue = "Exception " + ex.Message;
\r
3717 // Write out results.
\r
3719 results.expected = expectedValue;
\r
3720 results.actual = computedValue;
\r
3723 Assert.AreEqual (results.expected, results.actual);
\r
3726 //------------------------ End test case core-0076NO --------------------------
\r
3728 //------------------------- test case core-0077NO -----------------------------
\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
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
3739 // Semantic Requirements: 46
\r
3741 //----------------------------------------------------------------------------
\r
3744 public void core0077NO()
\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
3751 testResults results = new testResults("Core0077NO");
\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
3758 // Populate the DocumentFragment object.
\r
3760 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild1"));
\r
3761 newDocFragment.AppendChild(util.createNode(util.ELEMENT_NODE,"newChild2"));
\r
3763 // Retrieve targeted data and append new DocumentFragment object.
\r
3765 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);
\r
3766 testNode.AppendChild(newDocFragment);//.node.
\r
3768 // Retrieve all the new nodes from the proper position.
\r
3770 computedValue += util.getSubNodes(testNode).Item(util.SEVENTH).Name+" ";
\r
3771 computedValue += util.getSubNodes(testNode).Item(util.EIGHT).Name;
\r
3773 catch(System.Exception ex)
\r
3775 computedValue = "Exception " + ex.Message;
\r
3778 // Write out results.
\r
3780 results.expected = expectedValue;
\r
3781 results.actual = computedValue;
\r
3784 Assert.AreEqual (results.expected, results.actual);
\r
3787 //------------------------ End test case core-0077NO --------------------------
\r
3789 //------------------------- test case core-0078NO -----------------------------
\r
3791 // Testing feature - The appendChild(newChild) method returns the node
\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
3798 // Semantic Requirements: 47
\r
3800 //----------------------------------------------------------------------------
\r
3803 public void core0078NO()
\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
3811 testResults results = new testResults("Core0078NO");
\r
3813 results.description = "The appendChild(newChild) method returns the node "+
\r
3816 // Retrieve the targeted data and append a new node to it.
\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
3822 // The returned node should be the node appended.
\r
3824 computedValue = appendedNode.Name;
\r
3826 // Write out results.
\r
3828 results.expected = expectedValue;
\r
3829 results.actual = computedValue;
\r
3832 Assert.AreEqual (results.expected, results.actual);
\r
3835 //------------------------ End test case core-0078NO --------------------------
\r
3837 //------------------------- test case core-0079NO -----------------------------
\r
3839 // Testing feature - The hasChildNodes method returns true if the node has
\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
3846 // Semantic Requirements: 48
\r
3848 //----------------------------------------------------------------------------
\r
3851 public void core0079NO()
\r
3853 string computedValue = "";
\r
3854 string expectedValue = "True";
\r
3855 System.Xml.XmlNode testNode = null;
\r
3857 testResults results = new testResults("Core0079NO");
\r
3859 results.description = "The hasChildNodes method returns true if the "+
\r
3860 "node has any children.";
\r
3862 // Retrieve the targeted data and access its hasChilNodes method.
\r
3864 testNode = util.nodeObject(util.SECOND,-1);
\r
3865 computedValue = testNode.HasChildNodes.ToString();//.Item();//.node.
\r
3867 // Write out results.
\r
3869 results.expected = expectedValue;
\r
3870 results.actual = computedValue;
\r
3872 Assert.AreEqual (results.expected, results.actual);
\r
3875 //------------------------ End test case core-0079NO --------------------------
\r
3877 //------------------------- test case core-0080NO -----------------------------
\r
3879 // Testing feature - The hasChildNodes method returns false if the node has
\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
3887 // Semantic Requirements: 49
\r
3889 //----------------------------------------------------------------------------
\r
3892 public void core0080NO()
\r
3894 string computedValue = "";
\r
3895 string expectedValue = "False";
\r
3896 System.Xml.XmlNode testNode = null;
\r
3898 testResults results = new testResults("Core0080NO");
\r
3901 results.description = "The hasChildNodes method returns false if the "+
\r
3902 "node has no children.";
\r
3904 // Retrieve the targeted data and access its hasChildNodes method.
\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
3910 catch(System.Exception ex)
\r
3912 computedValue = "Exception " + ex.Message;
\r
3915 // Write out results.
\r
3917 results.expected = expectedValue;
\r
3918 results.actual = computedValue;
\r
3920 Assert.AreEqual (results.expected, results.actual);
\r
3923 //------------------------ End test case core-0080NO --------------------------
\r
3925 //------------------------- test case core-0081NO -----------------------------
\r
3927 // Testing feature - The cloneNode(deep) method returns a copy of the node only
\r
3928 // if deep = false.
\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
3936 // Semantic Requirements: 50
\r
3938 //----------------------------------------------------------------------------
\r
3941 public void core0081NO()
\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
3948 testResults results = new testResults("Core0081NO");
\r
3951 results.description = "The cloneNode(deep) method returns a copy of this "+
\r
3952 "node only if deep = false.";
\r
3954 // Retrieve the targeted data and access its cloneNode method.
\r
3956 testNode = util.nodeObject(util.SECOND,-1);
\r
3957 clonedNode = testNode.CloneNode(false);//.node.
\r
3959 // Retrieve values of the cloned node.
\r
3961 computedValue += clonedNode.Name+" ";
\r
3962 computedValue += clonedNode.ChildNodes.Count;
\r
3964 catch(System.Exception ex)
\r
3966 computedValue = "Exception " + ex.Message;
\r
3969 // Write out results.
\r
3971 results.expected = expectedValue;
\r
3972 results.actual = computedValue;
\r
3974 Assert.AreEqual (results.expected, results.actual);
\r
3977 //------------------------ End test case core-0081NO --------------------------
\r
3979 //------------------------- test case core-0082NO -----------------------------
\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
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
3991 // Semantic Requirements: 51
\r
3993 //----------------------------------------------------------------------------
\r
3996 public void core0082NO()
\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
4004 testResults results = new testResults("Core0082NO");
\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
4010 // Retrieve the targeted data and invoke its cloneNode method.
\r
4012 testNode = util.nodeObject(util.SECOND,-1);
\r
4013 clonedNode = testNode.CloneNode(true);//.node.
\r
4014 subTree = clonedNode.ChildNodes;
\r
4016 // Retrieve the cloned node children.
\r
4018 for (int index = 0;index < subTree.Count; index++)
\r
4019 computedValue += subTree.Item(index).Name+" ";
\r
4021 catch(System.Exception ex)
\r
4023 computedValue = "Exception " + ex.Message;
\r
4026 // Write out results.
\r
4028 results.expected = expectedValue;
\r
4029 results.actual = computedValue;
\r
4031 Assert.AreEqual (results.expected, results.actual);
\r
4034 //------------------------ End test case core-0082NO --------------------------
\r
4036 //------------------------- test case core-0083NO -----------------------------
\r
4038 // Testing feature - The duplicate node returned by the cloneNode(deep) method
\r
4039 // has no parent (parentNode = null).
\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
4046 // Semantic Requirements: 52
\r
4048 //----------------------------------------------------------------------------
\r
4051 public void core0083NO()
\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
4058 testResults results = new testResults("Core0083NO");
\r
4061 results.description = "The duplicate node returned by the cloneNode(deep) "+
\r
4062 "method has no parent (parentNode = null).";
\r
4064 // Retrieve the targeted data and invoke the cloneNode method.
\r
4066 testNode = util.nodeObject(util.SECOND,-1);
\r
4067 clonedNode = testNode.CloneNode(false);//.node.
\r
4069 // Its parentNode attribute should be null.
\r
4071 computedValue = clonedNode.ParentNode;
\r
4073 catch(System.Exception ex)
\r
4075 computedValue = "Exception " + ex.Message;
\r
4078 // Write out results.
\r
4080 results.expected = (expectedValue == null).ToString();
\r
4081 results.actual = (computedValue == null).ToString();
\r
4084 Assert.AreEqual (results.expected, results.actual);
\r
4087 //------------------------ End test case core-0083NO --------------------------
\r
4089 //------------------------- test case core-0084NO -----------------------------
\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
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
4099 // Semantic Requirements: 53
\r
4101 //----------------------------------------------------------------------------
\r
4104 public void core0084NO()
\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
4112 testResults results = new testResults("Core0084NO");
\r
4115 results.description = "The cloneNode(deep) method does not copy any text "+
\r
4116 "unless it is deep cloned(deep = false).";
\r
4118 // Retrieve the targeted data and invoke its clonedNode method.
\r
4120 testNode = util.nodeObject(util.SECOND,util.FOURTH);
\r
4121 clonedNode = testNode.CloneNode(false);//.node.
\r
4123 // The cloned node should have no text data in it.
\r
4125 computedValue = clonedNode.LastChild;
\r
4127 catch(System.Exception ex)
\r
4129 computedValue = "Exception " + ex.Message;
\r
4132 // Write out results.
\r
4134 results.expected = (expectedValue == null).ToString();
\r
4135 results.actual = (computedValue == null).ToString();
\r
4137 Assert.AreEqual (results.expected, results.actual);
\r
4140 //------------------------ End test case core-0084NO --------------------------
\r
4142 //------------------------- test case core-0085NO -----------------------------
\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
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
4152 // Semantic Requirements: 53
\r
4154 //----------------------------------------------------------------------------
\r
4157 public void core0085NO()
\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
4164 testResults results = new testResults("Core0085NO");
\r
4167 results.description = "The cloneNode(deep) method does not copy any text "+
\r
4168 "unless it is deep cloned(deep = true).";
\r
4170 // Retrieve the targeted data and invoke its cloneNode method.
\r
4172 testNode = util.nodeObject(util.SECOND,util.FOURTH);
\r
4173 clonedNode = testNode.CloneNode(true);//.node.
\r
4175 // Retrieve the text data inside the cloned node.
\r
4177 computedValue = clonedNode.LastChild.Value;
\r
4179 catch(System.Exception ex)
\r
4181 computedValue = "Exception " + ex.Message;
\r
4184 // Write out results.
\r
4186 results.expected = expectedValue;
\r
4187 results.actual = computedValue;
\r
4189 Assert.AreEqual (results.expected, results.actual);
\r
4192 //------------------------ End test case core-0085NO --------------------------
\r
4194 //------------------------- test case core-0086NO -----------------------------
\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
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
4205 // Semantic Requirements: 54
\r
4207 //----------------------------------------------------------------------------
\r
4210 public void core0086NO()
\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
4218 testResults results = new testResults("Core0086NO");
\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
4225 // Retrieve the targeted data and invoke its cloneNode method.
\r
4227 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
4228 clonedNode = testNode.CloneNode(true);//.node.
\r
4230 // Retreive cloned node and its attributes.
\r
4232 computedValue += clonedNode.Attributes.Item(0).Name+" ";
\r
4233 computedValue += clonedNode.Attributes.Item(1).Name;
\r
4235 // Determine order of NamedNodeMap items.
\r
4237 if (computedValue.Substring(0,1) == "d" && computedValue.Substring(1,1) == "o")
\r
4238 expectedValue = "domestic street";
\r
4240 expectedValue = "street domestic";
\r
4242 catch(Exception ex)
\r
4244 computedValue = "Exception " + ex.Message;
\r
4248 // Write out results.
\r
4250 results.expected = expectedValue;
\r
4251 results.actual = computedValue;
\r
4253 Assert.AreEqual (results.expected, results.actual);
\r
4256 //------------------------ End test case core-0086NO --------------------------
\r
4258 //------------------------- test case core-0087NO -----------------------------
\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
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
4269 // Semantic Requirements: 55
\r
4271 //----------------------------------------------------------------------------
\r
4274 public void core0087NO()
\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
4281 testResults results = new testResults("Core0087NO");
\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
4288 // Retrieve the targeted data.
\r
4290 testNode = util.getEntity("ent1");
\r
4291 entityDesc = (System.Xml.XmlText)testNode.FirstChild;
\r
4293 // attempt to set a value on a readonly node should raise an exception.
\r
4297 entityDesc.Value = "ABCD";
\r
4299 catch(System.Exception ex)
\r
4301 computedValue = ex.GetType ().FullName;
\r
4304 catch(System.Exception ex)
\r
4306 computedValue = "Exception " + ex.Message;
\r
4309 results.expected = expectedValue;
\r
4310 results.actual = computedValue;
\r
4313 Assert.AreEqual (results.expected, results.actual);
\r
4316 //------------------------ End test case core-0087NO -------------------------
\r
4318 //------------------------- test case core-0088NO -----------------------------
\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
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
4332 // Semantic Requirements: 56
\r
4334 //----------------------------------------------------------------------------
\r
4337 public void core0088NO()
\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
4346 testResults results = new testResults("Core0088NO");
\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
4353 // Retrieve targeted data and define reference child.
\r
4355 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
4356 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.
\r
4357 refChild = entityRefNode.FirstChild;
\r
4359 // Attempt to insert a node to an EntityReference descendant should raise
\r
4364 entityRefNode.InsertBefore(newChild,refChild);
\r
4366 catch(InvalidOperationException ex)
\r
4368 computedValue = ex.GetType ().FullName;
\r
4371 catch(System.Exception ex)
\r
4373 computedValue = "Exception " + ex.Message;
\r
4375 results.expected = expectedValue;
\r
4376 results.actual = computedValue;
\r
4379 Assert.AreEqual (results.expected, results.actual);
\r
4382 //------------------------ End test case core-0088NO -------------------------
\r
4384 //------------------------- test case core-0089NO ----------------------------
\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
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
4398 // Semantic Requirements: 57
\r
4400 //----------------------------------------------------------------------------
\r
4403 public void core0089NO()
\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
4412 testResults results = new testResults("Core0089NO");
\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
4419 // Retrieve targeted data and define oldChild.
\r
4421 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
4422 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild; //.node.
\r
4423 oldChild = entityRefNode.FirstChild;
\r
4425 // Attempt to replace a descendant of an EntityReference should raise an
\r
4430 entityRefNode.ReplaceChild(newChild,oldChild);
\r
4432 catch(ArgumentException ex)
\r
4434 computedValue = ex.GetType ().FullName;
\r
4437 catch(System.Exception ex)
\r
4439 computedValue = "Exception " + ex.Message;
\r
4441 results.expected = expectedValue;
\r
4442 results.actual = computedValue;
\r
4445 Assert.AreEqual (results.expected, results.actual);
\r
4448 //------------------------ End test case core-0089NO -------------------------
\r
4450 //------------------------- test case core-0090NO ----------------------------
\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
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
4462 // Semantic Requirements: 58
\r
4464 //----------------------------------------------------------------------------
\r
4467 public void core0090NO()
\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
4475 testResults results = new testResults("Core0090NO");
\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
4482 // Retreive targeted data and define oldChild.
\r
4484 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
4485 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.
\r
4486 oldChild = entityRefNode.FirstChild;
\r
4488 // Attempt to remove a descendant of an EntityReference node should
\r
4489 // raise an exception.
\r
4493 entityRefNode.RemoveChild(oldChild);
\r
4495 catch(ArgumentException ex)
\r
4497 computedValue = ex.GetType ().FullName;
\r
4500 catch(System.Exception ex)
\r
4502 computedValue = "Exception " + ex.Message;
\r
4505 results.expected = expectedValue;
\r
4506 results.actual = computedValue;
\r
4509 Assert.AreEqual (results.expected, results.actual);
\r
4512 //------------------------ End test case core-0090NO -------------------------
\r
4514 //------------------------- test case core-0091NO ----------------------------
\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
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
4528 // Semantic Requirements: 59
\r
4530 //----------------------------------------------------------------------------
\r
4533 public void core0091NO()
\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
4541 testResults results = new testResults("Core0091NO");
\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
4548 // Retrieve targeted data.
\r
4550 testNode = util.nodeObject(util.SECOND,util.SIXTH);
\r
4551 entityRefNode = (System.Xml.XmlEntityReference)testNode.FirstChild;//.node.
\r
4553 // Attempt to append nodes to descendants of EntityReference nodes should
\r
4554 // raise an exception.
\r
4558 entityRefNode.AppendChild(newChild);
\r
4560 catch(InvalidOperationException ex)
\r
4562 computedValue = ex.GetType ().FullName;
\r
4565 catch(System.Exception ex)
\r
4567 computedValue = "Exception " + ex.Message;
\r
4569 results.expected = expectedValue;
\r
4570 results.actual = computedValue;
\r
4573 Assert.AreEqual (results.expected, results.actual);
\r
4576 //------------------------ End test case core-0091NO -------------------------
\r
4578 //------------------------- test case core-0092NO -----------------------------
\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
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
4590 // Semantic Requirements: 60
\r
4592 //----------------------------------------------------------------------------
\r
4595 public void core0092NO()
\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
4603 testResults results = new testResults("Core0092NO");
\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
4611 // Retrieve targeted data.
\r
4613 rootNode = util.getRootNode();
\r
4614 refChild = util.nodeObject(util.SECOND,-1);
\r
4616 // Attempt to insert an invalid child should raise an exception.
\r
4620 rootNode.InsertBefore(newChild,refChild);//.node
\r
4622 catch(System.Exception ex)
\r
4624 computedValue = ex.GetType().ToString();
\r
4627 catch(System.Exception ex)
\r
4629 computedValue = "Exception " + ex.Message;
\r
4632 results.expected = expectedValue;
\r
4633 results.actual = computedValue;
\r
4636 Assert.AreEqual (results.expected, results.actual);
\r
4639 //------------------------ End test case core-0092NO -------------------------
\r
4641 //------------------------- test case core-0093NO ----------------------------
\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
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
4652 // Semantic Requirements: 61
\r
4654 //----------------------------------------------------------------------------
\r
4657 public void core0093NO()
\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
4664 testResults results = new testResults("Core0093NO");
\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
4671 // Retrieve targeted data and define reference and new childs.
\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
4677 // Attempt to insert a node that is one of this node ancestors should
\r
4678 // raise an exception.
\r
4682 testNode.InsertBefore(newChild, refChild);//.node.
\r
4684 catch(System.Exception ex)
\r
4686 computedValue = ex.GetType().ToString();
\r
4690 catch(System.Exception ex)
\r
4692 computedValue = "Exception " + ex.Message;
\r
4694 results.expected = expectedValue;
\r
4695 results.actual = computedValue;
\r
4699 Assert.AreEqual (results.expected, results.actual);
\r
4702 //------------------------ End test case core-0093NO -------------------------
\r
4704 //------------------------- test case core-0094NO -----------------------------
\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
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
4716 // Semantic Requirements: 62
\r
4718 //----------------------------------------------------------------------------
\r
4721 public void core0094NO()
\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
4729 testResults results = new testResults("Core0094NO");
\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
4736 // Retrieve targeted data and define oldChild.
\r
4738 rootNode = util.getRootNode();
\r
4739 oldChild = util.nodeObject(util.SECOND,-1);
\r
4741 // Attempt to replace a child with an invalid child should raise an exception.
\r
4745 rootNode.ReplaceChild(newChild,oldChild);
\r
4747 catch(System.Exception ex)
\r
4749 computedValue = ex.GetType().ToString();
\r
4753 catch(System.Exception ex)
\r
4755 computedValue = ex.Message;
\r
4757 results.expected = expectedValue;
\r
4758 results.actual = computedValue;
\r
4762 Assert.AreEqual (results.expected, results.actual);
\r
4765 //------------------------ End test case core-0094NO -------------------------
\r
4767 //------------------------- test case core-0095NO ----------------------------
\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
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
4778 // Semantic Requirements: 63
\r
4780 //----------------------------------------------------------------------------
\r
4783 public void core0095NO()
\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
4791 testResults results = new testResults("Core0095NO");
\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
4798 // Retrieve targeted data and define new and old childs.
\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
4804 // Attempt to replace a child with an ancestor should raise an exception.
\r
4808 testNode.ReplaceChild(newChild,oldChild);//.node.
\r
4810 catch(InvalidOperationException ex)
\r
4812 computedValue = ex.GetType().ToString();
\r
4816 catch(System.Exception ex)
\r
4818 computedValue = "Exception " + ex.Message;
\r
4821 results.expected = expectedValue;
\r
4822 results.actual = computedValue;
\r
4826 Assert.AreEqual (results.expected, results.actual);
\r
4829 //------------------------ End test case core-0095NO -------------------------
\r
4831 //------------------------- test case core-0096NO ----------------------------
\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
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
4843 // Semantic Requirements: 64
\r
4845 //----------------------------------------------------------------------------
\r
4848 public void core0096NO()
\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
4855 testResults results = new testResults("Core0096NO");
\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
4862 // Retrieve the targeted data.
\r
4864 rootNode = util.getRootNode();
\r
4866 // Attempt to append an invalid child should raise an exception.
\r
4870 rootNode.AppendChild(newChild);
\r
4872 catch(System.Exception ex)
\r
4874 computedValue = ex.GetType().ToString();
\r
4878 catch(System.Exception ex)
\r
4880 computedValue = "Exception " + ex.Message;
\r
4882 results.expected = expectedValue;
\r
4883 results.actual = computedValue;
\r
4887 Assert.AreEqual (results.expected, results.actual);
\r
4890 //------------------------ End test case core-0096NO -------------------------
\r
4892 //------------------------- test case core-0097NO ----------------------------
\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
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
4902 // Semantic Requirements: 65
\r
4904 //----------------------------------------------------------------------------
\r
4907 public void core0097NO()
\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
4914 testResults results = new testResults("Core0097NO");
\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
4921 // Retrieve the targeted data and define the new child.
\r
4923 newChild = util.getRootNode();
\r
4924 testNode = util.nodeObject(util.SECOND,-1);
\r
4926 // Attempt to replace a child with an ancestor should raise an exception.
\r
4930 testNode.AppendChild(newChild);//.node.
\r
4932 catch(System.Exception ex)
\r
4934 computedValue = ex.GetType().ToString();
\r
4937 catch(System.Exception ex)
\r
4939 computedValue = "Exception " + ex.Message;
\r
4942 results.expected = expectedValue;
\r
4943 results.actual = computedValue;
\r
4947 Assert.AreEqual (results.expected, results.actual);
\r
4950 //------------------------ End test case core-0097NO -------------------------
\r
4952 //------------------------- test case core-0098NO ----------------------------
\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
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
4963 // Semantic Requirements: 66
\r
4965 //----------------------------------------------------------------------------
\r
4968 public void core0098NO()
\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
4976 testResults results = new testResults("Core0098NO");
\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
4983 // Retrieve targeted data.
\r
4985 testNode = util.nodeObject(util.SECOND,-1);
\r
4987 // Attempt to insert before a reference child that is not a child of
\r
4988 // this node should raise an exception.
\r
4992 testNode.InsertBefore(newChild,refChild);//.node.
\r
4994 catch(ArgumentException ex)
\r
4996 computedValue = ex.GetType ().FullName;
\r
4999 catch(System.Exception ex)
\r
5001 computedValue = "Exception " + ex.Message;
\r
5003 results.expected = expectedValue;
\r
5004 results.actual = computedValue;
\r
5008 Assert.AreEqual (results.expected, results.actual);
\r
5011 //------------------------ End test case core-0098NO -----------------------
\r
5013 //------------------------- test case core-0099NO --------------------------
\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
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
5024 // Semantic Requirements: 67
\r
5026 //----------------------------------------------------------------------------
\r
5029 public void core0099NO()
\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
5037 testResults results = new testResults("Core0099NO");
\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
5044 // Retrieve the targeted data..
\r
5046 testNode = util.nodeObject(util.SECOND,-1);
\r
5048 // Attempt to replace a non child node should raise an exception.
\r
5052 testNode.ReplaceChild(newChild,oldChild);//.node.
\r
5054 catch(ArgumentException ex)
\r
5056 computedValue = ex.GetType ().FullName;
\r
5059 catch(System.Exception ex)
\r
5061 computedValue = "Exception " + ex.Message;
\r
5063 results.expected = expectedValue;
\r
5064 results.actual = computedValue;
\r
5068 Assert.AreEqual (results.expected, results.actual);
\r
5071 //------------------------ End test case core-0099NO -----------------------
\r
5073 //------------------------- test case core-0100NO --------------------------
\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
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
5084 // Semantic Requirements: 68
\r
5086 //----------------------------------------------------------------------------
\r
5089 public void core0100NO()
\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
5096 testResults results = new testResults("Core0100NO");
\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
5103 // Retrieve targeted data.
\r
5105 testNode = util.nodeObject(util.SECOND,-1);
\r
5107 // Attempt to remove a non child node should raise an exception.
\r
5111 testNode.RemoveChild(oldChild);//.node.
\r
5113 catch(ArgumentException ex)
\r
5115 computedValue = ex.GetType ().FullName;
\r
5118 catch(System.Exception ex)
\r
5120 computedValue = "Exception " + ex.Message;
\r
5122 results.expected = expectedValue;
\r
5123 results.actual = computedValue;
\r
5127 Assert.AreEqual (results.expected, results.actual);
\r
5130 //------------------------ End test case core-0100NO -----------------------
\r
5132 //------------------------- test case core-0101NO ----------------------------
\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
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
5145 // Semantic Requirements: 69
\r
5147 //----------------------------------------------------------------------------
\r
5150 public void core0101NO()
\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
5158 testResults results = new testResults("Core0101NO");
\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
5166 // Retrieve targeted data and define reference child.
\r
5168 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);
\r
5169 refChild = util.getSubNodes(testNode).Item(util.FOURTH);
\r
5171 // Attempt to insert a child from a different document should raise an
\r
5176 testNode.InsertBefore(newChild,refChild);//.node.
\r
5178 catch(System.Exception ex)
\r
5180 computedValue = ex.GetType().ToString();
\r
5183 catch(System.Exception ex)
\r
5185 computedValue = "Exception " + ex.Message;
\r
5188 results.expected = expectedValue;
\r
5189 results.actual = computedValue;
\r
5192 Assert.AreEqual (results.expected, results.actual);
\r
5195 //------------------------ End test case core-0101NO -----------------------
\r
5197 //------------------------- test case core-0102NO --------------------------
\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
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
5209 // Semantic Requirements: 70
\r
5211 //----------------------------------------------------------------------------
\r
5214 public void core0102NO()
\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
5222 testResults results = new testResults("Core0102NO");
\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
5230 // Retrieve targeted data and define oldChild.
\r
5232 testNode = (System.Xml.XmlElement)util.nodeObject(util.SECOND,-1);
\r
5233 oldChild = util.getSubNodes(testNode).Item(util.FIRST);
\r
5235 // Attempt to replace a child with a child from a different document
\r
5236 // should raise an exception.
\r
5240 testNode.ReplaceChild(newChild,oldChild);//.node.
\r
5242 catch(System.Exception ex)
\r
5244 computedValue = ex.GetType().ToString();
\r
5247 catch(System.Exception ex)
\r
5249 computedValue = "Exception " + ex.Message;
\r
5252 results.expected = expectedValue;
\r
5253 results.actual = computedValue;
\r
5256 Assert.AreEqual (results.expected, results.actual);
\r
5259 //------------------------ End test case core-0102NO -----------------------
\r
5261 //------------------------- test case core-0103NO --------------------------
\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
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
5273 // Semantic Requirements: 71
\r
5275 //----------------------------------------------------------------------------
\r
5278 public void core0103NO()
\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
5285 testResults results = new testResults("Core0103NO");
\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
5293 // Retrieve the targeted data.
\r
5295 testNode = util.nodeObject(util.SECOND,-1);
\r
5297 // Attempt to append a child from a different document should raise an
\r
5302 testNode.AppendChild(newChild);//.node.
\r
5304 catch(System.Exception ex)
\r
5306 computedValue = ex.GetType().ToString();
\r
5309 catch(System.Exception ex)
\r
5311 computedValue = "Exception " + ex.Message;
\r
5313 results.expected = expectedValue;
\r
5314 results.actual = computedValue;
\r
5317 Assert.AreEqual (results.expected, results.actual);
\r
5320 //------------------------ End test case core-0103NO -----------------------
\r