本文整理汇总了C#中NUnit.Core.TestResult.FindDescedant方法的典型用法代码示例。如果您正苦于以下问题:C# TestResult.FindDescedant方法的具体用法?C# TestResult.FindDescedant怎么用?C# TestResult.FindDescedant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Core.TestResult
的用法示例。
在下文中一共展示了TestResult.FindDescedant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeChildren
private void MergeChildren(TestResult other, TestResult merged)
{
if (other.Results == null)
return;
foreach (TestResult otherChild in other.Results)
{
var mergedChild = merged.FindDescedant(
d =>
{
if (otherChild.Test.TestType == TestType.Assembly.ToString()
&& d.Test.TestType == TestType.Assembly.ToString())
return Path.GetFileName(d.FullName).Equals(Path.GetFileName(otherChild.FullName));
return d.FullName.Equals(otherChild.FullName);
});
if (mergedChild == null)
{
AddResult(merged, otherChild);
continue;
}
Merge(otherChild, mergedChild);
}
}
示例2: AddForReprocessingIfRequired
/// <summary>
/// Adds for reprocessing if required.
/// </summary>
/// <param name="test">The test.</param>
/// <param name="result">The result.</param>
/// <param name="agent"> </param>
public void AddForReprocessingIfRequired(TestUnitWithMetadata test, TestResult result, AgentMetadata agent)
{
var request = requests != null ? requests.GetBy(test.Test.Run) : null;
Action registerReprocessing = () => { if (request != null) request.Statistics.RegisterReprocessing(); };
if (result == null)
{
test.AttachedData.NullReprocessingCount++;
collection.Add(test);
log.Info(string.Format("REPROCESSING (as null): '{0}' was added for reprocessing. [{1}]",
test.FullName, test.Test.Run));
registerReprocessing();
return;
}
if (!test.Test.Info.IsSuite)
{
var childResult = result.FindDescedant(d => d.FullName.Equals(test.FullName));
if (childResult != null
&& ProcessResult(childResult, test.Test.Run, test) == ReprocessingVerdict.PerformReprocessing)
{
AddTestForReprocessing(test, agent);
registerReprocessing();
}
return;
}
foreach (var suiteResult in result.FindBottomLevelTestSuites())
{
if (test.FullName.Equals(suiteResult.FullName))
{
var reprocessingVerdict = ProcessResult(suiteResult, test.Test.Run, test);
if (reprocessingVerdict == ReprocessingVerdict.MaximumCountWasReached)
return;
if (reprocessingVerdict == ReprocessingVerdict.PerformReprocessing)
{
AddTestForReprocessing(test, agent);
registerReprocessing();
continue;
}
}
var childrenForReprocessing = new List<Tuple<TestResult, TestUnitWithMetadata>>();
foreach (TestResult childResult in suiteResult.Results)
{
var childTest = test.Children.FirstOrDefault(ct => ct.FullName.Equals(childResult.FullName));
if (ProcessResult(childResult, test.Test.Run, childTest,
() =>
{
childTest = new TestUnitWithMetadata(test.Test.Run, childResult.Test, test.Test.AssemblyName);
test.Children.Add(childTest);
return childTest;
})==ReprocessingVerdict.PerformReprocessing)
childrenForReprocessing.Add(new Tuple<TestResult, TestUnitWithMetadata>(childResult, childTest));
}
if (childrenForReprocessing.Count > 0 && childrenForReprocessing.Count == suiteResult.Results.Count)
{
AddTestForReprocessing(test, agent);
registerReprocessing();
}
else
{
foreach (var childForReprocessing in childrenForReprocessing)
{
AddTestForReprocessing(childForReprocessing.Item2, agent);
registerReprocessing();
}
}
}
}