Esempio n. 1
0
        public void core0007A()
        {
            string computedValue = "";
            string expectedValue = "street";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlNode      testNode   = null;

            testResults results = new testResults("Core0007A");

            try
            {
                results.description = "The \"name\" attribute of an Attr object contains " +
                                      "the name of that attribute.";
                //
                // Retrieve the targeted data and capture its assigned name.
                //
                testNode      = util.nodeObject(util.SECOND, util.SIXTH);
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.Name;
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
            // return results;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        public void core0009A()
        {
            string computedValue = "";//0;
            string expectedValue = "False";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlNode      testNode   = null;

            testResults results = new testResults("Core0009A");

            try
            {
                results.description = "The \"specified\" attribute for an Attr node " +
                                      "should be set to false if the attribute was " +
                                      "not explictly given a value.";
                //
                // Retrieve the targeted data and capture its "specified" attribute.
                //
                testNode      = util.nodeObject(util.FIRST, util.SIXTH);
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.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);
            // return results;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public void core0008N()
        {
            string computedValue = "0";
            string expectedValue = "0";

            System.Xml.XmlNode testNode = null;
            System.Xml.XmlNode textNode = null;

            testResults results = new testResults("Core0008N");

            try
            {
                results.description = "The \"length\" attribute contains the number of " +
                                      "nodes in the list (test for empty list).";
                //
                // Access the targeted data and examine the "length" attribute of an
                // empty list.
                //
                testNode      = util.nodeObject(util.THIRD, util.FIRST);
                textNode      = testNode.FirstChild;
                computedValue = textNode.ChildNodes.Count.ToString();
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 6
0
        public void core0012A()
        {
            string computedValue = "";
            string expectedValue = "Yes";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlNode      testNode   = null;

            testResults results = new testResults("Core0012A");

            try
            {
                results.description = "Upon retrieval the \"value\" attribute of an Attr" +
                                      "object is returned as a string with any Entity " +
                                      "References replaced with their values.";
                //
                // Retrieve the targeted data.
                //
                testNode      = util.nodeObject(util.FOURTH, util.SIXTH);
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.Value;
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            //    Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
            // return results;
        }
Esempio n. 7
0
        public void core0006N()
        {
            object computedValue = null;
            object expectedValue = null;

            System.Xml.XmlElement testNode = null;

            testResults results = new testResults("Core0006N");

            try
            {
                results.description = "The \"item(index)\" method returns null if the " +
                                      "index is greater than or equal to the number of " +
                                      "nodes (index > number of nodes).";
                //
                // Retrieve targeted data.  All counts start from zero
                //
                testNode      = (System.Xml.XmlElement)util.nodeObject(util.THIRD, -1);
                computedValue = util.getSubNodes(testNode).Item(util.EIGHT);
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = (expectedValue == null).ToString();
            results.actual   = (computedValue == null).ToString();

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 8
0
        public void core0007N()
        {
            string computedValue = "0";
            string expectedValue = "6";
            //System.Xml.XmlNodeList thirdEmployeeList = null;

            testResults results = new testResults("Core0007N");

            try
            {
                results.description = "The \"length\" attribute contains the number of " +
                                      "nodes in the list (non empty list).";
                //
                // retrieve the targeted data and access the "length" attribute.
                //
                System.Xml.XmlElement testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD, -1);
                computedValue = util.getSubNodes(testNode).Count.ToString();
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 9
0
        public void core0005N()
        {
            object computedValue = null;
            object expectedValue = null;

            System.Xml.XmlElement testNode = null;

            testResults results = new testResults("Core0005N");

            try
            {
                results.description = "The \"item(index)\" method returns null if the " +
                                      "index is greater than or equal to the number of " +
                                      "nodes (index = number of nodes).";
                //
                // invoke the "item(index)" method with index equal to the number of nodes
                // in the list (6, count starts at zero).  It should return null.
                //
                testNode      = (System.Xml.XmlElement)util.nodeObject(util.THIRD, -1);
                computedValue = util.getSubNodes(testNode).Item(util.SEVENTH);
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = (expectedValue == null).ToString();
            results.actual   = (computedValue == null).ToString();

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 10
0
        public void core0004N()
        {
            string computedValue = "";
            string expectedValue = "address";

            System.Xml.XmlNode    address  = null;
            System.Xml.XmlElement testNode = null;

            testResults results = new testResults("Core0004N");

            try
            {
                results.description = "The \"item(index)\" method returns the indxth " +
                                      "item in the collection (return last item).";
                //
                // Retrieve targeted data.
                //
                testNode      = (System.Xml.XmlElement)util.nodeObject(util.THIRD, -1);
                address       = util.getSubNodes(testNode).Item(util.SIXTH);
                computedValue = address.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 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();

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 12
0
        public void core0005A()
        {
            string computedValue = "";
            string expectedValue = "Yes";

            System.Xml.XmlAttribute domesticAttr = null;
            System.Xml.XmlNode      testNode     = null;

            testResults results = new testResults("Core0005A");

            try
            {
                results.description = "If an attribute is explicitly assigned any value, " +
                                      "then that value is the attribute's effective value.";
                //
                //  Retrieve the targeted data and examine its assigned value.
                //
                testNode      = util.nodeObject(util.FIRST, util.SIXTH);
                domesticAttr  = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("domestic");
                computedValue = domesticAttr.Value;
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
            // return results;
        }
Esempio n. 13
0
    /// <summary>
    /// Get the whole time limit of every word
    /// </summary>
    /// <returns></returns>
    public int GetAllTimeLimit()
    {
        float result = 0;

        result += timeLimit / 2;

        return(Mathf.RoundToInt(result));
    }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        [Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
        public void core0014A()
        {
            string computedValue = "";

            System.Xml.XmlNode      testNode          = null;
            System.Xml.XmlAttribute readOnlyAttribute = null;
            string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;

            testResults results = new testResults("Core0014A");

            try
            {
                results.description = "Setting the \"value\" attribute raises a " +
                                      "NO_MODIFICATION_ALLOWED_ERR Exception if " +
                                      "the node is readonly.";

                //
                // Retrieve the targeted data.
                //
                testNode          = util.getEntity("ent4");
                readOnlyAttribute = (System.Xml.XmlAttribute)testNode.FirstChild.Attributes.Item(0);
                //
                // attempt to set a value on a readonly node should raise an exception.
                //
                try
                {
                    readOnlyAttribute.Value = "ABCD";
                }
                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);
            // return results;
        }
Esempio n. 18
0
        [Ignore(".NET DOM implementation does not match W3C DOM specification.")] // 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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        public void core0004A()
        {
            string computedValue = "";
            string expectedValue = "domestic";

            System.Xml.XmlAttribute domesticAttr = null;

            testResults results = new testResults("Core0004A");

            try
            {
                results.description = "Attr objects may be associated with Element " +
                                      "nodes contained within a DocumentFragment.";

                System.Xml.XmlDocumentFragment docFragment = util.getDOMDocument().CreateDocumentFragment();
                System.Xml.XmlElement          newElement  = (System.Xml.XmlElement)util.createNode(util.ELEMENT_NODE, "element1");
                //
                // The new DocumentFragment is empty upon creation.  Set an attribute for
                // a newly created element and add the element to the documentFragment.
                //
                newElement.SetAttribute("domestic", "Yes");
                docFragment.AppendChild(newElement);
                //
                // Access the attributes of the only child of the documentFragment
                //
                domesticAttr  = (System.Xml.XmlAttribute)docFragment.FirstChild.Attributes.Item(0);
                computedValue = domesticAttr.Name;
            }
            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);
            // return results;
        }
Esempio n. 21
0
        public void core0009N()
        {
            string computedValue = "";
            string expectedValue = "employeeId name position salary gender address ";
            int    lastIndex     = 0;
            int    listLength    = 0;

            System.Xml.XmlElement testNode = null;

            testResults results = new testResults("Core0009N");

            try
            {
                results.description = "The range of valid child nodes indices is 0 to " +
                                      "length - 1.";
                //
                // Retrieve the targeted data and determine the length of the list.
                //
                testNode   = (System.Xml.XmlElement)util.nodeObject(util.THIRD, -1);
                listLength = util.getSubNodes(testNode).Count;
                lastIndex  = listLength - 1;
                //
                // Traverse the list from 0 to length - 1.  All indices should be valid.
                //
                for (int index = 0; index <= lastIndex; index++)
                {
                    computedValue += util.getSubNodes(testNode).Item(index).Name + " ";
                }
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results.
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
        }
Esempio n. 22
0
        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);
        }
Esempio n. 23
0
        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);
        }
Esempio n. 24
0
        public void core0011A()
        {
            string computedValue = "";//"";
            string expectedValue = "False";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlElement   testNode   = null;

            testResults results = new testResults("Core0011A");

            try
            {
                results.description = "Re-setting an attribute to its default value " +
                                      "requires that the attribute be deleted.  The " +
                                      "implementation should create a new attribute " +
                                      "with its \"specified\" attribute set to false.";
                //
                // Retrieve the targeted data, remove the "street" attribute and capture
                // its specified attribute.
                //
                testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD, util.SIXTH);
                testNode.RemoveAttribute("street");//testNode.node.removeAttribute("street");
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.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);
            // return results;
        }
Esempio n. 25
0
        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);
        }
Esempio n. 26
0
        public void core0013A()
        {
            string computedValue = "";
            string expectedValue = "Y%ent1;";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlNode      testNode   = null;

            testResults results = new testResults("Core0013A");

            try
            {
                results.description = "On setting, the \"value\" attribute of an Attr " +
                                      "object creates a Text node with the unparsed " +
                                      "content of the string.";
                //
                // Retrieve the targeted data, assign a value to it and capture its
                // "value" attribute.
                //
                testNode         = util.nodeObject(util.FOURTH, util.SIXTH);
                streetAttr       = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                streetAttr.Value = "Y%ent1;";
                computedValue    = streetAttr.Value;
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
            // return results;
        }
Esempio n. 27
0
        public void core0010A()
        {
            string computedValue = "";//"";
            string expectedValue = "True";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlElement   testNode   = null;

            testResults results = new testResults("Core0010A");

            try
            {
                results.description = "The \"specified\" attribute for an Attr node " +
                                      "should be flipped to true if the attribute value " +
                                      "is changed (even it changed to its default value).";
                //
                // Retrieve the targeted data and set a new attribute for it, then
                // capture its "specified" attribute.
                //
                testNode = (System.Xml.XmlElement)util.nodeObject(util.THIRD, util.FIFTH);
                testNode.SetAttribute("street", "Yes");//testNode.node.setAttribute("street","Yes");
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.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);
            // return results;
        }
Esempio n. 28
0
        public void core0006A()
        {
            string computedValue = "";
            string expectedValue = "Yes";

            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlNode      testNode   = null;

            testResults results = new testResults("Core0006A");

            try
            {
                results.description = "If there is no explicit value assigned to an " +
                                      "attribute and there is a declaration for this " +
                                      "attribute and  that declaration includes a default " +
                                      "value, then that default value is the Attribute's " +
                                      "default value.";
                //
                // Retrieve the targeted data and examine its default value.
                //
                testNode      = util.nodeObject(util.FIRST, util.SIXTH);
                streetAttr    = (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
                computedValue = streetAttr.Value;
            }
            catch (System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual   = computedValue;

            Assert.AreEqual(results.expected, results.actual);
            // return results;
        }
Esempio n. 29
0
        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;

            Assert.AreEqual(results.expected, results.actual);
        }