System.Xml.Tests.TCWriteAttributes.writeAttributes_2 C# (CSharp) Method

writeAttributes_2() public method

public writeAttributes_2 ( ) : int
return int
        public int writeAttributes_2()
        {
            using (XmlWriter w = CreateWriter())
            {
                using (XmlReader xr = CreateReader("XmlReader.xml"))
                {
                    while (xr.Read())
                    {
                        if (xr.LocalName == "name")
                        {
                            xr.MoveToFirstAttribute();
                            break;
                        }
                    }
                    w.WriteStartElement("Root");
                    w.WriteAttributes(xr, false);
                    w.WriteEndElement();
                }
            }

            if (IsXPathDataModelReader())
                // allways sees default attributes
                return CompareReader("<Root a=\"b\" FIRST=\"KEVIN\" LAST=\"WHITE\" />") ? TEST_PASS : TEST_FAIL;
            else
                return CompareReader("<Root a=\"b\" />") ? TEST_PASS : TEST_FAIL;
        }