/// <summary> /// Sets the value of a new child element. /// </summary> /// <param name="elementName">The element name.</param> /// <param name="value">The value of the new element.</param> public void SetElementValue(string elementName, string value) { SimpleXElement child = new SimpleXElement(elementName); child.Value = value; Add(child); }
/// <summary> /// Creates a new SimpleXElement. /// </summary> /// <param name="xml">XML content.</param> /// <returns>Returns a new instance of the element and children.</returns> public static SimpleXElement Parse(string xml) { SimpleXElement sxe = new SimpleXElement(); using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { sxe.ParseInternal(reader, true); } return(sxe); }
/// <summary> /// Adds pending output for the next result. /// </summary> /// <param name="element">The element to wrap in an Output element.</param> private void AddPendingOutput(SimpleXElement element) { SimpleXElement output = CreateElement("Output"); output.Add(element); _pendingElements.Add(output); }
/// <summary> /// Creates the initial results document and its XElements. /// </summary> private void CreateInitialDocument() { TestRun = CreateElement("TestRun"); TestRunConfiguration = CreateElement("TestSettings"); TestRun.Add(TestRunConfiguration); ResultSummary = CreateElement("ResultSummary"); Counters = CreateElement("Counters"); ResultSummary.Add(Counters); TestRun.Add(ResultSummary); Times = CreateElement("Times"); TestRun.Add(Times); TestDefinitions = CreateElement("TestDefinitions"); TestRun.Add(TestDefinitions); TestLists = CreateElement("TestLists"); TestRun.Add(TestLists); TestEntries = CreateElement("TestEntries"); TestRun.Add(TestEntries); Results = CreateElement("Results"); TestRun.Add(Results); RunOutcome = TestOutcome.NotExecuted; }
/// <summary> /// Sets the result. /// </summary> /// <param name="result">The LINQ element for the result.</param> protected void SetResult(SimpleXElement result) { _result = result; }
/// <summary> /// Adds a child element to the simple element instance. /// </summary> /// <param name="child">The child element instance.</param> public void Add(SimpleXElement child) { _children.Add(child); }
/// <summary> /// Creates a new SimpleXElement. /// </summary> /// <param name="xml">XML content.</param> /// <returns>Returns a new instance of the element and children.</returns> public static SimpleXElement Parse(string xml) { SimpleXElement sxe = new SimpleXElement(); using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { sxe.ParseInternal(reader, true); } return sxe; }