示例#1
0
        /// <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);
        }
示例#2
0
        /// <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;
      }
示例#5
0
 /// <summary>
 /// Sets the result.
 /// </summary>
 /// <param name="result">The LINQ element for the result.</param>
 protected void SetResult(SimpleXElement result)
 {
   _result = result;
 }
示例#6
0
 /// <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);
 }
示例#7
0
 /// <summary>
 /// Sets the result.
 /// </summary>
 /// <param name="result">The LINQ element for the result.</param>
 protected void SetResult(SimpleXElement result)
 {
     _result = result;
 }
示例#8
0
 /// <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);
 }
示例#9
0
 /// <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;
 }
示例#10
0
 /// <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);
 }