public void core0001M() { string computedValue = ""; string expectedValue = "domestic"; System.Xml.XmlAttribute domesticAttr = null; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0001M"); try { results.description = "The \"getNamedItem(name)\" method retrieves a node " + "specified by name."; // // Retrieve targeted data. // testNode = util.nodeObject(util.SECOND,util.SIXTH); domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic"); computedValue = domesticAttr.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0001C() { string computedValue = ""; string expectedValue = "Margaret Martin"; System.Xml.XmlNode testNode = null; System.Xml.XmlCharacterData testNodeData = null; testResults results = new testResults("Core0001C"); try { results.description = "The \"data\" attribute is the character data that " + "implements this interface."; // // Access the targeted data. // testNode = util.nodeObject(util.FIRST,util.SECOND); testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild; computedValue = testNodeData.Data; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; AssertEquals (results.expected, results.actual); }
public void core0001N() { string computedValue = ""; string expectedValue = "employeeId"; System.Xml.XmlNode employeeId = null; System.Xml.XmlElement testNode = null; testResults results = new testResults("Core0001N"); try { results.description = "The elements in the list are accessible via an "+ "integral index starting from 0 (this test checks "+ "for index equal to 0)."; // // Retrieve targeted data. // testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD,-1); employeeId = util.getSubNodes(testNode).Item(util.FIRST); computedValue = employeeId.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0001D() { string computedValue = ""; string expectedValue = "staff"; System.Xml.XmlDocument testNode = null; testResults results = new testResults("Core0001D"); results.description = "The doctype attribute contains the Document Type "+ "Declaration associated with this object."; // // Retrieve the targeted data and access its "doctype" attribute. // testNode = util.getDOMDocument(); System.Xml.XmlDocumentType dtype = testNode.DocumentType; computedValue = dtype.Name; // // Write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0001A() { object computedValue = null; object expectedValue = null; System.Xml.XmlNode testNode = null; System.Xml.XmlAttribute domesticAttr = null; testResults results = new testResults("Core0001A"); try { results.description = "The ParentNode attribute should be null for" + " an Attr object."; // // Retrieve targeted data and examine parentNode attribute. // testNode = util.nodeObject(util.FIRST, util.SIXTH); domesticAttr = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic"); computedValue = domesticAttr.ParentNode; // // Write out results // } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = (expectedValue == null).ToString(); results.actual = (computedValue == null).ToString(); Assert.AreEqual (results.expected, results.actual); // return results; }
public void core0001NO() { int computedValue = 0; int expectedValue = util.ELEMENT_NODE; testResults results = new testResults("Core0001NO"); results.description = "The nodeType attribute for an Element Node "+ " should be set to the constant 1."; // // The nodeType attribute for the root node should be set to the value 1. // computedValue = (int)util.getRootNode().NodeType; // // write out results. // results.expected = expectedValue.ToString(); results.actual = computedValue.ToString(); Assert.AreEqual (results.expected, results.actual); }
public void core0001E() { string computedValue = "0";//0 string expectedValue = "True";//true System.Xml.XmlNode addressElement = null; System.Xml.XmlAttributeCollection attrList = null; System.Xml.XmlAttribute domesticAttr = null; testResults results = new testResults("Core0001E"); try { results.description = "Element nodes may have associated attributes."; // // Retrieve the "address" element from the first employee. // addressElement = util.nodeObject(util.FIRST,util.SIXTH); // // Access its "domestic" attribute by creating a list of all attributes // and then retrieving the desired attribute from the list by name. // attrList = addressElement.Attributes;//.node. domesticAttr = (System.Xml.XmlAttribute)attrList.GetNamedItem("domestic"); // // Access its "specified" attribute. // computedValue = domesticAttr.Specified.ToString(); } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0001CO() { string computedValue = ""; string expectedValue = " This is comment number 1."; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0001CO"); results.description = "A comment is all the characters between the " + "start comment and end comment strings."; // // Retrieve the targeted data and access its nodeValue. // testNode = util.getDOMDocument().ChildNodes.Item(2); computedValue = testNode.Value;//nodeValue; // // Write out results // results.expected = expectedValue; results.actual = computedValue; AssertEquals (results.expected, results.actual); }
public void core0001T() { string computedValue = ""; string expectedValue = "Roger\n Jones"; System.Xml.XmlNode testNode = null; System.Xml.XmlCharacterData testNodeData = null; testResults results = new testResults("Core0001T"); try { results.description = "If there is no markup language in a block of text, " + "then the content of the text is contained into " + "an object implementing the Text interface that is " + "the only child of the element."; // // Retrieve the second child of the second employee and access its // textual data. // testNode = util.nodeObject(util.THIRD,util.SECOND); testNode.Normalize(); testNodeData = (System.Xml.XmlCharacterData)testNode.FirstChild; computedValue = testNodeData.Value; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0001DI() { bool computedValue = false; bool expectedValue = true; System.Xml.XmlDocument testNode = null; testResults results = new testResults("Core0001DI"); results.description = "Check for feature = XML in the \"hasFeature(feature,version)\" method."; // // Retrieve the targeted data and invoke its "hasFeature(feature,version)". // method. // testNode = util.getDOMDocument(); computedValue = testNode.Implementation.HasFeature("XML","1.0"); // // Write out results. // results.expected = expectedValue.ToString(); results.actual = computedValue.ToString(); AssertEquals (results.expected, results.actual); }
public void core0007T() { string computedValue = ""; System.Xml.XmlText oldTextNode = null; System.Xml.XmlText newTextNode = null; System.Xml.XmlNode testNode = null; string expectedValue = "System.ArgumentOutOfRangeException";//util.INDEX_SIZE_ERR; testResults results = new testResults("Core0007T"); try { results.description = "The \"splitText(offset)\" method raises an " + "INDEX_SIZE_ERR Exception if the specified " + "offset is negative."; // // Retrieve the targeted data // testNode = util.nodeObject(util.THIRD,util.SECOND); oldTextNode = (System.Xml.XmlText)testNode.FirstChild; // // Call the "spitText(offset)" method with "offset" equal to a negative // number should raise an exception. // try { oldTextNode.SplitText(-69); } catch(System.Exception ex) { computedValue = ex.GetType ().FullName; } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0005T() { string computedValue = ""; string expectedValue = " Jones"; System.Xml.XmlText oldTextNode = null; System.Xml.XmlText newTextNode = null; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0005T"); try { results.description = "After the \"splitText(offset)\" method is invoked, the " + "new Text node contains all of the content from the offset " + "point to the end of the text."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.THIRD,util.SECOND); oldTextNode = (System.Xml.XmlText)testNode.FirstChild; // // Split the two lines of text into two different Text nodes. // newTextNode = oldTextNode.SplitText(util.SEVENTH); computedValue = newTextNode.Value; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0006T() { string computedValue = ""; string expectedValue = "98551"; System.Xml.XmlText oldTextNode = null; System.Xml.XmlText newTextNode = null; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0006T"); try { results.description = "The \"splitText(offset)\" method returns the " + "new Text node."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.FIRST,util.SIXTH); oldTextNode = (System.Xml.XmlText)testNode.FirstChild; // // Split the two lines of text into two different Text nodes. // newTextNode = oldTextNode.SplitText(30); computedValue = newTextNode.Value; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0002T() { string computedValue = ""; string expectedValue = "1900 Dallas Road Dallas, Texas\n 98554"; System.Xml.XmlNode testNode = null; System.Xml.XmlNode textBlock1 = null; System.Xml.XmlNode textBlock2 = null; System.Xml.XmlNode textBlock3 = null; System.Xml.XmlNode textBlock4 = null; testResults results = new testResults("Core0002T"); try { results.description = "If there is markup language in the content of the " + "element then the content is parsed into a " + "list of elements and Text that are the children of " + "the element"; // // This last child of the second employee should now have four children, // two Text nodes and two EntityReference nodes. Retrieve each one of them // and in the case of EntityReferences retrieve their respective children. // testNode = util.nodeObject(util.SECOND,util.SIXTH); textBlock1 = testNode.ChildNodes.Item(util.FIRST).FirstChild; textBlock2 = testNode.ChildNodes.Item(util.SECOND); textBlock3 = testNode.ChildNodes.Item(util.THIRD).FirstChild; textBlock4 = testNode.ChildNodes.Item(util.FOURTH); computedValue += textBlock1.Value; computedValue += textBlock2.Value; computedValue += textBlock3.Value; computedValue += textBlock4.Value; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0003T() { string computedValue = ""; string expectedValue = "Jones"; System.Xml.XmlText oldTextNode = null; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0003T"); try { results.description = "The \"splitText(offset)\" method breaks the Text node " + "into two Text nodes at the specified offset, keeping each " + "node in the tree as siblings."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.THIRD,util.SECOND); oldTextNode = (System.Xml.XmlText)testNode.FirstChild; // // Split the two lines of text into two different Text nodes. // oldTextNode.SplitText(util.EIGHT); computedValue = oldTextNode.NextSibling.Value; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // Write out results // results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0012NO() { string computedValue = ""; System.Xml.XmlNode testNode = null; string expectedValue = util.NOTATION_NODE.ToString(); testResults results = new testResults("Core0012NO"); try { results.description = "The nodeType attribute for a Notation Node "+ " should be set to the constant 12."; // // Get the targeted data. // testNode = util.getNotation("notation1"); // // The nodeType attribute should be set to the value 12. // computedValue = ((int)testNode.NodeType).ToString(); } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // write out results. // results.expected = expectedValue.ToString(); results.actual = computedValue.ToString(); Assert.AreEqual (results.expected, results.actual); }
public void core0021NO() { string computedValue = ""; string expectedValue = "#document"; System.Xml.XmlNode testNodeNode = null; testResults results = new testResults("Core0021NO"); results.description = "The nodeName attribute for a Document Node "+ "should be set to \"#document\"."; // // Get the targeted data. // System.Xml.XmlNode testNode = util.getDOMDocument(); // // The nodeName attribute should be set to "#document". // computedValue = testNode.Name; // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0017NO() { string computedValue = ""; string expectedValue = "ent2"; System.Xml.XmlNode testNode = null; System.Xml.XmlNode entRefNode = null; testResults results = new testResults("Core0017NO"); try { results.description = "The nodeName attribute for an EntityReference Node " + "should be set to the name of the entity referenced."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.SECOND,util.SIXTH); entRefNode = testNode.FirstChild;//.node. // // The nodeName attribute should be set to "ent2". // computedValue = entRefNode.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
[Category ("NotDotNet")] // MS DOM is buggy public void core0009T() { string computedValue = ""; System.Xml.XmlNode testNode = null; System.Xml.XmlText readOnlyText = null; string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR; testResults results = new testResults("Core0009T"); try { results.description = "The \"splitText(offset)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR Exception if the " + "node is readonly."; // // Attempt to modify descendants of an EntityReference node should raise // an exception. // testNode = util.nodeObject(util.SECOND,util.SIXTH); readOnlyText = (System.Xml.XmlText)testNode.ChildNodes.Item(util.FIRST).FirstChild; try { readOnlyText.SplitText(5); } catch(ArgumentException ex) { computedValue = ex.GetType ().FullName; } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0098NO() { string computedValue = ""; System.Xml.XmlElement newChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"newChild"); System.Xml.XmlElement refChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"refChild"); System.Xml.XmlNode testNode = null; string expectedValue = "System.ArgumentException";//util.NOT_FOUND2_ERR; testResults results = new testResults("Core0098NO"); try { results.description = "The \"insertBefore\" method of a node raises "+ "a NOT_FOUND_ERR Exception if the reference "+ "child is not a child of this node."; // // Retrieve targeted data. // testNode = util.nodeObject(util.SECOND,-1); // // Attempt to insert before a reference child that is not a child of // this node should raise an exception. // try { testNode.InsertBefore(newChild,refChild);//.node. } catch(ArgumentException ex) { computedValue = ex.GetType ().FullName; } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0016NO() { string computedValue = "0"; string expectedValue = "#cdata-section"; System.Xml.XmlNode testNode = null; System.Xml.XmlNode cDataNode = null; testResults results = new testResults("Core0016NO"); try { results.description = "The nodeName attribute for a CDATASection Node " + "should be set to \"#cdata-section\"."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.SECOND,util.SECOND); cDataNode = testNode.LastChild;;//.node. // // The nodeName attribute should be set to "#cdata-section". // computedValue = cDataNode.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0015NO() { string computedValue = "0"; string expectedValue = "#text"; System.Xml.XmlNode testNode = null; System.Xml.XmlNode textNode = null; testResults results = new testResults("Core0015NO"); try { results.description = "The nodeName attribute for a Text Node " + "should be set to \"#text\"."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.FIRST,util.SIXTH); textNode = testNode.FirstChild;//.node. // // The nodeName attribute should be set to the value "#text". // computedValue = textNode.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0014NO() { string computedValue = "0"; string expectedValue = "domestic"; System.Xml.XmlElement testNode = null; System.Xml.XmlAttribute attrNode = null; testResults results = new testResults("Core0014NO"); try { results.description = "The nodeName attribute for an Attribute Node " + "should be set to the name of the attribute."; // // Retrieve the targeted data. // testNode = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH); attrNode = testNode.GetAttributeNode("domestic"); //.node. // // The nodeName attribute should be set to the value "domestic". // computedValue = attrNode.Name; } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0013NO() { string computedValue = "0"; string expectedValue = "staff"; testResults results = new testResults("Core0013NO"); results.description = "The nodeName attribute for an Element Node " + "should be set to its tagName."; // // The nodeName attribute should be set to "staff". // computedValue = util.getRootNode().Name; // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0008T() { string computedValue = ""; System.Xml.XmlText oldTextNode = null; System.Xml.XmlNode testNode = null; string expectedValue = "System.ArgumentOutOfRangeException"; testResults results = new testResults("Core0008T"); try { results.description = "The \"splitText(offset)\" method raises an " + "ArgumentOutOfRangeException if the specified " + "offset is greater than the number of 16-bit units " + "in the Text node."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.THIRD,util.SECOND); oldTextNode = (System.Xml.XmlText)testNode.FirstChild; // // Call the "spitText(offset)" method with "offset" greater than the numbers // of characters in the Text node, it should raise an exception. try { oldTextNode.SplitText(300); } catch(System.Exception ex) { computedValue = ex.GetType().ToString(); } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0011NO() { int computedValue = 0; System.Xml.XmlNode testNode = null; int expectedValue = util.DOCUMENT_FRAGMENT_NODE; testResults results = new testResults("Core0011NO"); results.description = "The nodeType attribute for a DocumentFragment Node "+ " should be set to the constant 11."; // // Get the targeted data. // testNode = util.getDOMDocument().CreateDocumentFragment(); // // The nodeType attribute should be set to the value 11. // computedValue = (int)testNode.NodeType; // // write out results. // results.expected = expectedValue.ToString(); results.actual = computedValue.ToString(); Assert.AreEqual (results.expected, results.actual); }
public void core0018NO() { string computedValue = ""; string expectedValue = "ent1"; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0018NO"); results.description = "The nodeName attribute for an Entity Node " + "should be set to the entity name."; // // Get the targeted data. // testNode = util.getEntity("ent1"); // // The nodeName attribute should be set to "ent1". // computedValue = testNode.Name; // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0103NO() { string computedValue = ""; System.Xml.XmlElement newChild = util.getOtherDOMDocument().CreateElement("newChild"); System.Xml.XmlNode testNode = null; string expectedValue = "System.ArgumentException"; testResults results = new testResults("Core0103NO"); try { results.description = "The \"appendChild\" method of a node raises a "+ "a System.ArgumentException Exception if the new "+ "child was created from a document different "+ "from the one that created this node."; // // Retrieve the targeted data. // testNode = util.nodeObject(util.SECOND,-1); // // Attempt to append a child from a different document should raise an // exception. // try { testNode.AppendChild(newChild);//.node. } catch(System.Exception ex) { computedValue = ex.GetType().ToString(); } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }
public void core0019NO() { string computedValue = "0"; string expectedValue = "xml"; System.Xml.XmlNode testNode = null; testResults results = new testResults("Core0019NO"); results.description = "The nodeName attribute for a ProcessingInstruction "+ "Node should be set to the target."; // // Get the targeted data. // testNode = util.getDOMDocument().ChildNodes.Item(0); // // The nodeName attribute should be set to "xml". // computedValue = testNode.Name; // // write out results. // results.expected = expectedValue; results.actual = computedValue; Assert.AreEqual (results.expected, results.actual); }
public void core0100NO() { string computedValue = ""; System.Xml.XmlElement oldChild = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE,"oldChild"); System.Xml.XmlNode testNode = null; string expectedValue = typeof (ArgumentException).FullName;//util.NOT_FOUND3_ERR; testResults results = new testResults("Core0100NO"); try { results.description = "The \"removeChild\" method of a node raises "+ "a NOT_FOUND_ERR Exception if the old "+ "child is not a child of this node."; // // Retrieve targeted data. // testNode = util.nodeObject(util.SECOND,-1); // // Attempt to remove a non child node should raise an exception. // try { testNode.RemoveChild(oldChild);//.node. } catch(ArgumentException ex) { computedValue = ex.GetType ().FullName; } } catch(System.Exception ex) { computedValue = "Exception " + ex.Message; } results.expected = expectedValue; results.actual = computedValue; util.resetData(); Assert.AreEqual (results.expected, results.actual); }