本文整理汇总了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();
}
示例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();
}
示例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());
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例7: ToXml
private static XmlNode ToXml(ITestResult testResult)
{
var doc = new XmlDocument();
doc.LoadXml("<foo />");
return testResult.ToXml(doc.ChildNodes[0]);
}
示例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());
}
}
示例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());
}
}