本文整理汇总了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;
}
示例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();
}
示例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);
}
}
示例4: ResultSummarizer
public ResultSummarizer(TestResult result)
{
result.Accept(visitor);
}
示例5: CreateXmlOutput
public static void CreateXmlOutput(TestResult result, TextWriter w)
{
XmlResultVisitor visitor = new XmlResultVisitor(w, result);
result.Accept(visitor);
visitor.Write();
}