2010-07-25 Carlos Alberto Cortez <calberto.cortez@gmail.com>
[mono.git] / mcs / class / System.XML / Test / System.Xml / nist_dom / fundamental / Attr / Attr.cs
1 //**************************************************************************
2 //
3 //
4 //                       National Institute Of Standards and Technology
5 //                                     DTS Version 1.0
6 //         
7 //                                   Attr Interface
8 //
9 // Written by: Carmelo Montanez
10 //
11 // Ported to System.Xml by: Mizrahi Rafael rafim@mainsoft.com
12 // Mainsoft Corporation (c) 2003-2004
13 //
14 //**************************************************************************
15 using System;\r
16 using System.Xml;\r
17 using nist_dom;
18 using NUnit.Framework;\r
19 \r
20 namespace nist_dom.fundamental\r
21 {
22     [TestFixture]\r
23     public class AttrTest//, ITest\r
24     {\r
25         public static int i = 1;\r
26 /*\r
27         public testResults[] RunTests()\r
28         {\r
29             testResults[] tests = new testResults[] {core0001A(), core0002A(), core0003A(),core0004A(),
30                                                         core0005A(), core0006A(), core0007A(), core0008A(),
31                                                         core0009A(), core0010A(), core0011A(), core0012A(),
32                                                         core0013A(), core0014A()};\r
33   \r
34             return tests;\r
35         }
36 */
37         //------------------------ test case core-0001A ------------------------
38         //
39         // Testing feature - The parentNode attribute for an Attr object should 
40         //                   be null.
41         //
42         // Testing approach - Retrieve the attribute named "domestic" from the last 
43         //                    child of of the first employee and examine its 
44         //                    parentNode attribute.  This test uses the 
45         //                    "GetNamedItem(name)" method from the NamedNodeMap 
46         //                    interface.
47         //
48         // Semantic Requirements: 1
49         //
50         //----------------------------------------------------------------------------
51
52         [Test]
53         public void core0001A()
54         {
55             object computedValue = null;
56             object expectedValue = null; 
57             System.Xml.XmlNode testNode = null;
58             System.Xml.XmlAttribute domesticAttr = null;
59
60             testResults results = new testResults("Core0001A");
61
62             try
63             {
64                 results.description = "The ParentNode attribute should be null for" +
65                     " an Attr object.";
66                 //
67                 //   Retrieve targeted data and examine parentNode attribute.
68                 //
69                 testNode = util.nodeObject(util.FIRST, util.SIXTH);
70                 domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");
71                 computedValue = domesticAttr.ParentNode;
72                 //
73                 //    Write out results 
74                 //
75             }
76             catch(System.Exception ex)\r
77             {
78                 computedValue = "Exception " + ex.Message;
79             }
80
81             results.expected = (expectedValue == null).ToString();
82             results.actual = (computedValue == null).ToString();
83             Assert.AreEqual (results.expected, results.actual);
84             // return results;
85
86         }
87
88         //------------------------ End test case core-0001A --------------------------
89         //
90         //-------------------------  test case core-0002A ---------------------------- 
91         //
92         //         
93         // Written By: Carmelo Montanez
94         //
95         // Testing feature - The previousSibling attribute for an Attr object 
96         //                   should be null. 
97         //
98         // Testing approach - Retrieve the attribute named "domestic" from the last 
99         //                    child of of the first employee and examine its 
100         //                    previousSibling attribute.  This test uses the 
101         //                    "GetNamedItem(name)" method from the NamedNodeMap 
102         //                    interface.
103         //
104         // Semantic Requirements: 1
105         //
106         //----------------------------------------------------------------------------
107
108         [Test]
109         public void core0002A()
110         {
111             object computedValue = null;
112             object expectedValue = null;
113             System.Xml.XmlAttribute domesticAttr = null;
114             System.Xml.XmlNode testNode = null;
115
116             testResults results = new testResults("Core0002A");
117             try
118             {
119                 results.description =  "The previousSibling attribute should be " +
120                     "null for an Attr object.";
121                 //
122                 // Retrieve the targeted data and examine its previousSibling attribute.
123                 //
124                 testNode = util.nodeObject(util.FIRST,util.SIXTH);
125                 domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");
126                 computedValue = domesticAttr.PreviousSibling;
127             }
128             catch(System.Exception ex)\r
129             {
130                 computedValue = "Exception " + ex.Message;
131             }
132             //
133             // Write out results 
134             //
135             results.expected = (expectedValue == null).ToString();
136             results.actual = (computedValue == null).ToString();
137
138             Assert.AreEqual (results.expected, results.actual);
139             // return results;
140         }
141
142         //------------------------ End test case core-0002A --------------------------
143         //
144         //-------------------------  test case core-0003A ----------------------------
145         // Written By: Carmelo Montanez
146         //
147         // Testing feature - The nextSibling attribute for an Attr object should 
148         //                   be null. 
149         //
150         // Testing approach - Retrieve the attribute named "domestic" from the 
151         //                    last child of of the first employee and examine 
152         //                    its nextSibling attribute.  This test uses the 
153         //                    "GetNamedItem(name)" method from the NamedNodeMap 
154         //                    interface.
155         //                      
156         // Semantic Requirements: 1
157         //
158         //----------------------------------------------------------------------------
159
160         [Test]
161         public void core0003A()
162         {
163             object computedValue = null;
164             object expectedValue = null;
165             System.Xml.XmlAttribute domesticAttr = null;
166             System.Xml.XmlNode testNode = null;
167
168             testResults results = new testResults("Core0003A");
169             try
170             {
171                 results.description =  "The nextSibling attribute should be null " +
172                     "for an Attr object.";
173                 //
174                 // Retrieve the targeted data and examine its nextSibling attribute.
175                 //
176                 testNode = util.nodeObject(util.FIRST,util.SIXTH); 
177                 domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");
178                 computedValue = domesticAttr.NextSibling;
179             }
180             catch(System.Exception ex)\r
181             {
182                 computedValue = "Exception " + ex.Message;
183             }
184             //
185             // Write out results 
186             //
187             results.expected = (expectedValue == null).ToString();
188             results.actual = (computedValue == null).ToString();
189
190             Assert.AreEqual (results.expected, results.actual);
191             // return results;
192         }
193
194         //------------------------ End test case core-0003A --------------------------
195         //
196         //-------------------------  test case core-0004A ----------------------------
197         //
198         // Written By: Carmelo Montanez
199         //
200         // Testing feature - Attr objects may be associated with Element nodes 
201         //                   contained within a DocumentFragment.
202         //
203         // Testing approach - Create a new DocumentFragment object and add a newly
204         //                    created Element node to it (with one attribute).  Once
205         //                    the element is added, its attribute should be available
206         //                    as an attribute associated with an Element within a 
207         //                    DocumentFragment.
208         //
209         // Semantic Requirements: 2
210         //
211         //----------------------------------------------------------------------------
212
213         [Test]
214         public void core0004A()
215         {
216             string computedValue = "";
217             string expectedValue = "domestic";
218             System.Xml.XmlAttribute domesticAttr = null;
219
220             testResults results = new testResults("Core0004A");
221             try
222             {
223                 results.description = "Attr objects may be associated with Element " +
224                     "nodes contained within a DocumentFragment.";
225
226                 System.Xml.XmlDocumentFragment docFragment = util.getDOMDocument().CreateDocumentFragment();
227                 System.Xml.XmlElement newElement = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"element1");
228                 //
229                 // The new DocumentFragment is empty upon creation.  Set an attribute for 
230                 // a newly created element and add the element to the documentFragment.  
231                 //
232                 newElement.SetAttribute("domestic","Yes");
233                 docFragment.AppendChild(newElement);
234                 //
235                 // Access the attributes of the only child of the documentFragment
236                 //
237                 domesticAttr = (System.Xml.XmlAttribute)docFragment.FirstChild.Attributes.Item(0) ;
238                 computedValue = domesticAttr.Name;
239             }
240             catch(System.Exception ex)\r
241             {
242                 computedValue = "Exception " + ex.Message;
243             }
244             //
245             //  Write out results 
246             //
247             results.expected = expectedValue;
248             results.actual = computedValue;
249
250             util.resetData();
251             Assert.AreEqual (results.expected, results.actual);
252             // return results;
253         }
254
255         //------------------------ End test case core-0004A --------------------------
256         //
257         //-------------------------- test case core-0005A ----------------------------
258         //
259         // Testing feature - If an Attr is explicitly assigned any value, then that 
260         //                   value is the attribute's effective value. 
261         //
262         // Testing approach - Retrieve the attribute name "domestic" from  the last 
263         //                    child of of the first employee element and examine its 
264         //                    assigned value.  This test uses the
265         //                    "GetNamedItem(name)" method from the NamedNodeMap
266         //                    interface.
267         //
268         // Semantic Requirements: 3
269         //
270         //----------------------------------------------------------------------------
271
272         [Test]
273         public void core0005A()
274         {
275             string computedValue = "";
276             string expectedValue = "Yes";
277             System.Xml.XmlAttribute domesticAttr = null;
278             System.Xml.XmlNode testNode = null;
279
280             testResults results = new testResults("Core0005A");
281             try
282             {
283                 results.description = "If an attribute is explicitly assigned any value, " +
284                     "then that value is the attribute's effective value."; 
285                 //
286                 //  Retrieve the targeted data and examine its assigned value.
287                 //
288                 testNode = util.nodeObject(util.FIRST,util.SIXTH);
289                 domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");
290                 computedValue = domesticAttr.Value;
291             }
292             catch(System.Exception ex)\r
293             {
294                 computedValue = "Exception " + ex.Message;
295             }
296             //
297             // Write out results
298             //
299             results.expected = expectedValue;
300             results.actual = computedValue;
301
302             Assert.AreEqual (results.expected, results.actual);
303             // return results;
304         }
305
306         //------------------------ End test case core-0005A --------------------------
307         //
308         //-------------------------- test case core-0006A ----------------------------
309         //
310         // Testing feature - If there is no explicit value assigned to an attribute 
311         //                   and there is a declaration for this attribute and that 
312         //                   declaration includes a default value, then that default 
313         //                   value is the Attribute's default value. 
314         //
315         // Testing approach - Retrieve the attribute named "street" from the 
316         //                    last child of of the first employee and examine its
317         //                    value.  That value should be the value given during 
318         //                    the declaration of the attribute in the DTD file.
319         //                    This test uses the "GetNamedItem(name)" method from 
320         //                    the NamedNodeMap interface.
321         //
322         // Semantic Requirements: 4 
323         //
324         //----------------------------------------------------------------------------
325
326         [Test]
327 #if NET_2_0
328         [Category ("NotDotNet")]
329 #endif
330         public void core0006A()
331         {
332             string computedValue = "";
333             string expectedValue = "Yes";
334             System.Xml.XmlAttribute streetAttr = null;
335             System.Xml.XmlNode testNode = null;
336
337             testResults results = new testResults("Core0006A");
338             try
339             {
340                 results.description = "If there is no explicit value assigned to an " +
341                     "attribute and there is a declaration for this " +
342                     "attribute and  that declaration includes a default " +
343                     "value, then that default value is the Attribute's " +
344                     "default value.";
345                 //
346                 // Retrieve the targeted data and examine its default value.
347                 //
348                 testNode = util.nodeObject(util.FIRST,util.SIXTH);
349                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
350                 computedValue = streetAttr.Value;
351             }
352             catch(System.Exception ex)\r
353             {
354                 computedValue = "Exception " + ex.Message;
355             }
356             //
357             // Write out results
358             //
359             results.expected = expectedValue;
360             results.actual = computedValue;
361
362             Assert.AreEqual (results.expected, results.actual);
363             // return results;
364         }
365
366         //------------------------ End test case core-0006A --------------------------
367         //
368         //--------------------------  test case core-0007A ---------------------------
369         //
370         // Testing feature - The "name" Attribute of an Attribute node. 
371         //
372         // Testing approach - Retrieve the attribute named "street" from the
373         //                    last child of the second employee and examine its "name" 
374         //                    attribute.  This test uses the "GetNamedItem(name)" 
375         //                    method from the NamedNodeMap interface.
376         //
377         // Semantic Requirements: 5 
378         //
379         //----------------------------------------------------------------------------
380
381         [Test]
382         public void core0007A()
383         {
384             string computedValue = "";
385             string expectedValue = "street";
386             System.Xml.XmlAttribute streetAttr = null;
387             System.Xml.XmlNode testNode = null;
388
389             testResults results = new testResults("Core0007A");
390             try
391             {
392                 results.description = "The \"name\" attribute of an Attr object contains " +
393                     "the name of that attribute.";
394                 //
395                 // Retrieve the targeted data and capture its assigned name.
396                 //
397                 testNode = util.nodeObject(util.SECOND,util.SIXTH);
398                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
399                 computedValue = streetAttr.Name;
400             }
401             catch(System.Exception ex)\r
402             {
403                 computedValue = "Exception " + ex.Message;
404             }
405             //
406             // Write out results
407             //
408             results.expected = expectedValue;
409             results.actual = computedValue;
410
411             Assert.AreEqual (results.expected, results.actual);
412             // return results;
413         }
414
415         //------------------------ End test case core-0007A --------------------------
416         //
417         //--------------------------  test case core-0008A ---------------------------
418         //
419         // Testing feature - The "specified" attribute of an Attr node should be set 
420         //                   to true if the attribute was explicitly given a value. 
421         //
422         // Testing approach - Retrieve the attribute named "doestic" from the last
423         //                    child of the first employee and examine its "specified"
424         //                    attribute.  It should be set to true.  This test
425         //                    uses the "GetNamedItem(name)" method from the 
426         //                    NamedNodeMap interface.
427         //
428         // Semantic Requirements: 6 
429         //
430         //----------------------------------------------------------------------------
431
432         [Test]
433         public void core0008A()
434         {
435             string computedValue = "";//0;
436             string expectedValue = "True";
437             System.Xml.XmlNode testNode = null;
438             System.Xml.XmlAttribute domesticAttr = null;
439
440             testResults results = new testResults("Core0008A");
441             try
442             {
443                 results.description = "The \"specified\" attribute for an Attr object " +
444                     "should be set to true if the attribute was " + 
445                     "explictly given a value.";
446                 //
447                 // Retrieve the targeted data and capture its "specified" value.
448                 //
449                 testNode = util.nodeObject(util.FIRST,util.SIXTH);
450                 domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");;
451                 computedValue = domesticAttr.Specified.ToString();
452             }
453             catch(System.Exception ex)\r
454             {
455                 computedValue = "Exception " + ex.Message;
456             }
457             //
458             // Write out results
459             //
460             results.expected = expectedValue;
461             results.actual = computedValue;
462
463             Assert.AreEqual (results.expected, results.actual);
464             // return results;
465         }
466
467         //------------------------ End test case core-0008A --------------------------
468         //
469         //--------------------------  test case core-0009A ---------------------------
470         //
471         // Testing feature - The "specified" attribute for an Attr node should be
472         //                   set to false if the attribute was not explicitly given
473         //                   a value.
474         //
475         // Testing approach - Retrieve the attribute named "street"(not explicity
476         //                    given a value) from the last child of the first employee  
477         //                    and examine its "specified" attribute.  It should be 
478         //                    set to false.  This test uses the
479         //                    "GetNamedItem(name)" method from the NamedNodeMap
480         //                    interface.
481         //
482         // Semantic Requirements: 6 
483         //
484         //----------------------------------------------------------------------------
485
486         [Test]
487         public void core0009A()
488         {
489             string computedValue = "";//0;
490             string expectedValue = "False";
491             System.Xml.XmlAttribute streetAttr = null;
492             System.Xml.XmlNode testNode = null;
493
494             testResults results = new testResults("Core0009A");
495             try
496             {
497                 results.description = "The \"specified\" attribute for an Attr node " +
498                     "should be set to false if the attribute was " +
499                     "not explictly given a value.";
500                 //
501                 // Retrieve the targeted data and capture its "specified" attribute.
502                 //
503                 testNode = util.nodeObject(util.FIRST,util.SIXTH);
504                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
505                 computedValue = streetAttr.Specified.ToString();
506             }
507             catch(System.Exception ex)\r
508             {
509                 computedValue = "Exception " + ex.Message;
510             }
511             //
512             // Write out results
513             //
514             results.expected = expectedValue;
515             results.actual = computedValue;
516
517             Assert.AreEqual (results.expected, results.actual);
518             // return results;
519         }
520
521         //------------------------ End test case core-0009A --------------------------
522         //
523         //--------------------------  test case core-0010A ---------------------------
524         //
525         // Testing feature - The "specified" attribute for an Attr node should be
526         //                   automatically flipped to true if value of the attribute 
527         //                   is changed (even its ends up having a default DTD value)
528         //
529         // Testing approach - Retrieve the attribute named "street" from the last
530         //                    child of the third employee and change its value to "Yes"
531         //                    (which is its default DTD value).  This should cause the
532         //                    "specified" attribute to be flipped to true.  This test
533         //                    makes use of the "setAttribute(name,value )" method from
534         //                    the Element interface and the "GetNamedItem(name)" 
535         //                    method from the NamedNodeMap interface.
536         //
537         // Semantic Requirements: 7 
538         //
539         //----------------------------------------------------------------------------
540
541         [Test]
542         public void core0010A()
543         {
544             string computedValue = "";//"";
545             string expectedValue = "True";
546             System.Xml.XmlAttribute streetAttr = null;
547             System.Xml.XmlElement testNode = null;
548
549             testResults results = new testResults("Core0010A");
550             try
551             {
552                 results.description = "The \"specified\" attribute for an Attr node " +
553                     "should be flipped to true if the attribute value " + 
554                     "is changed (even it changed to its default value).";
555                 //
556                 // Retrieve the targeted data and set a new attribute for it, then 
557                 // capture its "specified" attribute.
558                 //
559                 testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.FIFTH);
560                 testNode.SetAttribute("street","Yes");//testNode.node.setAttribute("street","Yes");
561                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
562                 computedValue = streetAttr.Specified.ToString();
563             }
564             catch(System.Exception ex)\r
565             {
566                 computedValue = "Exception " + ex.Message;
567             }
568             //
569             // Write out results
570             //
571             results.expected = expectedValue;
572             results.actual = computedValue;
573
574             Assert.AreEqual (results.expected, results.actual);
575             // return results;
576         }
577
578         //------------------------ End test case core-0010A --------------------------
579         //
580         //--------------------------  test case core-0011A ---------------------------
581         //
582         // Testing feature - To respecify the attribute to its default value from the
583         //                   DTD, the attribute must be deleted.  The implementation
584         //                   will then make a new attribute available with the
585         //                   "specified" attribute set to false.
586
587         // Testing approach - Retrieve the attribute named "street" from the last
588         //                    child of the third employee and delete it.  The 
589         //                    implementation should then create a new attribute with 
590         //                    its default value and "specified" set to false.  This 
591         //                    test uses the "removeAttribute(name)" from the Element 
592         //                    interface and the "GetNamedItem(name)" method from the 
593         //                    NamedNodeMap interface.
594         //
595         // Semantic Requirements: 8 
596         //
597         //----------------------------------------------------------------------------
598
599         [Test]
600         public void core0011A()
601         {
602             string computedValue = "";//"";
603             string expectedValue = "False";
604             System.Xml.XmlAttribute streetAttr = null;
605             System.Xml.XmlElement testNode = null;
606
607             testResults results = new testResults("Core0011A");
608             try
609             {
610                 results.description = "Re-setting an attribute to its default value " +
611                     "requires that the attribute be deleted.  The " +
612                     "implementation should create a new attribute " +
613                     "with its \"specified\" attribute set to false.";
614                 //
615                 // Retrieve the targeted data, remove the "street" attribute and capture 
616                 // its specified attribute.
617                 //
618                 testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
619                 testNode.RemoveAttribute("street");//testNode.node.removeAttribute("street");
620                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
621                 computedValue = streetAttr.Specified.ToString();
622             }
623             catch(System.Exception ex)\r
624             {
625                 computedValue = "Exception " + ex.Message;
626             }
627             //
628             // Write out results
629             //
630             results.expected = expectedValue;
631             results.actual = computedValue;
632
633             Assert.AreEqual (results.expected, results.actual);
634             // return results;
635         }
636
637         //------------------------ End test case core-0011A --------------------------
638         //
639         //--------------------------  test case core-0012A ---------------------------
640         //
641         // Testing feature - Upon retrieval, the "value" of an attribute is returned 
642         //                   as a string with characters and general entity references 
643         //                   replaced with their values.
644
645         // Testing approach - Retrieve the attribute named "street" from the last 
646         //                    child of the fourth employee and examine its value 
647         //                    attribute.  This value should be "Yes" after the
648         //                    EntityReference is replaced with its value.   This 
649         //                    test uses the "GetNamedItem(name)" method from 
650         //                    the NamedNodeMap interface.
651         //
652         // Semantic Requirements: 9 
653         //
654         //----------------------------------------------------------------------------
655
656         [Test]
657         public void core0012A()
658         {
659             string computedValue = "";
660             string expectedValue = "Yes";
661             System.Xml.XmlAttribute streetAttr = null;
662             System.Xml.XmlNode testNode = null;
663
664             testResults results = new testResults("Core0012A");
665             try
666             {
667                 results.description = "Upon retrieval the \"value\" attribute of an Attr" +
668                     "object is returned as a string with any Entity " +
669                     "References replaced with their values.";
670                 //
671                 // Retrieve the targeted data.
672                 //
673                 testNode = util.nodeObject(util.FOURTH,util.SIXTH);
674                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
675                 computedValue = streetAttr.Value;
676             }
677             catch(System.Exception ex)\r
678             {
679                 computedValue = "Exception " + ex.Message;
680             }
681             //
682             //    Write out results
683             //
684             results.expected = expectedValue;
685             results.actual = computedValue;
686
687             Assert.AreEqual (results.expected, results.actual);
688             // return results;
689         }
690
691         //------------------------ End test case core-0012A --------------------------
692         //
693         //--------------------------  test case core-0013A ---------------------------
694         //
695         // Testing feature - On setting, the "value" attribute of an Attr node 
696         //                   creates a Text node with the unparsed content of 
697         //                   the string.
698
699         // Testing approach - Retrieve the attribute named "street" from the last 
700         //                    child of the fourth employee and assign the "Y%ent1;" 
701         //                    string to its value attribute.  This value is not yet
702         //                    parsed and therefore should still be the same upon 
703         //                    retrieval.  This test uses the "GetNamedItem(name)" 
704         //                    method from the NamedNodeMap interface.
705         //
706         // Semantic Requirements: 10
707         //
708         //----------------------------------------------------------------------------
709
710         [Test]
711         public void core0013A()
712         {
713             string computedValue = "";
714             string expectedValue = "Y%ent1;";
715             System.Xml.XmlAttribute streetAttr = null;
716             System.Xml.XmlNode testNode = null;
717
718             testResults results = new testResults("Core0013A");
719             try
720             {
721                 results.description = "On setting, the \"value\" attribute of an Attr " +
722                     "object creates a Text node with the unparsed " +
723                     "content of the string.";
724                 //
725                 // Retrieve the targeted data, assign a value to it and capture its
726                 // "value" attribute.
727                 //
728                 testNode = util.nodeObject(util.FOURTH,util.SIXTH);
729                 streetAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
730                 streetAttr.Value = "Y%ent1;"; 
731                 computedValue = streetAttr.Value;
732             }
733             catch(System.Exception ex)\r
734             {
735                 computedValue = "Exception " + ex.Message;
736             }
737             //
738             // Write out results
739             //
740             results.expected = expectedValue;
741             results.actual = computedValue;
742
743             Assert.AreEqual (results.expected, results.actual);
744             // return results;
745         }
746
747         //------------------------ End test case core-0013A --------------------------
748         //
749         //--------------------------  test case core-0014A ---------------------------
750         //
751         // Testing feature - Setting the "value" attribute raises a
752         //                   NO_MODIFICATION_ALLOWED_ERR Exception if the 
753         //                   node is readonly.
754         //
755         // Testing approach - Retrieve the first attribute of the Entity node named
756         //                    "ent4" and attempt to change its value attribute.
757         //                    Since the descendants of Entity nodes are readonly, the
758         //                    desired exception should be raised.
759         //
760         // Semantic Requirements: 11
761         //
762         //----------------------------------------------------------------------------
763
764         [Test]
765         [Category ("NotDotNet")] // MS DOM is buggy
766         public void core0014A()
767         {
768             string computedValue = "";
769             System.Xml.XmlNode testNode = null;
770             System.Xml.XmlAttribute readOnlyAttribute = null;
771             string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;
772
773             testResults results = new testResults("Core0014A");
774             try
775             {
776                 results.description =  "Setting the \"value\" attribute raises a " +
777                     "NO_MODIFICATION_ALLOWED_ERR Exception if " +
778                     "the node is readonly.";
779
780                 //
781                 // Retrieve the targeted data.
782                 //
783                 testNode = util.getEntity("ent4");
784                 readOnlyAttribute = (System.Xml.XmlAttribute)testNode.FirstChild.Attributes.Item(0);
785                 //
786                 // attempt to set a value on a readonly node should raise an exception.
787                 //
788                 try \r
789                 {
790                     readOnlyAttribute.Value = "ABCD";
791                 }
792                 catch (ArgumentException ex)\r
793                 {
794                     computedValue = ex.GetType ().FullName;
795                 }
796             }
797             catch(System.Exception ex)\r
798             {
799                 computedValue = "Exception " + ex.Message;
800             }
801             results.expected = expectedValue;
802             results.actual = computedValue;
803
804             util.resetData();
805
806             Assert.AreEqual (results.expected, results.actual);
807             // return results;
808         }
809         //------------------------ End test case core-0014A --------------------------
810     }\r
811 \r
812 }\r