本文整理汇总了C#中ITypeInfo.GetDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeInfo.GetDisplayName方法的具体用法?C# ITypeInfo.GetDisplayName怎么用?C# ITypeInfo.GetDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo.GetDisplayName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
/// <summary>
/// TODO: Documentation needed for constructor
/// </summary>
/// <param name="typeInfo"></param>
protected Test(ITypeInfo typeInfo)
{
Initialize(typeInfo.GetDisplayName());
string nspace = typeInfo.Namespace;
if (nspace != null && nspace != "")
FullName = nspace + "." + Name;
TypeInfo = typeInfo;
}
示例2: BuildFrom
/// <summary>
/// Overload of BuildFrom called by tests that have arguments.
/// Builds a fixture using the provided type and information
/// in the ITestFixtureData object.
/// </summary>
/// <param name="typeInfo">The TypeInfo for which to construct a fixture.</param>
/// <param name="testFixtureData">An object implementing ITestFixtureData or null.</param>
/// <returns></returns>
public TestSuite BuildFrom(ITypeInfo typeInfo, ITestFixtureData testFixtureData)
{
Guard.ArgumentNotNull(testFixtureData, "testFixtureData");
object[] arguments = testFixtureData.Arguments;
if (typeInfo.ContainsGenericParameters)
{
Type[] typeArgs = testFixtureData.TypeArgs;
if (typeArgs.Length == 0)
{
int cnt = 0;
foreach (object o in arguments)
if (o is Type) cnt++;
else break;
typeArgs = new Type[cnt];
for (int i = 0; i < cnt; i++)
typeArgs[i] = (Type)arguments[i];
if (cnt > 0)
{
object[] args = new object[arguments.Length - cnt];
for (int i = 0; i < args.Length; i++)
args[i] = arguments[cnt + i];
arguments = args;
}
}
if (typeArgs.Length > 0 ||
TypeHelper.CanDeduceTypeArgsFromArgs(typeInfo.Type, arguments, ref typeArgs))
{
typeInfo = typeInfo.MakeGenericType(typeArgs);
}
}
var fixture = new TestFixture(typeInfo);
if (arguments != null && arguments.Length > 0)
{
string name = fixture.Name = typeInfo.GetDisplayName(arguments);
string nspace = typeInfo.Namespace;
fixture.FullName = nspace != null && nspace != ""
? nspace + "." + name
: name;
fixture.Arguments = arguments;
}
if (fixture.RunState != RunState.NotRunnable)
fixture.RunState = testFixtureData.RunState;
foreach (string key in testFixtureData.Properties.Keys)
foreach (object val in testFixtureData.Properties[key])
fixture.Properties.Add(key, val);
if (fixture.RunState != RunState.NotRunnable)
CheckTestFixtureIsValid(fixture);
fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());
AddTestCasesToFixture(fixture);
return fixture;
}