Search Results for

    Show / Hide Table of Contents

    Class TNode

    TNode represents a single node in the XML representation of a Test or TestResult. It replaces System.Xml.XmlNode and System.Xml.Linq.XElement, providing a minimal set of methods for operating on the XML in a platform-independent manner.

    Inheritance
    object
    TNode
    Inherited Members
    object.GetType()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Interfaces
    Assembly: nunit.framework.dll
    Syntax
    public sealed class TNode

    Constructors

    View Source

    TNode(string)

    Constructs a new instance of TNode

    Declaration
    public TNode(string name)
    Parameters
    Type Name Description
    string name

    The name of the node

    View Source

    TNode(string, string?)

    Constructs a new instance of TNode with a value

    Declaration
    public TNode(string name, string? value)
    Parameters
    Type Name Description
    string name

    The name of the node

    string value

    The text content of the node

    View Source

    TNode(string, string?, bool)

    Constructs a new instance of TNode with a value

    Declaration
    public TNode(string name, string? value, bool valueIsCDATA)
    Parameters
    Type Name Description
    string name

    The name of the node

    string value

    The text content of the node

    bool valueIsCDATA

    Flag indicating whether to use CDATA when writing the text

    Properties

    View Source

    Attributes

    Gets the dictionary of attributes

    Declaration
    public TNode.AttributeDictionary Attributes { get; }
    Property Value
    Type Description
    TNode.AttributeDictionary
    View Source

    ChildNodes

    Gets a list of child nodes

    Declaration
    public TNode.NodeList ChildNodes { get; }
    Property Value
    Type Description
    TNode.NodeList
    View Source

    FirstChild

    Gets the first ChildNode

    Declaration
    public TNode? FirstChild { get; }
    Property Value
    Type Description
    TNode
    View Source

    Name

    Gets the name of the node

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string
    View Source

    OuterXml

    Gets the XML representation of this node.

    Declaration
    public string OuterXml { get; }
    Property Value
    Type Description
    string
    View Source

    Value

    Gets the value of the node

    Declaration
    public string? Value { get; set; }
    Property Value
    Type Description
    string
    View Source

    ValueIsCDATA

    Gets a flag indicating whether the value should be output using CDATA.

    Declaration
    public bool ValueIsCDATA { get; set; }
    Property Value
    Type Description
    bool

    Methods

    View Source

    AddAttribute(string, string)

    Adds an attribute with a specified name and value to the XmlNode.

    Declaration
    public void AddAttribute(string name, string value)
    Parameters
    Type Name Description
    string name

    The name of the attribute.

    string value

    The value of the attribute.

    View Source

    AddChildNode(TNode)

    Adds a child node to this node.

    Declaration
    public void AddChildNode(TNode node)
    Parameters
    Type Name Description
    TNode node

    The child node to add.

    View Source

    AddElement(string)

    Adds a new element as a child of the current node and returns it.

    Declaration
    public TNode AddElement(string name)
    Parameters
    Type Name Description
    string name

    The element name.

    Returns
    Type Description
    TNode

    The newly created child element

    View Source

    AddElement(string, string)

    Adds a new element with a value as a child of the current node and returns it.

    Declaration
    public TNode AddElement(string name, string value)
    Parameters
    Type Name Description
    string name

    The element name

    string value

    The text content of the new element

    Returns
    Type Description
    TNode

    The newly created child element

    View Source

    AddElementWithCDATA(string, string)

    Adds a new element with a value as a child of the current node and returns it. The value will be output using a CDATA section.

    Declaration
    public TNode AddElementWithCDATA(string name, string value)
    Parameters
    Type Name Description
    string name

    The element name

    string value

    The text content of the new element

    Returns
    Type Description
    TNode

    The newly created child element

    View Source

    FromXml(string)

    Create a TNode from its XML text representation

    Declaration
    public static TNode FromXml(string xmlText)
    Parameters
    Type Name Description
    string xmlText

    The XML text to be parsed

    Returns
    Type Description
    TNode

    A TNode

    View Source

    InsertChildNode(int, TNode)

    Inserts a child nodeat the specified index.

    Declaration
    public void InsertChildNode(int index, TNode node)
    Parameters
    Type Name Description
    int index

    The zero-based index at which node should be inserted.

    TNode node

    The node to insert.

    View Source

    SelectNodes(string)

    Finds all descendants of this node matching an XPath specification. The format of the specification is limited to what is needed by NUnit and its tests.

    Declaration
    public List<TNode> SelectNodes(string xpath)
    Parameters
    Type Name Description
    string xpath
    Returns
    Type Description
    List<TNode>
    View Source

    SelectSingleNode(string)

    Finds a single descendant of this node matching an XPath specification. The format of the specification is limited to what is needed by NUnit and its tests.

    Declaration
    public TNode? SelectSingleNode(string xpath)
    Parameters
    Type Name Description
    string xpath
    Returns
    Type Description
    TNode
    View Source

    WriteTo(XmlWriter)

    Writes the XML representation of the node to an XmlWriter

    Declaration
    public void WriteTo(XmlWriter writer)
    Parameters
    Type Name Description
    XmlWriter writer
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0