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


C# TestResult.Accept方法代码示例

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


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

示例1: DisplayResults

        public void DisplayResults( TestResult results )
        {
            notRunTree.BeginUpdate();
            results.Accept(this);
            notRunTree.EndUpdate();

            if( testDetails.Items.Count > 0 )
                testDetails.SelectedIndex = 0;
        }
开发者ID:taoxiease,项目名称:asegrp,代码行数:9,代码来源:DetailResults.cs

示例2: CreateXmlOutput

		private static string CreateXmlOutput( TestResult result )
		{
			StringBuilder builder = new StringBuilder();
			XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result);
			result.Accept(resultVisitor);
			resultVisitor.Write();

			return builder.ToString();
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:ConsoleUi.cs

示例3: FormatResult

        private void FormatResult(NUnit2Test testElement, TestResult result)
        {
            // temp file for storing test results
            string xmlResultFile = Path.GetTempFileName();

            // permanent file for storing test results
            string outputFile = null;

            try {
                XmlResultVisitor resultVisitor = new XmlResultVisitor(xmlResultFile, result);
                result.Accept(resultVisitor);
                resultVisitor.Write();

                foreach (FormatterElement formatter in FormatterElements) {
                    if (formatter.Type == FormatterType.Xml) {
                        if (formatter.UseFile) {
                            // determine file name for output file
                            outputFile = result.Name + "-results" + formatter.Extension;

                            if (formatter.OutputDirectory != null) {
                                // ensure output directory exists
                                if (!formatter.OutputDirectory.Exists) {
                                    formatter.OutputDirectory.Create();
                                }

                                // combine output directory and result filename
                                outputFile = Path.Combine(formatter.OutputDirectory.FullName,
                                    Path.GetFileName(outputFile));
                            }

                            // copy the temp result file to permanent location
                            File.Copy(xmlResultFile, outputFile, true);
                        } else {
                            using (StreamReader reader = new StreamReader(xmlResultFile)) {
                                // strip off the xml header
                                reader.ReadLine();
                                StringBuilder builder = new StringBuilder();
                                while (reader.Peek() > -1) {
                                    builder.Append(reader.ReadLine().Trim()).Append(
                                        Environment.NewLine);
                                }
                                Log(Level.Info, builder.ToString());
                            }
                        }
                    } else if (formatter.Type == FormatterType.Plain) {
                        TextWriter writer;
                        if (formatter.UseFile) {
                            // determine file name for output file
                            outputFile = result.Name + "-results" + formatter.Extension;

                            if (formatter.OutputDirectory != null) {
                                // ensure output directory exists
                                if (!formatter.OutputDirectory.Exists) {
                                    formatter.OutputDirectory.Create();
                                }

                                // combine output directory and result filename
                                outputFile = Path.Combine(formatter.OutputDirectory.FullName,
                                    Path.GetFileName(outputFile));
                            }

                            writer = new StreamWriter(outputFile);
                        } else {
                            writer = new LogWriter(this, Level.Info, CultureInfo.InvariantCulture);
                        }
                        CreateSummaryDocument(xmlResultFile, writer, testElement);
                        writer.Close();
                    }
                }
            } catch (Exception ex) {
                throw new BuildException("Test results could not be"
                    + " formatted.", Location, ex);
            } finally {
                // make sure temp file with test results is removed
                File.Delete(xmlResultFile);
            }
        }
开发者ID:skolima,项目名称:NAnt,代码行数:77,代码来源:NUnit2Task.cs

示例4: ResultSummarizer

		public ResultSummarizer(TestResult result)
		{
			result.Accept(visitor);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:ResultSummarizer.cs

示例5: CreateXmlOutput

 public static void CreateXmlOutput(TestResult result, TextWriter w)
 {
     XmlResultVisitor visitor = new XmlResultVisitor(w, result);
     result.Accept(visitor);
     visitor.Write();
 }
开发者ID:Xarlot,项目名称:reportformatter,代码行数:6,代码来源:NUnutHelper.cs


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