1 //**************************************************************************
4 // National Institute Of Standards and Technology
7 // CharacterData Interface
9 // Written by: Carmelo Montanez
10 // Modified by: Mary Brady
12 // Ported to System.Xml by: Mizrahi Rafael rafim@mainsoft.com
13 // Mainsoft Corporation (c) 2003-2004
14 //**************************************************************************
19 using NUnit.Framework;
21 namespace nist_dom.fundamental
24 public class CharacterDataTest//,ITest
26 public static int i = 2;
28 public testResults[] RunTests()
30 testResults[] tests = new testResults[] {core0001C(), core0002C(), core0003C(),core0004C(),
31 core0005C(), core0006C(), core0007C(), core0008C(),
32 core0009C(), core0010C(), core0011C(), core0012C(),
33 core0013C(), core0014C(), core0015C(),
34 core0016C(), core0017C(), core0018C(), core0019C(),
35 core0020C(), core0021C(), core0022C(), core0023C(),
36 core0024C(), core0025C(), core0026C(), core0027C(),
37 core0028C(), core0029C(), core0030C(), core0031C(),
38 core0032C(), core0033C(), core0034C(), core0035C(),
44 //------------------------ test case core-0001C ------------------------
46 // Testing feature - The "data" attribute is the character data that
47 // implements this interface.
49 // Testing approach - Retrieve the character data from the second child of
50 // the first employee and invoke its "data" attribute. The
51 // attribute should return the actual data.
53 // Semantic Requirements: 1
55 //----------------------------------------------------------------------------
58 public void core0001C()
60 string computedValue = "";
61 string expectedValue = "Margaret Martin";
62 System.Xml.XmlNode testNode = null;
63 System.Xml.XmlCharacterData testNodeData = null;
65 testResults results = new testResults("Core0001C");
68 results.description = "The \"data\" attribute is the character data that " +
69 "implements this interface.";
71 // Access the targeted data.
73 testNode = util.nodeObject(util.FIRST,util.SECOND);
74 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
75 computedValue = testNodeData.Data;
77 catch(System.Exception ex)
79 computedValue = "Exception " + ex.Message;
84 results.expected = expectedValue;
85 results.actual = computedValue;
87 Assert.AreEqual (results.expected, results.actual);
90 //------------------------ End test case core-0001C --------------------------
92 //--------------------------- test case core-0002C ---------------------------
94 // Testing feature - The "length" attribute contains the number of 16-bit
95 // units that are available through the data attribute and
96 // the substringData method. Test for the "data" attribute.
98 // Testing approach - Retrieve the character data from the second child of
99 // the first employee and access its data by using the
100 // "data" attribute. Finally the "length" attribute
101 // is used on the character data returned by the "data"
102 // attribute to determine the number of 16 bit units in
105 // Semantic Requirements: 2
107 //----------------------------------------------------------------------------
110 public void core0002C()
112 string computedValue = "";
113 string expectedValue = "15";
114 System.Xml.XmlNode testNode = null;
115 System.Xml.XmlCharacterData testNodeData = null;
117 testResults results = new testResults("Core0002C");
120 results.description = "The \"length\" attribute is the number of 16-bit units " +
121 "that are available through the \"data\" attribute " +
122 "and the \"substringData\" method (test for \"data\").";
124 // Retrieve the targeted data and invoke its "data" attribute.
126 testNode = util.nodeObject(util.FIRST,util.SECOND);
127 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
128 computedValue = testNodeData.Length.ToString();
130 catch(System.Exception ex)
132 computedValue = "Exception " + ex.Message;
137 results.expected = expectedValue;
138 results.actual = computedValue;
140 Assert.AreEqual (results.expected, results.actual);
143 //------------------------ End test case core-0002C --------------------------
145 //--------------------------- test case core-0003C ---------------------------
147 // Testing feature - The "length" attribute contains the number of 16-bit units
148 // that are available through the data attribute and the
149 // substringData method. Test for the "substringData"
152 // Testing approach - Retrieve the character data of the second child of the
153 // first employee and access part of the data by using the
154 // "substringData(offset,count)" method. Finally the
155 // "length" attribute is used on the character data
156 // returned by the "substringData(offset,count)" method
157 // to determine the number of 16-bit units in the data.
159 // Semantic Requirements: 2
161 //----------------------------------------------------------------------------
164 public void core0003C()
166 string computedValue = "";
167 string expectedValue = "8";
168 System.Xml.XmlNode testNode = null;
169 System.Xml.XmlCharacterData testNodeData = null;
170 string subString = "";
172 testResults results = new testResults("Core0003C");
175 results.description = "The \"length\" attribute is the number of 16-bit units " +
176 "that are available through the \"data\" attribute " +
177 "and the \"substringData\" method (test for \"substringData\").";
179 // Retrieve the targeted data and invoke its "substringData" method.
181 testNode = util.nodeObject(util.FIRST,util.SECOND);
182 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
183 subString = testNodeData.Substring(0,8);
184 computedValue = subString.Length.ToString();
186 catch(System.Exception ex)
188 computedValue = "Exception " + ex.Message;
193 results.expected = expectedValue;
194 results.actual = computedValue;
196 Assert.AreEqual (results.expected, results.actual);
199 //------------------------ End test case core-0003C --------------------------
201 //--------------------------- test case core-0004C ---------------------------
203 // Testing feature - The "substringData(offset,count)" method returns the
204 // specified substring.
206 // Testing approach - Retrieve the character data from the second child of the
207 // first employee and access part of the data by using the
208 // "substringData(offset,count)" method. The method should
209 // return the specified substring starting at position
210 // "offset" and extract "count" characters. The method
211 // method should return the string "Margaret".
213 // Semantic Requirements: 3
215 //----------------------------------------------------------------------------
218 public void core0004C()
220 //string testName = "core-0004C";
221 string computedValue = "";
222 string expectedValue = "Margaret";
223 System.Xml.XmlNode testNode = null;
224 System.Xml.XmlCharacterData testNodeData = null;
226 testResults results = new testResults("Core0004C");
229 results.description = "The \"substringData(offset,count)\" method returns the " +
230 "specified substring.";
232 // Retrieve the targeted data and invoke its "substringData" method.
234 testNode = util.nodeObject(util.FIRST,util.SECOND);
235 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
236 computedValue = testNodeData.Substring(0,8);
238 catch(System.Exception ex)
240 computedValue = "Exception " + ex.Message;
245 results.expected = expectedValue;
246 results.actual = computedValue;
248 Assert.AreEqual (results.expected, results.actual);
251 //------------------------ End test case core-0004C --------------------------
253 //--------------------------- test case core-0005C ---------------------------
255 // Testing feature - If the sum of "offset" and "count" exceeds "length" then
256 // the substringData(offset,count) method returns all
257 // the 16-bit units to the end of the data.
259 // Testing approach - Retrieve the character data from the second child of the
260 // first employee and access part of the data by using the
261 // "substringData(offset,count)" method with offset = 9 and
262 // count = 10. The method should return the substring
263 // "Martin" since offset + count > length (19 > 15).
265 // Semantic Requirements: 4
267 //----------------------------------------------------------------------------
270 public void core0005C()
272 string computedValue = "";
273 string expectedValue = "Martin";
274 System.Xml.XmlNode testNode = null;
275 System.Xml.XmlCharacterData testNodeData = null;
277 testResults results = new testResults("Core0005C");
280 results.description = "If the sum of \"offset\" and \"count\" exceeds " +
281 "the value of the \"length\" attribute then the " +
282 "\"substringData(offset,count)\" method returns all " +
283 "the 16-bit units to the end of the data.";
285 // Retrieve the targeted data and invoke its "substringData" method.
287 testNode = util.nodeObject(util.FIRST,util.SECOND);
288 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
289 computedValue = testNodeData.Substring(9,10);
291 catch(System.Exception ex)
293 computedValue = "Exception " + ex.Message;
299 results.expected = expectedValue;
300 results.actual = computedValue;
302 Assert.AreEqual (results.expected, results.actual);
305 //------------------------ End test case core-0005C --------------------------
307 //--------------------------- test case core-0006C ---------------------------
309 // Testing feature - The "appendData(arg)" method appends a string to the end
310 // of the character data of the node.
312 // Testing approach - Retrieve the character data from the second child of the
313 // first employee. The "appendData(arg)" method is then
314 // called with arg = ", Esquire". The method should append
315 // the specified data to the already existing character
316 // data. The new value of the "length" attribute should
319 // Semantic Requirements: 5
321 //----------------------------------------------------------------------------
324 public void core0006C()
326 string computedValue = "";
327 string expectedValue = "24";
328 System.Xml.XmlNode testNode = null;
329 System.Xml.XmlCharacterData testNodeData = null;
331 testResults results = new testResults("Core0006C");
334 results.description = "The \"appendData(arg)\" method appends the specified " +
335 "string to the end of the character data of the node.";
337 // Retrieve targeted data and invoke the "appendData" method.
339 testNode = util.nodeObject(util.FIRST,util.SECOND);
340 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
341 testNodeData.AppendData(", Esquire");;
342 computedValue = testNodeData.Length.ToString();
344 catch(System.Exception ex)
346 computedValue = "Exception " + ex.Message;
351 results.expected = expectedValue;
352 results.actual = computedValue;
356 Assert.AreEqual (results.expected, results.actual);
359 //------------------------ End test case core-0006C --------------------------
361 //--------------------------- test case core-0007C ---------------------------
363 // Testing feature - Upon successful invocation of the "appendData(arg)"
364 // method, the "data" attribute provides access to the
365 // concatenation of data and the specified DOMString.
367 // Testing approach - Retrieve the character data from the second child of
368 // the first employee. The "appendData(arg)" method is
369 // then called with arg = ", Esquire". The method should
370 // append the specified data to the already existing
371 // character data. The new value of the "data" attribute
372 // should be "Margaret Martin, Esquire".
374 // Semantic Requirements: 6
376 //----------------------------------------------------------------------------
379 public void core0007C()
381 string computedValue = "";
382 string expectedValue = "Margaret Martin, Esquire";
383 System.Xml.XmlNode testNode = null;
384 System.Xml.XmlCharacterData testNodeData = null;
386 testResults results = new testResults("Core0007C");
389 results.description = "Upon successful invocation of the \"appendData(arg)\" " +
390 "method ,the \"data\" attribute provides access " +
391 "to the concatenation of \"data\" and the specified DOMString.";
393 // Retrieve targeted data and invoke its "appendData" method.
395 testNode = util.nodeObject(util.FIRST,util.SECOND);
396 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
397 testNodeData.AppendData(", Esquire");
398 computedValue = testNodeData.Data;
400 catch(System.Exception ex)
402 computedValue = "Exception " + ex.Message;
407 results.expected = expectedValue;
408 results.actual = computedValue;
412 Assert.AreEqual (results.expected, results.actual);
415 //------------------------ End test case core-0007C --------------------------
417 //--------------------------- test case core-0008C ---------------------------
419 // Testing feature - The "insertData(offset,arg)" method insert a string at the
420 // specified 16-bit unit offset. Insert at the beginning of
421 // the character data.
423 // Testing approach - Retrieve the character data from the second child of
424 // the first employee. The "insertData(offset,arg)"
425 // method is then called with offset = 0 and arg = "Mss.".
426 // The method should insert the string "Mss." at position
427 // 0. The new value of the character data should be "Mss.
430 // Semantic Requirements: 7
432 //----------------------------------------------------------------------------
435 public void core0008C()
437 string computedValue = "";
438 string expectedValue = "Mss. Margaret Martin";
439 System.Xml.XmlNode testNode = null;
440 System.Xml.XmlCharacterData testNodeData = null;
442 testResults results = new testResults("Core0008C");
445 results.description = "Insert a string at the beginning of character data.";
447 // Retrieve the targeted data and invoke its "insertData" method.
449 testNode = util.nodeObject(util.FIRST,util.SECOND);
450 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
451 testNodeData.InsertData(0,"Mss. ");
452 computedValue = testNodeData.Data;
454 catch(System.Exception ex)
456 computedValue = "Exception " + ex.Message;
461 results.expected = expectedValue;
462 results.actual = computedValue;
466 Assert.AreEqual (results.expected, results.actual);
469 //------------------------ End test case core-0008C --------------------------
471 //--------------------------- test case core-0009C ---------------------------
473 // Testing feature - The "insertData(offset,arg)" method insert a string at the
474 // specified 16-bit units offset. Insert in the middle of
475 // the character data.
477 // Testing approach - Retrieve the character data from the second child of the
478 // first employee. The "insertData(offset,arg)" method is
479 // then called with offset = 9 and arg = "Ann". The
480 // method should insert the string "Ann" at position 9.
481 // The new value of the character data should be
482 // "Margaret Ann Martin".
484 // Semantic Requirements: 7
486 //----------------------------------------------------------------------------
489 public void core0009C()
491 string computedValue = "";//0;
492 string expectedValue = "Margaret Ann Martin";
493 System.Xml.XmlNode testNode = null;
494 System.Xml.XmlCharacterData testNodeData = null;
496 testResults results = new testResults("Core0009C");
499 results.description = "Insert a character string in the middle of character data.";
501 // Retrieve targeted data and invoke its "insertData" method.
503 testNode = util.nodeObject(util.FIRST,util.SECOND);
504 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
505 testNodeData.InsertData(9,"Ann ");
506 computedValue = testNodeData.Data;
508 catch(System.Exception ex)
510 computedValue = "Exception " + ex.Message;
515 results.expected = expectedValue;
516 results.actual = computedValue;
520 Assert.AreEqual (results.expected, results.actual);
523 //------------------------ End test case core-0009C --------------------------
525 //--------------------------- test case core-0010C ---------------------------
527 // Testing feature - The "insertData(offset,arg)" method insert a string at the
528 // specified 16-bit units offset. Insert at the end of the
531 // Testing approach - Retrieve the character data from the second child of the
532 // first employee. The "insertData(offset,arg)" method
533 // is then called with offset = 14 and arg = ", Esquire".
534 // The method should insert the string ", Esquire" at
535 // position 14. The new value of the character data
536 // should be "Margaret Martin, Esquire"
538 // Semantic Requirements: 7
540 //----------------------------------------------------------------------------
543 public void core0010C()
545 string computedValue = "";
546 string expectedValue = "Margaret Martin, Esquire";
547 System.Xml.XmlNode testNode = null;
548 System.Xml.XmlCharacterData testNodeData = null;
550 testResults results = new testResults("Core0010C");
553 results.description = "Insert a string at the end of character data.";
555 // Retrieve the targeted data and invoke its "insertData" method.
557 testNode = util.nodeObject(util.FIRST,util.SECOND);
558 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
559 testNodeData.InsertData(15,", Esquire");
560 computedValue = testNodeData.Data;
562 catch(System.Exception ex)
564 computedValue = "Exception " + ex.Message;
569 results.expected = expectedValue;
570 results.actual = computedValue;
574 Assert.AreEqual (results.expected, results.actual);
577 //------------------------ End test case core-0010C --------------------------
579 //--------------------------- test case core-0011C ---------------------------
581 // Testing feature - The "deleteData(offset,count)" method removes a range of
582 // 16-bit units from the node. Delete at the beginning of the
585 // Testing approach - Retrieve the character data from the last child of the
586 // first employee. The "deleteData(offset,count)"
587 // method is then called with offset = 0 and count = 16.
588 // The method should delete the characters from position 0
589 // thru position 16. The new value of the character data
590 // should be "Dallas, Texas 98551".
592 // Semantic Requirements: 8, 9
594 //----------------------------------------------------------------------------
597 public void core0011C()
599 string computedValue = "";
600 string expectedValue = "Dallas, Texas 98551";
601 System.Xml.XmlNode testNode = null;
602 System.Xml.XmlCharacterData testNodeData = null;
604 testResults results = new testResults("Core0011C");
607 results.description = "Delete character string from beginning of character data.";
609 // Retrieve the targeted data and invoke its "deleteData" method..
611 testNode = util.nodeObject(util.FIRST,util.SIXTH);
612 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
613 testNodeData.DeleteData(0,16);
614 computedValue = testNodeData.Data;
616 catch(System.Exception ex)
618 computedValue = "Exception " + ex.Message;
623 results.expected = expectedValue;
624 results.actual = computedValue;
628 Assert.AreEqual (results.expected, results.actual);
631 //------------------------ End test case core-0011C --------------------------
633 //--------------------------- test case core-0012C ---------------------------
635 // Testing feature - The "deleteData(offset,count)" method removes a range of
636 // 16-bit units from the node. Delete in the middle of
637 // the character data.
639 // Testing approach - Retrieve the character data from the last child of
640 // the first employee. The "deleteData(offset,count)"
641 // method is then called with offset = 16 and count = 8.
642 // The method should delete the characters from position 16
643 // thru position 24. The new value of the character data
644 // should be "1230 North Ave. Texas 98551".
646 // Semantic Requirements: 8, 9
648 //----------------------------------------------------------------------------
651 public void core0012C()
653 string computedValue = "";
654 string expectedValue = "1230 North Ave. Texas 98551";
655 System.Xml.XmlNode testNode = null;
656 System.Xml.XmlCharacterData testNodeData = null;
658 testResults results = new testResults("Core0012C");
661 results.description = "Delete character string from the middle of character data.";
663 // Retrieve the targeted data and invoke its "deleteData" method.
665 testNode = util.nodeObject(util.FIRST,util.SIXTH);
666 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
667 testNodeData.DeleteData(16,8);
668 computedValue = testNodeData.Data;
670 catch(System.Exception ex)
672 computedValue = "Exception " + ex.Message;
677 results.expected = expectedValue;
678 results.actual = computedValue;
682 Assert.AreEqual (results.expected, results.actual);
685 //------------------------ End test case core-0012C --------------------------
687 //--------------------------- test case core-0013C ---------------------------
689 // Testing feature - The "deleteData(offset,count)" method removes a range of
690 // 16-bit units from the node. Delete at the end of the
693 // Testing approach - Retrieve the character data from the last child of
694 // the first employee. The "deleteData(offset,count)"
695 // method is then called with offset = 30 and count = 5.
696 // The method should delete the characters from position 30
697 // thru position 35. The new value of the character data
698 // should be "1230 North Ave. Dallas, Texas".
700 // Semantic Requirements: 8, 9
702 //----------------------------------------------------------------------------
705 public void core0013C()
707 string computedValue = "";
708 string expectedValue = "1230 North Ave. Dallas, Texas ";
709 System.Xml.XmlNode testNode = null;
710 System.Xml.XmlCharacterData testNodeData = null;
712 testResults results = new testResults("Core0013C");
715 results.description = "Delete character string from the end of character data.";
717 // Retrieve the targeted data and invoke its "deleteData" method.
719 testNode = util.nodeObject(util.FIRST,util.SIXTH);
720 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
721 testNodeData.DeleteData(30,5);
722 computedValue = testNodeData.Data;
724 catch(System.Exception ex)
726 computedValue = "Exception " + ex.Message;
731 results.expected = expectedValue;
732 results.actual = computedValue;
736 Assert.AreEqual (results.expected, results.actual);
739 //------------------------ End test case core-0013C --------------------------
741 //--------------------------- test case core-0014C ---------------------------
743 // Testing feature - Upon successful invocation of the
744 // "deleteData(offset,count)" method, the data and length
745 // attributes reflect that change.
747 // Testing approach - Retrieve the character data of the last child of the
748 // first employee. The "deleteData(offset,count)"
749 // method is then called with offset = 30 and count = 5.
750 // The method should delete the characters from position 30
751 // thru position 35. The new value of the character data
752 // should be "1230 North Ave. Dallas, Texas" (the data
753 // attribute) and its length attribute should be 30. This
754 // new values should be reflected immediately upon
757 // Semantic Requirements: 9
759 //----------------------------------------------------------------------------
762 public void core0014C()
764 string computedValue = "";
765 string expectedValue = "1230 North Ave. Dallas, Texas 30";
766 System.Xml.XmlNode testNode = null;
767 System.Xml.XmlCharacterData testNodeData = null;
769 testResults results = new testResults("Core0014C");
772 results.description = "Data and length attributes are updated as a result " +
773 "of the \"deleteData(offset, count)\" method.";
775 // Retrieve the targeted data and invoke its "deleteData" attribute.
777 testNode = util.nodeObject(util.FIRST,util.SIXTH);
778 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
779 testNodeData.DeleteData(30,5);
780 computedValue += testNodeData.Data;
781 computedValue += testNodeData.Length;
783 catch(System.Exception ex)
785 computedValue = "Exception " + ex.Message;
791 results.expected = expectedValue;
792 results.actual = computedValue;
796 Assert.AreEqual (results.expected, results.actual);
799 //------------------------ End test case core-0014C --------------------------
801 //--------------------------- test case core-0015C ---------------------------
803 // Testing feature - If the sum of the offset and count attributes (from the
804 // deleteData method) is greater than the length of the
805 // character data then all the 16-bit units from the offset
806 // to the end of the data are deleted.
808 // Testing approach - Retrieve the character data from the last child of the
809 // first employee. The "deleteData(offset,count)"
810 // method is then called with offset = 4 and count = 50.
811 // The method should delete the characters from position 4
812 // to the end of the data since offset + count (50+4) is
813 // greater than the length of the character data (35).
814 // The new value for the character data should be "1230".
816 // Semantic Requirements: 10
818 //----------------------------------------------------------------------------
821 public void core0015C()
823 string computedValue = "";
824 string expectedValue = "1230";
825 System.Xml.XmlNode testNode = null;
826 System.Xml.XmlCharacterData testNodeData = null;
828 testResults results = new testResults("Core0015C");
831 results.description = "If the sum of \"offset\" and \"count\" exceeds the " +
832 "length of the character data then all the " +
833 "16-bit units from the offset thru the end of the " +
834 "data are removed.<br>";
836 // Retrieve the targeted data and invoke its "deleteData" method.
838 testNode = util.nodeObject(util.FIRST,util.SIXTH);
839 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
840 testNodeData.DeleteData(4,50);
841 computedValue = testNodeData.Data;
843 catch(System.Exception ex)
845 computedValue = "Exception " + ex.Message;
851 results.expected = expectedValue;
852 results.actual = computedValue;
856 Assert.AreEqual (results.expected, results.actual);
859 //------------------------ End test case core-0015C --------------------------
861 //--------------------------- test case core-0016C ---------------------------
863 // Testing feature - The "replaceData(offset,count,arg)" method replace the
864 // characters starting at the specified 16-bit units with the
865 // specified string. Test for replacement at the
866 // beginning of the data.
868 // Testing approach - Retrieve the character data from the last child of the
869 // first employee. The "replaceData(offset,count,arg)"
870 // method is then called with offset = 0 and count = 4 and
871 // arg = "2500". The method should replace the first four
872 // characters of the character data with "2500".
874 // Semantic Requirements: 11
876 //----------------------------------------------------------------------------
879 public void core0016C()
881 string computedValue = "";//0;
882 string expectedValue = "2500 North Ave. Dallas, Texas 98551";
883 System.Xml.XmlNode testNode = null;
884 System.Xml.XmlCharacterData testNodeData = null;
886 testResults results = new testResults("Core0016C");
889 results.description = "Replace a character string at the beginning of character data.";
891 // Retrieve the targeted data and invoke its "replaceData" method .
893 testNode = util.nodeObject(util.FIRST,util.SIXTH);
894 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
895 testNodeData.ReplaceData(0,4,"2500");
896 computedValue = testNodeData.Data;
898 catch(System.Exception ex)
900 computedValue = "Exception " + ex.Message;
906 results.expected = expectedValue;
907 results.actual = computedValue;
911 Assert.AreEqual (results.expected, results.actual);
914 //------------------------ End test case core-0016C --------------------------
916 //--------------------------- test case core-0017C ---------------------------
917 // Testing feature - The "replaceData(offset,count,arg)" method replace the
918 // characters starting at the specified 16-bit units with the
919 // specified string. Test for replacement in the
920 // middle of the data.
922 // Testing approach - Retrieve the character data from the last child of the
923 // first employee. The "replaceData(offset,count,arg)"
924 // method is then called with offset = 5 and count = 5 and
925 // arg = "South". The method should replace characters
926 // five thru nine of the character data with "South".
928 // Semantic Requirements: 11
930 //----------------------------------------------------------------------------
933 public void core0017C()
935 string computedValue = "";
936 string expectedValue = "1230 South Ave. Dallas, Texas 98551";
937 System.Xml.XmlNode testNode = null;
938 System.Xml.XmlCharacterData testNodeData = null;
940 testResults results = new testResults("Core0017C");
943 results.description = "Replace a character string in the middle of character data.";
945 // Retrieve the targeted data and invoke its "replaceData" method.
947 testNode = util.nodeObject(util.FIRST,util.SIXTH);
948 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
949 testNodeData.ReplaceData(5,5,"South");
950 computedValue = testNodeData.Data;
952 catch(System.Exception ex)
954 computedValue = "Exception " + ex.Message;
960 results.expected = expectedValue;
961 results.actual = computedValue;
965 Assert.AreEqual (results.expected, results.actual);
968 //------------------------ End test case core-0017C --------------------------
970 //--------------------------- test case core-0018C ---------------------------
972 // Testing feature - The "replaceData(offset,count,arg)" method replace the
973 // characters starting at the specified 16-bit units with the
974 // specified string. Test for replacement at the
977 // Testing approach - Retrieve the character data from the last child of the
978 // first employee. The "replaceData(offset,count,arg)"
979 // method is then called with offset = 30 and count = 5 and
980 // arg = "98665". The method should replace characters
981 // 30 thru 34 of the character data with "98665".
983 // Semantic Requirements: 11
985 //----------------------------------------------------------------------------
988 public void core0018C()
990 string computedValue = "";//0;
991 string expectedValue = "1230 North Ave. Dallas, Texas 98665";
992 System.Xml.XmlNode testNode = null;
993 System.Xml.XmlCharacterData testNodeData = null;
995 testResults results = new testResults("Core0018C");
998 results.description = "Replace a character substring at the end of character data.";
1000 // Retrieve the targeted data and invoke its "replaceData" method.
1002 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1003 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1004 testNodeData.ReplaceData(30,5,"98665");
1005 computedValue = testNodeData.Data;
1007 catch(System.Exception ex)
1009 computedValue = "Exception " + ex.Message;
1013 // Write out results
1015 results.expected = expectedValue;
1016 results.actual = computedValue;
1020 Assert.AreEqual (results.expected, results.actual);
1023 //------------------------ End test case core-0018C --------------------------
1025 //--------------------------- test case core-0019C ---------------------------
1027 // Testing feature - The "replaceData(offset,count,arg)" method replace the
1028 // characters starting at the specified 16-bit units with the
1029 // specified string. Test situation where the length of
1030 // the arg string is greater than the specified offset.
1032 // Testing approach - Retrieve the character data from the last child of the
1033 // first employee. The "replaceData(offset,count,arg)"
1034 // method is then called with offset = 0 and count = 4 and
1035 // arg = "260030". The method should replace characters
1036 // one thru four with the string "260030". Note that the
1037 // length of the specified string is greater than the
1038 // specified offset.
1040 // Semantic Requirements: 11
1042 //----------------------------------------------------------------------------
1045 public void core0019C()
1047 string computedValue = "";
1048 string expectedValue = "260030 North Ave. Dallas, Texas 98551";
1049 System.Xml.XmlNode testNode = null;
1050 System.Xml.XmlCharacterData testNodeData = null;
1052 testResults results = new testResults("Core0019C");
1055 results.description = "Checks \"replaceData(offset,count,arg)\" method when " +
1056 "length of arg > count.";
1058 // Retrieve targeted data and invoke its "replaceData" method.
1060 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1061 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1062 testNodeData.ReplaceData(0,4,"260030");
1063 computedValue = testNodeData.Data;
1065 catch(System.Exception ex)
1067 computedValue = "Exception " + ex.Message;
1071 // Write out results
1073 results.expected = expectedValue;
1074 results.actual = computedValue;
1078 Assert.AreEqual (results.expected, results.actual);
1081 //------------------------ End test case core-0019C --------------------------
1083 //--------------------------- test case core-0020C ---------------------------
1085 // Testing feature - If the sum of offset and count exceeds length then all
1086 // the 16-bit units to the end of data are replaced.
1088 // Testing approach - Retrieve the character data from the last child of the
1089 // first employee. The "replaceData(offset,count,arg)"
1090 // method is then called with offset = 0 and count = 50 and
1091 // arg = "2600". The method should replace all the
1092 // characters in the character data with "2600". This
1093 // is because the sum of offset and count exceeds the
1094 // length of the character data.
1096 // Semantic Requirements: 12
1098 //----------------------------------------------------------------------------
1101 public void core0020C()
1103 //string testName = "core-0020C";
1104 string computedValue = "";
1105 string expectedValue = "2600";
1106 System.Xml.XmlNode testNode = null;
1107 System.Xml.XmlCharacterData testNodeData = null;
1109 testResults results = new testResults("Core0020C");
1112 results.description = "If the sum of offset and count exceeds the length " +
1113 "of the character data then the \"replaceData(offset,count,arg)\" " +
1114 "method replaces all the 16-bit units to the end of the data.";
1116 // Retrieve the targeted data and invoke its "replaceData" method.
1118 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1119 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1120 testNodeData.ReplaceData(0,50,"2600");
1121 computedValue = testNodeData.Data;
1123 catch(System.Exception ex)
1125 computedValue = "Exception " + ex.Message;
1129 // Write out results
1131 results.expected = expectedValue;
1132 results.actual = computedValue;
1136 Assert.AreEqual (results.expected, results.actual);
1139 //------------------------ End test case core-0020C --------------------------
1141 //--------------------------- test case core-0021C ---------------------------
1143 // Testing feature - The "data" attribute raises a
1144 // NO_MODIFICATION_ALLOWED_ERR Exception when
1145 // this node is readonly.
1147 // Testing approach - Retrieve the character data from the first
1148 // EntityReference node of the last child of the second
1149 // employee and attempt to set its "data" attribute. Since
1150 // the the descendants of EntityReference nodes are readonly,
1151 // the desired exception should be raised.
1153 // Semantic Requirements: 13
1155 //----------------------------------------------------------------------------
1158 [Category ("NotDotNet")] // MS DOM is buggy
1159 public void core0021C()
1161 string computedValue = "";
1162 System.Xml.XmlNode testNode = null;
1163 System.Xml.XmlText readOnlyText = null;
1164 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1166 testResults results = new testResults("Core0021C");
1169 results.description = "The \"data\" attribute raises a NO_MODIFICATION_ALLOWED_ERR " +
1170 "DOMException when this node is readonly.";
1172 // Retrieve targeted data.
1174 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1175 readOnlyText = (System.Xml.XmlText)testNode.FirstChild.FirstChild;
1177 // Attempt to modify the "data" attribute should raise exception.
1181 readOnlyText.Data = "ABCD";
1183 catch (ArgumentException ex)
1185 computedValue = ex.GetType ().FullName;
1188 catch(InvalidOperationException ex)
1190 computedValue = "Exception " + ex.Message;
1193 results.expected = expectedValue;
1194 results.actual = computedValue;
1198 Assert.AreEqual (results.expected, results.actual);
1201 //------------------------ End test case core-0021C --------------------------
1203 //--------------------------- test case core-0022C ---------------------------
1205 // Testing feature - The "appendData(arg) method raises a
1206 // NO_MODIFICATION_ALLOWED_ERR Exception when
1207 // this node is readonly.
1209 // Testing approach - Retrieve the textual data from the the first
1210 // EntityReference node of the last child of the
1211 // second employee and attempt to append data to it.
1212 // Descendants of EntityReference nodes are readonly
1213 // nodes and therefore the desired exception should be
1216 // Semantic Requirements: 14
1218 //----------------------------------------------------------------------------
1221 [Category ("NotDotNet")] // MS DOM is buggy
1222 public void core0022C()
1224 string computedValue = "";
1225 System.Xml.XmlNode testNode = null;
1226 System.Xml.XmlCharacterData readOnlyNode = null;
1227 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1229 testResults results = new testResults("Core0022C");
1232 results.description = "The \"appendData(arg)\" method raises a " +
1233 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1234 "node is readonly.";
1236 // Retrieve the targeted data.
1238 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1239 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1241 // Attempt to append data to a readonly node should raise an exception.
1245 readOnlyNode.AppendData("002");
1247 catch(ArgumentException ex)
1249 computedValue = ex.GetType ().FullName;
1252 catch(System.Exception ex)
1254 computedValue = "Exception " + ex.Message;
1257 results.expected = expectedValue;
1258 results.actual = computedValue;
1262 Assert.AreEqual (results.expected, results.actual);
1265 //------------------------ End test case core-0022C --------------------------
1267 //--------------------------- test case core-0023C ---------------------------
1269 // Testing feature - The "insertData(offset,arg) method raises a
1270 // NO_MODIFICATION_ALLOWED_ERR Exception when
1271 // this node is readonly.
1273 // Testing approach - Retrieve the Text data of the first EntityReference
1274 // node from the last child of the second employee and
1275 // attempt to insert data into it. Since the descendants
1276 // of EntityReference nodes are readonly, the desired
1277 // exception should be raised.
1279 // Semantic Requirements: 15
1281 //----------------------------------------------------------------------------
1284 [Category ("NotDotNet")] // MS DOM is buggy
1285 public void core0023C()
1287 string computedValue = "";
1288 System.Xml.XmlNode testNode = null;
1289 System.Xml.XmlCharacterData readOnlyNode = null;
1290 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1292 testResults results = new testResults("Core0023C");
1295 results.description = "The \"insertData(offset,arg)\" method raises a " +
1296 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1297 "node is readonly.";
1299 // Retrieve the targeted data
1301 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1302 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1304 // Attempt to insert data into a readonly node should raise an exception.
1308 readOnlyNode.InsertData(2,"ABCD");
1310 catch(ArgumentException ex)
1312 computedValue = ex.GetType ().FullName;
1315 catch(System.Exception ex)
1317 computedValue = "Exception " + ex.Message;
1320 results.expected = expectedValue;
1321 results.actual = computedValue;
1325 Assert.AreEqual (results.expected, results.actual);
1328 //------------------------ End test case core-0023C --------------------------
1330 //--------------------------- test case core-0024C ---------------------------
1332 // Testing feature - The "deleteData(offset,count) method raises a
1333 // NO_MODIFICATION_ALLOWED_ERR Exception when
1336 // Testing approach - Retrieve the textual data of the the first
1337 // EntityReference node from the last child of the
1338 // second employee and attempt to delete data from it.
1339 // Since the descendants of EntityReference nodes are
1340 // readonly, the desired exception should be raised.
1342 // Semantic Requirements: 16
1344 //----------------------------------------------------------------------------
1347 [Category ("NotDotNet")] // MS DOM is buggy
1348 public void core0024C()
1350 string computedValue = "";
1351 System.Xml.XmlCharacterData readOnlyNode = null;
1352 System.Xml.XmlNode testNode = null;
1353 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1355 testResults results = new testResults("Core0024C");
1358 results.description = "The \"deleteData(offset,count)\" method raises a " +
1359 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1360 "node is readonly.";
1362 // Retrieve the targeted data.
1364 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1365 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1367 // Attempt to delete data from a readonly node should raise an
1372 readOnlyNode.DeleteData(2,4);
1374 catch(System.Exception ex)
1376 computedValue = ex.GetType ().FullName;
1379 catch(System.Exception ex)
1381 computedValue = "Exception " + ex.Message;
1384 results.expected = expectedValue;
1385 results.actual = computedValue;
1389 Assert.AreEqual (results.expected, results.actual);
1392 //------------------------ End test case core-0024C --------------------------
1394 //--------------------------- test case core-0025C ---------------------------
1396 // Testing feature - The "replaceData(offset,count,arg) method raises a
1397 // NO_MODIFICATION_ALLOWED_ERR Exception when
1398 // this node is readonly.
1400 // Testing approach - Retrieve the textual data of the first EntityReference
1401 // node from the last child of the second employee and
1402 // attempt to replace data from it. Since the descendants
1403 // of EntityReference nodes are readonly, the desired
1404 // exception should be raised.
1406 // Semantic Requirements: 17
1408 //----------------------------------------------------------------------------
1411 [Category ("NotDotNet")] // MS DOM is buggy
1412 public void core0025C()
1414 string computedValue = "";
1415 System.Xml.XmlCharacterData readOnlyNode = null;
1416 System.Xml.XmlNode testNode = null;
1417 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1419 testResults results = new testResults("Core0025C");
1422 results.description = "The \"replaceData(offset,count,arg)\" method raises a " +
1423 "NO_MODIFICATION_ALLOWED_ERR Exception " +
1424 "when this node is readonly.";
1426 // Retrieve the targeted data.
1428 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1429 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1431 // Attempt to replace data from a readonly node should raise an
1436 readOnlyNode.ReplaceData(2,4,"ABCD");
1438 catch(System.Exception ex)
1440 computedValue = ex.GetType ().FullName;
1443 catch(System.Exception ex)
1445 computedValue = "Exception " + ex.Message;
1448 results.expected = expectedValue;
1449 results.actual = computedValue;
1453 Assert.AreEqual (results.expected, results.actual);
1456 //------------------------ End test case core-0025C --------------------------
1458 //--------------------------- test case core-0026C ---------------------------
1460 // Testing feature - The "substringData(offset,count)" method raises an
1461 // INDEX_SIZE_ERR Exception if the specified offset is
1464 // Testing approach - Retrieve the character data of the last child of the
1465 // of the first employee and invoke its
1466 // "substringData(offset,count)" method with offset = -5
1467 // count = 3. It should raise the desired exception since
1468 // the offset is negative.
1470 // Semantic Requirements: 19
1472 //----------------------------------------------------------------------------
1475 public void core0026C()
1477 string computedValue = "";
1478 string returnedValue = "";
1479 System.Xml.XmlNode testNode = null;
1480 System.Xml.XmlCharacterData testNodeData = null;
1481 string expectedValue = "System.ArgumentOutOfRangeException";//util.INDEX_SIZE_ERR;
1483 testResults results = new testResults("Core0026C");
1486 results.description = "The \"substringData(offset,count)\" method raises an " +
1487 "INDEX_SIZE_ERR Exception if the specified " +
1488 "offset is negative.";
1490 // Retrieve the targeted data.
1492 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1493 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1495 // A negative offset value should raise and exception.
1499 returnedValue = testNodeData.Substring(-5,3);
1501 catch(System.Exception ex)
1503 computedValue = ex.GetType ().FullName;
1506 catch(System.Exception ex)
1508 computedValue = "Exception " + ex.Message;
1511 results.expected = expectedValue;
1512 results.actual = computedValue;
1514 Assert.AreEqual (results.expected, results.actual);
1517 //------------------------ End test case core-0026C --------------------------
1519 //--------------------------- test case core-0027C ---------------------------
1521 // Testing feature - The "substringData(offset,count)" method raises an
1522 // INDEX_SIZE_ERR Exception if the specified offset is
1523 // greater than the number of 16-bit units in the "data"
1526 // Testing approach - Retrieve the character data of the last child of the
1527 // first employee and invoke its
1528 // "substringData(offset,count)" method with offset = 40 and
1529 // count = 3. The value of the offset is greater than that
1530 // one of the "data" attribute, therefore the desired
1531 // exception should be raised.
1533 // Semantic Requirements: 20
1535 //----------------------------------------------------------------------------
1538 public void core0027C()
1540 string computedValue = "";
1541 string returnedValue = "";
1542 System.Xml.XmlNode testNode = null;
1543 System.Xml.XmlCharacterData testNodeData = null;
1544 string expectedValue = "System.ArgumentOutOfRangeException";
1546 testResults results = new testResults("Core0027C");
1549 results.description = "The \"substringData(offset,count)\" method raises an " +
1550 "ArgumentOutOfRangeException Exception if the specified " +
1551 "offset is greater than the number of 16-bit units " +
1552 "in the \"data\" attribute.";
1554 // Retrieve the targeted data.
1556 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1557 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1559 // Offset greater than number of characters in data should raise an
1564 returnedValue = testNodeData.Substring(40,3);
1566 catch(System.Exception ex)
1568 computedValue = ex.GetType().ToString();
1571 catch(System.Exception ex)
1573 computedValue = "Exception " + ex.Message;
1575 results.expected = expectedValue;
1576 results.actual = computedValue;
1578 Assert.AreEqual (results.expected, results.actual);
1581 //------------------------ End test case core-0027C --------------------------
1583 //--------------------------- test case core-0028C ---------------------------
1585 // Testing feature - The "substringData(offset,count)" method raises an
1586 // INDEX_SIZE_ERR Exception if the count is negative
1588 // Testing approach - Retrieve the character data of the last child of the
1589 // first employee and invoke its
1590 // "substringData(offset,count)" method with offset = 10
1591 // and count = -3. Since the value of count is negative,
1592 // the desired exception should be raised.
1594 // Semantic Requirements: 21
1596 //----------------------------------------------------------------------------
1599 public void core0028C()
1601 string computedValue = "";
1602 string returnedValue = "";
1603 System.Xml.XmlNode testNode = null;
1604 System.Xml.XmlCharacterData testNodeData = null;
1605 string expectedValue = "System.ArgumentOutOfRangeException";
1607 testResults results = new testResults("Core0028C");
1610 results.description = "The \"substringData(offset,count)\" method raises an " +
1611 "INDEX_SIZE_ERR Exception if the count is negative.";
1613 // Retrieve the targeted data.
1615 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1616 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1618 // A negative value for "count" should raise an exception.
1622 returnedValue = testNodeData.Substring(10,-3);
1624 catch(System.Exception ex)
1626 computedValue = ex.GetType().ToString();
1629 catch(System.Exception ex)
1631 computedValue = "Exception " + ex.Message;
1633 results.expected = expectedValue;
1634 results.actual = computedValue;
1636 Assert.AreEqual (results.expected, results.actual);
1639 //------------------------ End test case core-0028C --------------------------
1641 //--------------------------- test case core-0029C ---------------------------
1643 // Testing feature - The "deleteData(offset,count)" method raises an
1644 // ArgumentOutOfRangeException if the specified offset is
1647 // Testing approach - Retrieve the character data of the last child of the
1648 // first employee and invoke its "deleteData(offset,count)"
1649 // method with offset = -5 and count = 3. The value of the
1650 // offset is negative and therefore the desired exception
1651 // should be raised.
1653 // Semantic Requirements: 22
1655 //----------------------------------------------------------------------------
1658 public void core0029C()
1660 string computedValue = "";
1661 System.Xml.XmlNode testNode = null;
1662 System.Xml.XmlCharacterData testNodeData = null;
1663 string expectedValue = "System.ArgumentOutOfRangeException";
1665 testResults results = new testResults("Core0029C");
1668 results.description = "The \"deleteData(offset,count)\" method raises an " +
1669 "ArgumentOutOfRangeException if the specified " +
1670 "offset is negative.";
1672 // Retrieve the targeted data.
1674 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1675 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1677 // Invoke "deleteData(offset,count)" method with negative offset should
1678 // should raise an excetion.
1682 testNodeData.DeleteData(-5,3);
1684 catch(System.Exception ex)
1686 computedValue = ex.GetType().ToString();
1689 catch(System.Exception ex)
1691 computedValue = "Exception " + ex.Message;
1693 results.expected = expectedValue;
1694 results.actual = computedValue;
1698 Assert.AreEqual (results.expected, results.actual);
1701 //------------------------ End test case core-0029C --------------------------
1703 //--------------------------- test case core-0030C ---------------------------
1705 // Testing feature - The "deleteData(offset,count)" method raises an
1706 // ArgumentOutOfRangeException if the specified offset is
1707 // greater than the number of characters in the "data"
1710 // Testing approach - Retrieve the character data of the last child of the
1711 // first employee and invoke its "deleteData(offset,count)"
1712 // method with offset = 40 and count = 3. The value of the
1713 // offset is greater than the number of characters in the
1714 // "data" attribute (35) and therefore the intended
1715 // exception should be raised.
1717 // Semantic Requirements: 23
1719 //----------------------------------------------------------------------------
1722 public void core0030C()
1724 string computedValue = "";
1725 System.Xml.XmlNode testNode = null;
1726 System.Xml.XmlCharacterData testNodeData = null;
1727 string expectedValue = "System.ArgumentOutOfRangeException";
1729 testResults results = new testResults("Core0030C");
1732 results.description = "The \"deleteData(offset,count)\" method raises an " +
1733 "ArgumentOutOfRangeException if the specified " +
1734 "offset is greater than the number of characters " +
1735 "in the \"data\" attribute.";
1737 // Retrieve the targeted data.
1739 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1740 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1742 // Invocation of "deleteData(offset,count)" method with offset > data
1743 // attribute should raise and exception.
1747 testNodeData.DeleteData(40,3);
1749 catch(System.Exception ex)
1751 computedValue = ex.GetType().ToString();
1754 catch(System.Exception ex)
1756 computedValue = "Exception " + ex.Message;
1759 results.expected = expectedValue;
1760 results.actual = computedValue;
1764 Assert.AreEqual (results.expected, results.actual);
1767 //------------------------ End test case core-0030C --------------------------
1769 //--------------------------- test case core-0031C ---------------------------
1771 // Testing feature - The "deleteData(offset,count)" method raises an
1772 // ArgumentOutOfRangeException if the specified count is
1775 // Testing approach - Retrieve the character data of the last child of the
1776 // first employee and invoke its "deleteData(offset,count)"
1777 // method with offset = 10 and count = -3. The value
1778 // of the specified count is negative and therefore the
1779 // intended exception should be raised.
1781 // Semantic Requirements: 24
1783 //----------------------------------------------------------------------------
1786 public void core0031C()
1788 string computedValue = "";
1789 System.Xml.XmlNode testNode = null;
1790 System.Xml.XmlCharacterData testNodeData = null;
1791 string expectedValue = "System.ArgumentOutOfRangeException";
1793 testResults results = new testResults("Core0031C");
1796 results.description = "The \"deleteData(offset,count)\" method raises an " +
1797 "ArgumentOutOfRangeException if the specified " +
1798 "count is negative.";
1800 // Retrieve the targeted data.
1802 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1803 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1805 // Invocation of "deleteData(offset,count)" method with count < 0
1806 // should raise and exception.
1810 testNodeData.DeleteData(10,-3);
1812 catch(System.Exception ex)
1814 computedValue = ex.GetType().ToString();
1817 catch(System.Exception ex)
1819 computedValue = "Exception " + ex.Message;
1822 results.expected = expectedValue;
1823 results.actual = computedValue;
1827 Assert.AreEqual (results.expected, results.actual);
1830 //------------------------ End test case core-0031C --------------------------
1832 //--------------------------- test case core-0032C ---------------------------
1834 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1835 // ArgumentOutOfRangeException if the specified offset is
1838 // Testing approach - Retrieve the character data of the last child of the
1839 // first employee and invoke its
1840 // "replaceData(offset,count,arg)" method with
1841 // offset = -5 and count = 3 and arg = "ABC". The value
1842 // of the offset is negative and therefore the desired
1843 // exception should be raised.
1845 // Semantic Requirements: 25
1847 //----------------------------------------------------------------------------
1850 public void core0032C()
1852 string computedValue = "";
1853 System.Xml.XmlNode testNode = null;
1854 System.Xml.XmlCharacterData testNodeData = null;
1855 string expectedValue = "System.ArgumentOutOfRangeException";
1857 testResults results = new testResults("Core0032C");
1860 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1861 "ArgumentOutOfRangeException if the specified " +
1862 "offset is negative.";
1864 // Retrieve the targeted data.
1866 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1867 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1869 // Invocation of "replaceData(offset,count,arg)" method offset < 0
1870 // should raise an exception.
1874 testNodeData.ReplaceData(-5,3,"ABC");
1876 catch(System.Exception ex)
1878 computedValue = ex.GetType().ToString();
1881 catch(System.Exception ex)
1883 computedValue = "Exception " + ex.Message;
1886 results.expected = expectedValue;
1887 results.actual = computedValue;
1891 Assert.AreEqual (results.expected, results.actual);
1894 //------------------------ End test case core-0032C --------------------------
1896 //--------------------------- test case core-0033C ---------------------------
1898 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1899 // INDEX_RANGE_ERR Exception if the specified offset is
1900 // greater than the number of 16-bit units in the "data"
1903 // Testing approach - Retrieve the character data of the last child of the
1904 // first employee and invoke its
1905 // "replaceData(offset,count,arg)" method with offset = 40,
1906 // count = 3 and arg = "ABC". The value of the offset is
1907 // greater than the number of characters in the "data"
1908 // attribute (35) and therefore the intended exception
1909 // should be raised.
1911 // Semantic Requirements: 26
1913 //----------------------------------------------------------------------------
1916 public void core0033C()
1918 string computedValue = "";
1919 System.Xml.XmlNode testNode = null;
1920 System.Xml.XmlCharacterData testNodeData = null;
1921 string expectedValue = "System.ArgumentOutOfRangeException";
1923 testResults results = new testResults("Core0033C");
1926 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1927 "ArgumentOutOfRangeException if the specified " +
1928 "offset is greater than the number of 16-bit units " +
1929 "in the \"data\" attribute.";
1931 // Retrieve the targeted data.
1933 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1934 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1936 // Invocation of "replaceData(offset,count,arg)" method with offset > data
1937 // attribute should raise and exception.
1941 testNodeData.ReplaceData(40,3,"ABC");
1943 catch(System.Exception ex)
1945 computedValue = ex.GetType().ToString();
1948 catch(System.Exception ex)
1950 computedValue = "Exception " + ex.Message;
1953 results.expected = expectedValue;
1954 results.actual = computedValue;
1958 Assert.AreEqual (results.expected, results.actual);
1961 //------------------------ End test case core-0033C --------------------------
1963 //--------------------------- test case core-0034C ---------------------------
1965 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1966 // ArgumentOutOfRangeException if the specified count is
1969 // Testing approach - Retrieve the character data of the last child of the
1970 // first employee and invoke its
1971 // "replaceData(offset,count,arg)" method with offset = 10,
1972 // count = -3 and arg = "ABC". The value of the specified
1973 // count is negative and therefore the intended exception
1974 // should be raised.
1976 // Semantic Requirements: 27
1978 //----------------------------------------------------------------------------
1981 public void core0034C()
1983 string computedValue = "";
1984 System.Xml.XmlNode testNode = null;
1985 System.Xml.XmlCharacterData testNodeData = null;
1986 string expectedValue = "System.ArgumentOutOfRangeException";
1988 testResults results = new testResults("Core0034C");
1991 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1992 "ArgumentOutOfRangeException if the specified " +
1993 "count is negative.";
1995 // Retrieve the targeted data.
1997 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1998 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
2000 // Invocation of "replaceData(offset,count,arg)" method with count < 0
2001 // should raise an exception.
2005 testNodeData.ReplaceData(10,-3,"ABC");
2007 catch(System.Exception ex)
2009 computedValue = ex.GetType().ToString();
2012 catch(System.Exception ex)
2014 computedValue = "Exception " + ex.Message;
2017 results.expected = expectedValue;
2018 results.actual = computedValue;
2022 Assert.AreEqual (results.expected, results.actual);
2025 //------------------------ End test case core-0034C --------------------------
2027 //--------------------------- test case core-0035C ---------------------------
2029 // Testing feature - The "insertData(offset,arg)" method raises an
2030 // ArgumentOutOfRangeException if the specified offset is
2033 // Testing approach - Retrieve the character data from the last child of the
2034 // first employee and invoke its "insertData(offset,arg)"
2035 // method with offset = -5 arg = "ABC". The value
2036 // of the offset is negative and therefore the desired
2037 // exception should be raised.
2039 // Semantic Requirements: 28
2041 //----------------------------------------------------------------------------
2044 public void core0035C()
2046 string computedValue = "";
2047 System.Xml.XmlNode testNode = null;
2048 System.Xml.XmlCharacterData testNodeData = null;
2049 string expectedValue = "System.ArgumentOutOfRangeException";
2051 testResults results = new testResults("Core0035C");
2054 results.description = "The \"insertData(offset,arg)\" method raises an " +
2055 "ArgumentOutOfRangeException if the specified offset is negative.";
2057 // Retrieve the targeted data.
2059 testNode = util.nodeObject(util.FIRST,util.SIXTH);
2060 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
2062 // Invocation of insertData(offset,arg)" method with offset < 0
2063 // should raise an exception.
2067 testNodeData.InsertData(-5,"ABC");
2069 catch(System.Exception ex)
2071 computedValue = ex.GetType().ToString();
2074 catch(System.Exception ex)
2076 computedValue = "Exception " + ex.Message;
2079 results.expected = expectedValue;
2080 results.actual = computedValue;
2084 Assert.AreEqual (results.expected, results.actual);
2087 //------------------------ End test case core-0035C --------------------------
2089 //--------------------------- test case core-0036C ---------------------------
2091 // Testing feature - The "insertData(offset,arg)" method raises an
2092 // ArgumentOutOfRangeException if the specified offset is
2093 // greater than the number of 16-bit units in the "data"
2096 // Testing approach - Retrieve the character data from the last child of the
2097 // first employee and invoke its "insertData(offset,arg)"
2098 // method with offset = 40 and arg = "ABC". The value of
2099 // the offset is greater than the number of characters in
2100 // the "data" attribute(35) and therefore the intended
2101 // exception should be raised.
2103 // Semantic Requirements: 29
2105 //----------------------------------------------------------------------------
2108 public void core0036C()
2110 string computedValue = "";
2111 System.Xml.XmlNode testNode = null;
2112 System.Xml.XmlCharacterData testNodeData = null;
2113 string expectedValue = "System.ArgumentOutOfRangeException";
2115 testResults results = new testResults("Core0036C");
2118 results.description = "The \"insertData(offset,arg)\" method raises an " +
2119 "ArgumentOutOfRangeException if the specified " +
2120 "offset is greater than the number of 16-bit units " +
2121 "in the \"data\" attribute.<br>";
2123 // Retrieve the targeted data.
2125 testNode = util.nodeObject(util.FIRST,util.SIXTH);
2126 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
2128 // Invocation of "insertData(offset arg)" method with offset > data
2129 // attribute should raise an exception.
2133 testNodeData.InsertData(40,"ABC");
2135 catch(System.Exception ex)
2137 computedValue = ex.GetType().ToString();
2140 catch(System.Exception ex)
2142 computedValue = "Exception " + ex.Message;
2145 results.expected = expectedValue;
2146 results.actual = computedValue;
2150 Assert.AreEqual (results.expected, results.actual);
2153 //------------------------ End test case core-0036C --------------------------