当前位置: 首页>>代码示例>>C#>>正文


C# ITestResult.ToXml方法代码示例

本文整理汇总了C#中ITestResult.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# ITestResult.ToXml方法的具体用法?C# ITestResult.ToXml怎么用?C# ITestResult.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITestResult的用法示例。


在下文中一共展示了ITestResult.ToXml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteXmlResultOutput

        private void WriteXmlResultOutput(ITestResult result, XmlWriter xmlWriter)
        {
            this.xmlWriter = xmlWriter;

            InitializeXmlFile(result);

            result.ToXml(true).WriteTo(xmlWriter);

            TerminateXmlFile();
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:10,代码来源:NUnit3XmlOutputWriter.cs

示例2: OnTestResult

        static bool OnTestResult(ITestResult result, ExecutorCallback callback)
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<foo/>");

            XmlNode node = result.ToXml(doc.ChildNodes[0]);

            if (node != null)
                callback.Notify(node.OuterXml);

            return callback.ShouldContinue();
        }
开发者ID:nulltoken,项目名称:xunit,代码行数:12,代码来源:Executor.cs

示例3: OnTestResult

        static bool OnTestResult(ITestResult result, ICallbackEventHandler callback)
        {
            if (callback == null)
                return true;

            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<foo/>");

            XmlNode node = result.ToXml(doc.ChildNodes[0]);

            if (node != null)
                callback.RaiseCallbackEvent(node.OuterXml);

            return bool.Parse(callback.GetCallbackResult());
        }
开发者ID:chrisortman,项目名称:coulda,代码行数:15,代码来源:Executor.cs

示例4: WriteXmlResultOutput

        private void WriteXmlResultOutput(ITestResult result, XmlWriter xmlWriter, IDictionary<string, object> runSettings, TestFilter filter)
        {
            TNode resultNode = result.ToXml(true);

            // Insert elements as first child in reverse order
            if (runSettings != null) // Some platforms don't have settings
                FrameworkController.InsertSettingsElement(resultNode, runSettings);
            FrameworkController.InsertEnvironmentElement(resultNode);

            TNode testRun = MakeTestRunElement(result);

            testRun.ChildNodes.Add(MakeCommandLineElement());
            testRun.ChildNodes.Add(MakeTestFilterElement(filter));
            testRun.ChildNodes.Add(resultNode);

            testRun.WriteTo(xmlWriter);
        }
开发者ID:textmetal,项目名称:main,代码行数:17,代码来源:NUnit3XmlOutputWriter.cs

示例5: WriteResultFile

        /// <summary>
        /// Writes the test result to the specified TextWriter
        /// </summary>
        /// <param name="result">The result to be written to a file</param>
        /// <param name="writer">A TextWriter to which the result is written</param>
        public override void WriteResultFile(ITestResult result, TextWriter writer)
        {
            // NOTE: Under .NET 1.1, XmlTextWriter does not implement IDisposable,
            // but does implement Close(). Hence we cannot use a 'using' clause.
            //using (XmlTextWriter xmlWriter = new XmlTextWriter(writer))
            XmlTextWriter xmlWriter = new XmlTextWriter(writer);
            xmlWriter.Formatting = Formatting.Indented;

            try
            {
                xmlWriter.WriteStartDocument(false);
                result.ToXml(true).WriteTo(xmlWriter);
            }
            finally
            {
                xmlWriter.Close();
            }
        }
开发者ID:pjcollins,项目名称:Andr.Unit,代码行数:23,代码来源:NUnit3XmlOutputWriter.cs

示例6: WriteResultFile

        /// <summary>
        /// Writes the test result to the specified TextWriter
        /// </summary>
        /// <param name="result">The result to be written to a file</param>
        /// <param name="writer">A TextWriter to which the result is written</param>
        public override void WriteResultFile(ITestResult result, TextWriter writer)
        {
            // NOTE: Under .NET 1.1, XmlTextWriter does not implement IDisposable,
            // but does implement Close(). Hence we cannot use a 'using' clause.
#if CLR_2_0 || CLR_4_0
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            XmlWriter xmlWriter = XmlWriter.Create(writer, settings);
#else
            XmlTextWriter xmlWriter = new XmlTextWriter(writer);
            xmlWriter.Formatting = Formatting.Indented;
#endif

            try
            {
                xmlWriter.WriteStartDocument(false);
                result.ToXml(true).WriteTo(xmlWriter);
            }
            finally
            {
                xmlWriter.Close();
            }
        }
开发者ID:ChadBurggraf,项目名称:NUnitLite,代码行数:28,代码来源:NUnit3XmlOutputWriter.cs

示例7: ToXml

 private static XmlNode ToXml(ITestResult testResult)
 {
     var doc = new XmlDocument();
     doc.LoadXml("<foo />");
     return testResult.ToXml(doc.ChildNodes[0]);
 }
开发者ID:EddieGarmon,项目名称:resharper-xunit,代码行数:6,代码来源:FakeExecutorWrapper.cs

示例8: TestFinished

 /// <summary>
 /// Called when a test has finished. Sends a result summary to the callback.
 /// to 
 /// </summary>
 /// <param name="result">The result of the test</param>
 public void TestFinished(ITestResult result)
 {
     try
     {
         handler.RaiseCallbackEvent(result.ToXml(false).OuterXml);
     }
     catch (Exception ex)
     {
         log.Error("Exception processing " + result.FullName + NUnit.Env.NewLine + ex.ToString());
     }
 }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:16,代码来源:TestProgressReporter.cs

示例9: TestFinished

 /// <summary>
 /// Called when a test has finished. Sends a result summary to the callback.
 /// to 
 /// </summary>
 /// <param name="result">The result of the test</param>
 public void TestFinished(ITestResult result)
 {
     try
     {
         var node = result.ToXml(false);
         var parent = GetParent(result.Test);
         node.Attributes.Add("parentId", parent != null ? parent.Id : string.Empty);
         handler.RaiseCallbackEvent(node.OuterXml);                
     }
     catch (Exception ex)
     {
         log.Error("Exception processing " + result.FullName + NUnit.Env.NewLine + ex.ToString());
     }
 }
开发者ID:alfeg,项目名称:nunit,代码行数:19,代码来源:TestProgressReporter.cs


注:本文中的ITestResult.ToXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。