**** Merged from MCS ****
[mono-project.git] / mcs / class / System.XML / Test / System.Xml / nist_dom / fundamental / CharacterData / CharacterData.cs
blobf2b8377607b99b4336b7c37892d23a79d74fb3bb
1 //**************************************************************************
2 //
3 //
4 // National Institute Of Standards and Technology
5 // DTS Version 1.0
6 //
7 // CharacterData Interface
8 //
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 //**************************************************************************
15 using System;
16 using System.Xml;
18 using nist_dom;
19 using NUnit.Framework;
21 namespace nist_dom.fundamental
23 [TestFixture]
24 public class CharacterDataTest : Assertion//,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(),
39 core0036C()};
41 return tests;
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.
52 //
53 // Semantic Requirements: 1
55 //----------------------------------------------------------------------------
57 [Test]
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");
66 try
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;
82 // Write out results
84 results.expected = expectedValue;
85 results.actual = computedValue;
87 AssertEquals (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
103 // the data.
105 // Semantic Requirements: 2
107 //----------------------------------------------------------------------------
109 [Test]
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;
135 // Write out results
137 results.expected = expectedValue;
138 results.actual = computedValue;
140 AssertEquals (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"
150 // method.
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 //----------------------------------------------------------------------------
163 [Test]
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;
191 // write out results
193 results.expected = expectedValue;
194 results.actual = computedValue;
196 AssertEquals (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 //----------------------------------------------------------------------------
217 [Test]
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;
243 // Write out results
245 results.expected = expectedValue;
246 results.actual = computedValue;
248 AssertEquals (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 //----------------------------------------------------------------------------
269 [Test]
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;
297 // Write out results
299 results.expected = expectedValue;
300 results.actual = computedValue;
302 AssertEquals (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
317 // be 24.
319 // Semantic Requirements: 5
321 //----------------------------------------------------------------------------
323 [Test]
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;
349 // Write out results
351 results.expected = expectedValue;
352 results.actual = computedValue;
354 util.resetData();
356 AssertEquals (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 //----------------------------------------------------------------------------
378 [Test]
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;
405 // Write out results
407 results.expected = expectedValue;
408 results.actual = computedValue;
410 util.resetData();
412 AssertEquals (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.
428 // Margaret Martin".
430 // Semantic Requirements: 7
432 //----------------------------------------------------------------------------
434 [Test]
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;
459 // Write out results
461 results.expected = expectedValue;
462 results.actual = computedValue;
464 util.resetData();
466 AssertEquals (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 //----------------------------------------------------------------------------
488 [Test]
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;
513 // Write out results
515 results.expected = expectedValue;
516 results.actual = computedValue;
518 util.resetData();
520 AssertEquals (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
529 // character data.
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 //----------------------------------------------------------------------------
542 [Test]
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;
567 // Write out results
569 results.expected = expectedValue;
570 results.actual = computedValue;
572 util.resetData();
574 AssertEquals (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
583 // character data.
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 //----------------------------------------------------------------------------
596 [Test]
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;
621 // Write out results
623 results.expected = expectedValue;
624 results.actual = computedValue;
626 util.resetData();
628 AssertEquals (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 //----------------------------------------------------------------------------
650 [Test]
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;
675 // Write out results
677 results.expected = expectedValue;
678 results.actual = computedValue;
680 util.resetData();
682 AssertEquals (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
691 // character data.
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 //----------------------------------------------------------------------------
704 [Test]
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;
729 // Write out results
731 results.expected = expectedValue;
732 results.actual = computedValue;
734 util.resetData();
736 AssertEquals (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
755 // its invocation.
757 // Semantic Requirements: 9
759 //----------------------------------------------------------------------------
761 [Test]
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;
789 // Write out results
791 results.expected = expectedValue;
792 results.actual = computedValue;
794 util.resetData();
796 AssertEquals (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 //----------------------------------------------------------------------------
820 [Test]
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;
849 // Write out results
851 results.expected = expectedValue;
852 results.actual = computedValue;
854 util.resetData();
856 AssertEquals (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 //----------------------------------------------------------------------------
878 [Test]
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;
904 // Write out results
906 results.expected = expectedValue;
907 results.actual = computedValue;
909 util.resetData();
911 AssertEquals (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 //----------------------------------------------------------------------------
932 [Test]
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;
958 // Write out results
960 results.expected = expectedValue;
961 results.actual = computedValue;
963 util.resetData();
965 AssertEquals (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
975 // end of the data.
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 //----------------------------------------------------------------------------
987 [Test]
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;
1018 util.resetData();
1020 AssertEquals (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 //----------------------------------------------------------------------------
1044 [Test]
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;
1076 util.resetData();
1078 AssertEquals (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 //----------------------------------------------------------------------------
1100 [Test]
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;
1134 util.resetData();
1136 AssertEquals (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 //----------------------------------------------------------------------------
1157 [Test]
1158 public void core0021C()
1160 string computedValue = "";
1161 System.Xml.XmlNode testNode = null;
1162 System.Xml.XmlText readOnlyText = null;
1163 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1165 testResults results = new testResults("Core0021C");
1168 results.description = "The \"data\" attribute raises a NO_MODIFICATION_ALLOWED_ERR " +
1169 "DOMException when this node is readonly.";
1171 // Retrieve targeted data.
1173 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1174 readOnlyText = (System.Xml.XmlText)testNode.FirstChild.FirstChild;
1176 // Attempt to modify the "data" attribute should raise exception.
1178 try
1180 readOnlyText.Data = "ABCD";
1182 catch (ArgumentException ex)
1184 computedValue = ex.GetType ().FullName;
1187 catch(InvalidOperationException ex)
1189 computedValue = "Exception " + ex.Message;
1192 results.expected = expectedValue;
1193 results.actual = computedValue;
1195 util.resetData();
1197 AssertEquals (results.expected, results.actual);
1200 //------------------------ End test case core-0021C --------------------------
1202 //--------------------------- test case core-0022C ---------------------------
1204 // Testing feature - The "appendData(arg) method raises a
1205 // NO_MODIFICATION_ALLOWED_ERR Exception when
1206 // this node is readonly.
1208 // Testing approach - Retrieve the textual data from the the first
1209 // EntityReference node of the last child of the
1210 // second employee and attempt to append data to it.
1211 // Descendants of EntityReference nodes are readonly
1212 // nodes and therefore the desired exception should be
1213 // raised.
1215 // Semantic Requirements: 14
1217 //----------------------------------------------------------------------------
1219 [Test]
1220 public void core0022C()
1222 string computedValue = "";
1223 System.Xml.XmlNode testNode = null;
1224 System.Xml.XmlCharacterData readOnlyNode = null;
1225 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1227 testResults results = new testResults("Core0022C");
1230 results.description = "The \"appendData(arg)\" method raises a " +
1231 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1232 "node is readonly.";
1234 // Retrieve the targeted data.
1236 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1237 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1239 // Attempt to append data to a readonly node should raise an exception.
1241 try
1243 readOnlyNode.AppendData("002");
1245 catch(ArgumentException ex)
1247 computedValue = ex.GetType ().FullName;
1250 catch(System.Exception ex)
1252 computedValue = "Exception " + ex.Message;
1255 results.expected = expectedValue;
1256 results.actual = computedValue;
1258 util.resetData();
1260 AssertEquals (results.expected, results.actual);
1263 //------------------------ End test case core-0022C --------------------------
1265 //--------------------------- test case core-0023C ---------------------------
1267 // Testing feature - The "insertData(offset,arg) method raises a
1268 // NO_MODIFICATION_ALLOWED_ERR Exception when
1269 // this node is readonly.
1271 // Testing approach - Retrieve the Text data of the first EntityReference
1272 // node from the last child of the second employee and
1273 // attempt to insert data into it. Since the descendants
1274 // of EntityReference nodes are readonly, the desired
1275 // exception should be raised.
1277 // Semantic Requirements: 15
1279 //----------------------------------------------------------------------------
1281 [Test]
1282 public void core0023C()
1284 string computedValue = "";
1285 System.Xml.XmlNode testNode = null;
1286 System.Xml.XmlCharacterData readOnlyNode = null;
1287 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1289 testResults results = new testResults("Core0023C");
1292 results.description = "The \"insertData(offset,arg)\" method raises a " +
1293 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1294 "node is readonly.";
1296 // Retrieve the targeted data
1298 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1299 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1301 // Attempt to insert data into a readonly node should raise an exception.
1303 try
1305 readOnlyNode.InsertData(2,"ABCD");
1307 catch(ArgumentException ex)
1309 computedValue = ex.GetType ().FullName;
1312 catch(System.Exception ex)
1314 computedValue = "Exception " + ex.Message;
1317 results.expected = expectedValue;
1318 results.actual = computedValue;
1320 util.resetData();
1322 AssertEquals (results.expected, results.actual);
1325 //------------------------ End test case core-0023C --------------------------
1327 //--------------------------- test case core-0024C ---------------------------
1329 // Testing feature - The "deleteData(offset,count) method raises a
1330 // NO_MODIFICATION_ALLOWED_ERR Exception when
1331 // ths is readonly.
1333 // Testing approach - Retrieve the textual data of the the first
1334 // EntityReference node from the last child of the
1335 // second employee and attempt to delete data from it.
1336 // Since the descendants of EntityReference nodes are
1337 // readonly, the desired exception should be raised.
1339 // Semantic Requirements: 16
1341 //----------------------------------------------------------------------------
1343 [Test]
1344 public void core0024C()
1346 string computedValue = "";
1347 System.Xml.XmlCharacterData readOnlyNode = null;
1348 System.Xml.XmlNode testNode = null;
1349 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1351 testResults results = new testResults("Core0024C");
1354 results.description = "The \"deleteData(offset,count)\" method raises a " +
1355 "NO_MODIFICATION_ALLOWED_ERR Exception when this " +
1356 "node is readonly.";
1358 // Retrieve the targeted data.
1360 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1361 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1363 // Attempt to delete data from a readonly node should raise an
1364 // exception.
1366 try
1368 readOnlyNode.DeleteData(2,4);
1370 catch(System.Exception ex)
1372 computedValue = ex.GetType ().FullName;
1375 catch(System.Exception ex)
1377 computedValue = "Exception " + ex.Message;
1380 results.expected = expectedValue;
1381 results.actual = computedValue;
1383 util.resetData();
1385 AssertEquals (results.expected, results.actual);
1388 //------------------------ End test case core-0024C --------------------------
1390 //--------------------------- test case core-0025C ---------------------------
1392 // Testing feature - The "replaceData(offset,count,arg) method raises a
1393 // NO_MODIFICATION_ALLOWED_ERR Exception when
1394 // this node is readonly.
1396 // Testing approach - Retrieve the textual data of the first EntityReference
1397 // node from the last child of the second employee and
1398 // attempt to replace data from it. Since the descendants
1399 // of EntityReference nodes are readonly, the desired
1400 // exception should be raised.
1402 // Semantic Requirements: 17
1404 //----------------------------------------------------------------------------
1406 [Test]
1407 public void core0025C()
1409 string computedValue = "";
1410 System.Xml.XmlCharacterData readOnlyNode = null;
1411 System.Xml.XmlNode testNode = null;
1412 string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
1414 testResults results = new testResults("Core0025C");
1417 results.description = "The \"replaceData(offset,count,arg)\" method raises a " +
1418 "NO_MODIFICATION_ALLOWED_ERR Exception " +
1419 "when this node is readonly.";
1421 // Retrieve the targeted data.
1423 testNode = util.nodeObject(util.SECOND,util.SIXTH);
1424 readOnlyNode = (System.Xml.XmlCharacterData)testNode.FirstChild.FirstChild;
1426 // Attempt to replace data from a readonly node should raise an
1427 // exception.
1429 try
1431 readOnlyNode.ReplaceData(2,4,"ABCD");
1433 catch(System.Exception ex)
1435 computedValue = ex.GetType ().FullName;
1438 catch(System.Exception ex)
1440 computedValue = "Exception " + ex.Message;
1443 results.expected = expectedValue;
1444 results.actual = computedValue;
1446 util.resetData();
1448 AssertEquals (results.expected, results.actual);
1451 //------------------------ End test case core-0025C --------------------------
1453 //--------------------------- test case core-0026C ---------------------------
1455 // Testing feature - The "substringData(offset,count)" method raises an
1456 // INDEX_SIZE_ERR Exception if the specified offset is
1457 // negative.
1459 // Testing approach - Retrieve the character data of the last child of the
1460 // of the first employee and invoke its
1461 // "substringData(offset,count)" method with offset = -5
1462 // count = 3. It should raise the desired exception since
1463 // the offset is negative.
1465 // Semantic Requirements: 19
1467 //----------------------------------------------------------------------------
1469 [Test]
1470 public void core0026C()
1472 string computedValue = "";
1473 string returnedValue = "";
1474 System.Xml.XmlNode testNode = null;
1475 System.Xml.XmlCharacterData testNodeData = null;
1476 string expectedValue = "System.ArgumentOutOfRangeException";//util.INDEX_SIZE_ERR;
1478 testResults results = new testResults("Core0026C");
1481 results.description = "The \"substringData(offset,count)\" method raises an " +
1482 "INDEX_SIZE_ERR Exception if the specified " +
1483 "offset is negative.";
1485 // Retrieve the targeted data.
1487 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1488 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1490 // A negative offset value should raise and exception.
1492 try
1494 returnedValue = testNodeData.Substring(-5,3);
1496 catch(System.Exception ex)
1498 computedValue = ex.GetType ().FullName;
1501 catch(System.Exception ex)
1503 computedValue = "Exception " + ex.Message;
1506 results.expected = expectedValue;
1507 results.actual = computedValue;
1509 AssertEquals (results.expected, results.actual);
1512 //------------------------ End test case core-0026C --------------------------
1514 //--------------------------- test case core-0027C ---------------------------
1516 // Testing feature - The "substringData(offset,count)" method raises an
1517 // INDEX_SIZE_ERR Exception if the specified offset is
1518 // greater than the number of 16-bit units in the "data"
1519 // attribute.
1521 // Testing approach - Retrieve the character data of the last child of the
1522 // first employee and invoke its
1523 // "substringData(offset,count)" method with offset = 40 and
1524 // count = 3. The value of the offset is greater than that
1525 // one of the "data" attribute, therefore the desired
1526 // exception should be raised.
1528 // Semantic Requirements: 20
1530 //----------------------------------------------------------------------------
1532 [Test]
1533 public void core0027C()
1535 string computedValue = "";
1536 string returnedValue = "";
1537 System.Xml.XmlNode testNode = null;
1538 System.Xml.XmlCharacterData testNodeData = null;
1539 string expectedValue = "System.ArgumentOutOfRangeException";
1541 testResults results = new testResults("Core0027C");
1544 results.description = "The \"substringData(offset,count)\" method raises an " +
1545 "ArgumentOutOfRangeException Exception if the specified " +
1546 "offset is greater than the number of 16-bit units " +
1547 "in the \"data\" attribute.";
1549 // Retrieve the targeted data.
1551 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1552 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1554 // Offset greater than number of characters in data should raise an
1555 // exception.
1557 try
1559 returnedValue = testNodeData.Substring(40,3);
1561 catch(System.Exception ex)
1563 computedValue = ex.GetType().ToString();
1566 catch(System.Exception ex)
1568 computedValue = "Exception " + ex.Message;
1570 results.expected = expectedValue;
1571 results.actual = computedValue;
1573 AssertEquals (results.expected, results.actual);
1576 //------------------------ End test case core-0027C --------------------------
1578 //--------------------------- test case core-0028C ---------------------------
1580 // Testing feature - The "substringData(offset,count)" method raises an
1581 // INDEX_SIZE_ERR Exception if the count is negative
1583 // Testing approach - Retrieve the character data of the last child of the
1584 // first employee and invoke its
1585 // "substringData(offset,count)" method with offset = 10
1586 // and count = -3. Since the value of count is negative,
1587 // the desired exception should be raised.
1589 // Semantic Requirements: 21
1591 //----------------------------------------------------------------------------
1593 [Test]
1594 public void core0028C()
1596 string computedValue = "";
1597 string returnedValue = "";
1598 System.Xml.XmlNode testNode = null;
1599 System.Xml.XmlCharacterData testNodeData = null;
1600 string expectedValue = "System.ArgumentOutOfRangeException";
1602 testResults results = new testResults("Core0028C");
1605 results.description = "The \"substringData(offset,count)\" method raises an " +
1606 "INDEX_SIZE_ERR Exception if the count is negative.";
1608 // Retrieve the targeted data.
1610 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1611 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1613 // A negative value for "count" should raise an exception.
1615 try
1617 returnedValue = testNodeData.Substring(10,-3);
1619 catch(System.Exception ex)
1621 computedValue = ex.GetType().ToString();
1624 catch(System.Exception ex)
1626 computedValue = "Exception " + ex.Message;
1628 results.expected = expectedValue;
1629 results.actual = computedValue;
1631 AssertEquals (results.expected, results.actual);
1634 //------------------------ End test case core-0028C --------------------------
1636 //--------------------------- test case core-0029C ---------------------------
1638 // Testing feature - The "deleteData(offset,count)" method raises an
1639 // ArgumentOutOfRangeException if the specified offset is
1640 // negative.
1642 // Testing approach - Retrieve the character data of the last child of the
1643 // first employee and invoke its "deleteData(offset,count)"
1644 // method with offset = -5 and count = 3. The value of the
1645 // offset is negative and therefore the desired exception
1646 // should be raised.
1648 // Semantic Requirements: 22
1650 //----------------------------------------------------------------------------
1652 [Test]
1653 public void core0029C()
1655 string computedValue = "";
1656 System.Xml.XmlNode testNode = null;
1657 System.Xml.XmlCharacterData testNodeData = null;
1658 string expectedValue = "System.ArgumentOutOfRangeException";
1660 testResults results = new testResults("Core0029C");
1663 results.description = "The \"deleteData(offset,count)\" method raises an " +
1664 "ArgumentOutOfRangeException if the specified " +
1665 "offset is negative.";
1667 // Retrieve the targeted data.
1669 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1670 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1672 // Invoke "deleteData(offset,count)" method with negative offset should
1673 // should raise an excetion.
1675 try
1677 testNodeData.DeleteData(-5,3);
1679 catch(System.Exception ex)
1681 computedValue = ex.GetType().ToString();
1684 catch(System.Exception ex)
1686 computedValue = "Exception " + ex.Message;
1688 results.expected = expectedValue;
1689 results.actual = computedValue;
1691 util.resetData();
1693 AssertEquals (results.expected, results.actual);
1696 //------------------------ End test case core-0029C --------------------------
1698 //--------------------------- test case core-0030C ---------------------------
1700 // Testing feature - The "deleteData(offset,count)" method raises an
1701 // ArgumentOutOfRangeException if the specified offset is
1702 // greater than the number of characters in the "data"
1703 // attribute.
1705 // Testing approach - Retrieve the character data of the last child of the
1706 // first employee and invoke its "deleteData(offset,count)"
1707 // method with offset = 40 and count = 3. The value of the
1708 // offset is greater than the number of characters in the
1709 // "data" attribute (35) and therefore the intended
1710 // exception should be raised.
1712 // Semantic Requirements: 23
1714 //----------------------------------------------------------------------------
1716 [Test]
1717 public void core0030C()
1719 string computedValue = "";
1720 System.Xml.XmlNode testNode = null;
1721 System.Xml.XmlCharacterData testNodeData = null;
1722 string expectedValue = "System.ArgumentOutOfRangeException";
1724 testResults results = new testResults("Core0030C");
1727 results.description = "The \"deleteData(offset,count)\" method raises an " +
1728 "ArgumentOutOfRangeException if the specified " +
1729 "offset is greater than the number of characters " +
1730 "in the \"data\" attribute.";
1732 // Retrieve the targeted data.
1734 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1735 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1737 // Invocation of "deleteData(offset,count)" method with offset > data
1738 // attribute should raise and exception.
1740 try
1742 testNodeData.DeleteData(40,3);
1744 catch(System.Exception ex)
1746 computedValue = ex.GetType().ToString();
1749 catch(System.Exception ex)
1751 computedValue = "Exception " + ex.Message;
1754 results.expected = expectedValue;
1755 results.actual = computedValue;
1757 util.resetData();
1759 AssertEquals (results.expected, results.actual);
1762 //------------------------ End test case core-0030C --------------------------
1764 //--------------------------- test case core-0031C ---------------------------
1766 // Testing feature - The "deleteData(offset,count)" method raises an
1767 // ArgumentOutOfRangeException if the specified count is
1768 // negative.
1770 // Testing approach - Retrieve the character data of the last child of the
1771 // first employee and invoke its "deleteData(offset,count)"
1772 // method with offset = 10 and count = -3. The value
1773 // of the specified count is negative and therefore the
1774 // intended exception should be raised.
1776 // Semantic Requirements: 24
1778 //----------------------------------------------------------------------------
1780 [Test]
1781 public void core0031C()
1783 string computedValue = "";
1784 System.Xml.XmlNode testNode = null;
1785 System.Xml.XmlCharacterData testNodeData = null;
1786 string expectedValue = "System.ArgumentOutOfRangeException";
1788 testResults results = new testResults("Core0031C");
1791 results.description = "The \"deleteData(offset,count)\" method raises an " +
1792 "ArgumentOutOfRangeException if the specified " +
1793 "count is negative.";
1795 // Retrieve the targeted data.
1797 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1798 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1800 // Invocation of "deleteData(offset,count)" method with count < 0
1801 // should raise and exception.
1803 try
1805 testNodeData.DeleteData(10,-3);
1807 catch(System.Exception ex)
1809 computedValue = ex.GetType().ToString();
1812 catch(System.Exception ex)
1814 computedValue = "Exception " + ex.Message;
1817 results.expected = expectedValue;
1818 results.actual = computedValue;
1820 util.resetData();
1822 AssertEquals (results.expected, results.actual);
1825 //------------------------ End test case core-0031C --------------------------
1827 //--------------------------- test case core-0032C ---------------------------
1829 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1830 // ArgumentOutOfRangeException if the specified offset is
1831 // negative.
1833 // Testing approach - Retrieve the character data of the last child of the
1834 // first employee and invoke its
1835 // "replaceData(offset,count,arg)" method with
1836 // offset = -5 and count = 3 and arg = "ABC". The value
1837 // of the offset is negative and therefore the desired
1838 // exception should be raised.
1840 // Semantic Requirements: 25
1842 //----------------------------------------------------------------------------
1844 [Test]
1845 public void core0032C()
1847 string computedValue = "";
1848 System.Xml.XmlNode testNode = null;
1849 System.Xml.XmlCharacterData testNodeData = null;
1850 string expectedValue = "System.ArgumentOutOfRangeException";
1852 testResults results = new testResults("Core0032C");
1855 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1856 "ArgumentOutOfRangeException if the specified " +
1857 "offset is negative.";
1859 // Retrieve the targeted data.
1861 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1862 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1864 // Invocation of "replaceData(offset,count,arg)" method offset < 0
1865 // should raise an exception.
1867 try
1869 testNodeData.ReplaceData(-5,3,"ABC");
1871 catch(System.Exception ex)
1873 computedValue = ex.GetType().ToString();
1876 catch(System.Exception ex)
1878 computedValue = "Exception " + ex.Message;
1881 results.expected = expectedValue;
1882 results.actual = computedValue;
1884 util.resetData();
1886 AssertEquals (results.expected, results.actual);
1889 //------------------------ End test case core-0032C --------------------------
1891 //--------------------------- test case core-0033C ---------------------------
1893 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1894 // INDEX_RANGE_ERR Exception if the specified offset is
1895 // greater than the number of 16-bit units in the "data"
1896 // attribute.
1898 // Testing approach - Retrieve the character data of the last child of the
1899 // first employee and invoke its
1900 // "replaceData(offset,count,arg)" method with offset = 40,
1901 // count = 3 and arg = "ABC". The value of the offset is
1902 // greater than the number of characters in the "data"
1903 // attribute (35) and therefore the intended exception
1904 // should be raised.
1906 // Semantic Requirements: 26
1908 //----------------------------------------------------------------------------
1910 [Test]
1911 public void core0033C()
1913 string computedValue = "";
1914 System.Xml.XmlNode testNode = null;
1915 System.Xml.XmlCharacterData testNodeData = null;
1916 string expectedValue = "System.ArgumentOutOfRangeException";
1918 testResults results = new testResults("Core0033C");
1921 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1922 "ArgumentOutOfRangeException if the specified " +
1923 "offset is greater than the number of 16-bit units " +
1924 "in the \"data\" attribute.";
1926 // Retrieve the targeted data.
1928 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1929 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1931 // Invocation of "replaceData(offset,count,arg)" method with offset > data
1932 // attribute should raise and exception.
1934 try
1936 testNodeData.ReplaceData(40,3,"ABC");
1938 catch(System.Exception ex)
1940 computedValue = ex.GetType().ToString();
1943 catch(System.Exception ex)
1945 computedValue = "Exception " + ex.Message;
1948 results.expected = expectedValue;
1949 results.actual = computedValue;
1951 util.resetData();
1953 AssertEquals (results.expected, results.actual);
1956 //------------------------ End test case core-0033C --------------------------
1958 //--------------------------- test case core-0034C ---------------------------
1960 // Testing feature - The "replaceData(offset,count,arg)" method raises an
1961 // ArgumentOutOfRangeException if the specified count is
1962 // negative.
1964 // Testing approach - Retrieve the character data of the last child of the
1965 // first employee and invoke its
1966 // "replaceData(offset,count,arg)" method with offset = 10,
1967 // count = -3 and arg = "ABC". The value of the specified
1968 // count is negative and therefore the intended exception
1969 // should be raised.
1971 // Semantic Requirements: 27
1973 //----------------------------------------------------------------------------
1975 [Test]
1976 public void core0034C()
1978 string computedValue = "";
1979 System.Xml.XmlNode testNode = null;
1980 System.Xml.XmlCharacterData testNodeData = null;
1981 string expectedValue = "System.ArgumentOutOfRangeException";
1983 testResults results = new testResults("Core0034C");
1986 results.description = "The \"replaceData(offset,count,arg)\" method raises an " +
1987 "ArgumentOutOfRangeException if the specified " +
1988 "count is negative.";
1990 // Retrieve the targeted data.
1992 testNode = util.nodeObject(util.FIRST,util.SIXTH);
1993 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
1995 // Invocation of "replaceData(offset,count,arg)" method with count < 0
1996 // should raise an exception.
1998 try
2000 testNodeData.ReplaceData(10,-3,"ABC");
2002 catch(System.Exception ex)
2004 computedValue = ex.GetType().ToString();
2007 catch(System.Exception ex)
2009 computedValue = "Exception " + ex.Message;
2012 results.expected = expectedValue;
2013 results.actual = computedValue;
2015 util.resetData();
2017 AssertEquals (results.expected, results.actual);
2020 //------------------------ End test case core-0034C --------------------------
2022 //--------------------------- test case core-0035C ---------------------------
2024 // Testing feature - The "insertData(offset,arg)" method raises an
2025 // ArgumentOutOfRangeException if the specified offset is
2026 // negative.
2028 // Testing approach - Retrieve the character data from the last child of the
2029 // first employee and invoke its "insertData(offset,arg)"
2030 // method with offset = -5 arg = "ABC". The value
2031 // of the offset is negative and therefore the desired
2032 // exception should be raised.
2034 // Semantic Requirements: 28
2036 //----------------------------------------------------------------------------
2038 [Test]
2039 public void core0035C()
2041 string computedValue = "";
2042 System.Xml.XmlNode testNode = null;
2043 System.Xml.XmlCharacterData testNodeData = null;
2044 string expectedValue = "System.ArgumentOutOfRangeException";
2046 testResults results = new testResults("Core0035C");
2049 results.description = "The \"insertData(offset,arg)\" method raises an " +
2050 "ArgumentOutOfRangeException if the specified offset is negative.";
2052 // Retrieve the targeted data.
2054 testNode = util.nodeObject(util.FIRST,util.SIXTH);
2055 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
2057 // Invocation of insertData(offset,arg)" method with offset < 0
2058 // should raise an exception.
2060 try
2062 testNodeData.InsertData(-5,"ABC");
2064 catch(System.Exception ex)
2066 computedValue = ex.GetType().ToString();
2069 catch(System.Exception ex)
2071 computedValue = "Exception " + ex.Message;
2074 results.expected = expectedValue;
2075 results.actual = computedValue;
2077 util.resetData();
2079 AssertEquals (results.expected, results.actual);
2082 //------------------------ End test case core-0035C --------------------------
2084 //--------------------------- test case core-0036C ---------------------------
2086 // Testing feature - The "insertData(offset,arg)" method raises an
2087 // ArgumentOutOfRangeException if the specified offset is
2088 // greater than the number of 16-bit units in the "data"
2089 // attribute.
2091 // Testing approach - Retrieve the character data from the last child of the
2092 // first employee and invoke its "insertData(offset,arg)"
2093 // method with offset = 40 and arg = "ABC". The value of
2094 // the offset is greater than the number of characters in
2095 // the "data" attribute(35) and therefore the intended
2096 // exception should be raised.
2098 // Semantic Requirements: 29
2100 //----------------------------------------------------------------------------
2102 [Test]
2103 public void core0036C()
2105 string computedValue = "";
2106 System.Xml.XmlNode testNode = null;
2107 System.Xml.XmlCharacterData testNodeData = null;
2108 string expectedValue = "System.ArgumentOutOfRangeException";
2110 testResults results = new testResults("Core0036C");
2113 results.description = "The \"insertData(offset,arg)\" method raises an " +
2114 "ArgumentOutOfRangeException if the specified " +
2115 "offset is greater than the number of 16-bit units " +
2116 "in the \"data\" attribute.<br>";
2118 // Retrieve the targeted data.
2120 testNode = util.nodeObject(util.FIRST,util.SIXTH);
2121 testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild;
2123 // Invocation of "insertData(offset arg)" method with offset > data
2124 // attribute should raise an exception.
2126 try
2128 testNodeData.InsertData(40,"ABC");
2130 catch(System.Exception ex)
2132 computedValue = ex.GetType().ToString();
2135 catch(System.Exception ex)
2137 computedValue = "Exception " + ex.Message;
2140 results.expected = expectedValue;
2141 results.actual = computedValue;
2143 util.resetData();
2145 AssertEquals (results.expected, results.actual);
2148 //------------------------ End test case core-0036C --------------------------