System.Xml.Tests.TCFullEndElement.TCWriteValue.TCClose.WriteStateReturnsContentAfterDocumentClosed C# (CSharp) Méthode

WriteStateReturnsContentAfterDocumentClosed() public méthode

public WriteStateReturnsContentAfterDocumentClosed ( ) : int
Résultat int
                public int WriteStateReturnsContentAfterDocumentClosed()
                {
                    XmlWriter xw = CreateWriter();
                    xw.WriteStartDocument(false);
                    xw.WriteStartElement("foo");
                    xw.WriteString("bar");
                    xw.WriteEndElement();
                    Console.WriteLine(xw.WriteState);

                    try
                    {
                        xw.WriteStartElement("foo2");
                        xw.Dispose();
                    }
                    catch (System.InvalidOperationException)
                    {
                        return TEST_PASS;
                    }
                    return TEST_FAIL;
                }
            }