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

writeAttributes_7() public method

public writeAttributes_7 ( ) : int
return int
        public int writeAttributes_7()
        {
            using (XmlWriter w = CreateWriter())
            {
                using (XmlReader xr = CreateReader("XmlReader.xml"))
                {
                    while (xr.Read())
                    {
                        if (xr.LocalName == "AttributesEntity")
                        {
                            do { xr.Read(); } while (xr.LocalName != "node");
                            xr.MoveToNextAttribute();
                            break;
                        }
                    }
                    if (xr.NodeType != XmlNodeType.Attribute)
                    {
                        CError.WriteLine("Reader not positioned on attribute");
                        CError.WriteLine(xr.LocalName);
                        xr.Dispose();
                        w.Dispose();
                        return TEST_FAIL;
                    }
                    w.WriteStartElement("Root");
                    w.WriteAttributes(xr, false);
                    w.WriteEndElement();
                }
            }
            if (!ReaderExpandsEntityRef())
                return CompareString("<Root a=\"&e;\" />") ? TEST_PASS : TEST_FAIL;
            else
                return CompareReader("<Root a=\"Test Entity\" />") ? TEST_PASS : TEST_FAIL;
        }