本文整理汇总了C#中NUnit.Core.TestResult.SetAgentName方法的典型用法代码示例。如果您正苦于以下问题:C# TestResult.SetAgentName方法的具体用法?C# TestResult.SetAgentName怎么用?C# TestResult.SetAgentName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Core.TestResult
的用法示例。
在下文中一共展示了TestResult.SetAgentName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Merge
/// <summary>
/// Merges the specified other.
/// </summary>
/// <param name="source"> </param>
/// <param name="target"> </param>
public void Merge(TestResult source, TestResult target)
{
var mergedType = GetType(target);
var otherType = GetType(source);
if (mergedType == TestType.Project && otherType == TestType.Project)
{
if (string.IsNullOrEmpty(target.FullName) && !string.IsNullOrEmpty(source.FullName))
{
target.Test.TestName.FullName = source.FullName;
target.Test.TestName.Name = source.Name;
}
}
if (mergedType != otherType)
throw new NotSupportedException("Only merging of results with same test type are supported");
if (!target.IsSuccess && source.IsSuccess)
{
target.Success(source.Message);
target.SetAgentName(source.GetAgentName());
}
MergeChildren(source, target);
}
示例2: CreateTestResult
public TestResult CreateTestResult(TestType type, string fullName,
ResultState state = ResultState.Success,
Func<IEnumerable<TestResult>> children = null,
string stackTrace = null,
string description = null,
IList categories = null,
string agentName = null)
{
description = description ?? RandomValuesGenerator.GetRandomValue<string>();
agentName = agentName ?? RandomValuesGenerator.GetRandomValue<string>();
var splitted = (fullName ?? string.Empty).Split(new[]{'.'}, StringSplitOptions.RemoveEmptyEntries);
var childResults = children != null ? children() : new TestResult[0];
var testResult = new TestResult(new TestInfoWrapper
{
TestName = new TestName
{
FullName = fullName,
Name = splitted.Length > 0 ? splitted[splitted.Length - 1] : string.Empty
},
Categories = categories,
IsSuite = type != TestType.TestMethod,
TestCount = type == TestType.TestMethod ? 1 : RandomValuesGenerator.GetRandomValue<int>(),
TestType = type.ToString()
})
{
AssertCount = 1,
Time = RandomValuesGenerator.GetRandomValue<double>()
};
if (state != ResultState.Success)
testResult.SetResult(state,
description,
stackTrace);
else
testResult.Success(description);
testResult.SetAgentName(agentName);
foreach (var childResult in childResults)
{
testResult.AddResult(childResult);
}
return testResult;
}