static string FullyQualifiedName(this IMetadataClassType classType, bool appendAssembly) { var fullyQualifiedName = new StringBuilder(); fullyQualifiedName.Append(classType.Type.FullyQualifiedName); if (classType.Arguments.Length > 0) { fullyQualifiedName.Append("["); fullyQualifiedName.Append( String.Join(",", classType.Arguments .Select(x => x as IMetadataClassType) .Where(x => x != null) .Select(x => "[" + x.FullyQualifiedName(true) + "]") .ToArray())); fullyQualifiedName.Append("]"); } if (appendAssembly) { fullyQualifiedName.Append(classType.AssemblyQualification); } return(fullyQualifiedName.ToString()); }
// IsGenericParameter indicates that this type is a type representing a generic // "placeholder", e.g. T. A generic argument is the value that populates a generic // parameter. So for IEnumerable<T>, T is a generic parameter. For IEnumerable<string>, // string is a generic argument private MetadataTypeInfoAdapter2(IMetadataClassType metadataType, IMetadataTypeInfo metadataTypeInfo) { // Assertion.Assert(metadataTypeInfo.IsResolved, "Unresolved type: {0}", metadataType); Assertion.Assert(metadataTypeInfo != null, "metadataTypeInfo cannot be null"); this.metadataType = metadataType; this.metadataTypeInfo = metadataTypeInfo; }
private static bool HasTestFixtureAttribute(IMetadataTypeInfo typeInfo) { if (typeInfo.HasCustomAttribute(TestFixtureAttribute.ClrName)) { return(true); } IMetadataClassType baseType = typeInfo.Base; if (baseType != null) { return(HasTestFixtureAttribute(baseType.Type)); } return(false); }
private static List <IMetadataMethod> GetAllTestMethods(IMetadataTypeInfo typeInfo) { var list = new List <IMetadataMethod>(); var map = new OneToListMap <string, IMetadataMethod>(); while (typeInfo != null) { foreach (IMetadataMethod method in typeInfo.GetMethods()) { if (!IsTestMethod(method)) { continue; } if (map.ContainsKey(method.Name) && (method.IsVirtual)) { bool hasOverride = false; foreach (IMetadataMethod metadataMethod in map[method.Name]) { if (metadataMethod.IsVirtual && !metadataMethod.IsNewSlot) { hasOverride = true; } } if (hasOverride) { continue; } } map.AddValue(method.Name, method); list.Add(method); } IMetadataClassType baseType = typeInfo.Base; typeInfo = (baseType != null) ? baseType.Type : null; } return(list); }
public static string FullyQualifiedName(this IMetadataClassType classType) { return(FullyQualifiedName(classType, false)); }
public MetadataTypeInfoAdapter2(IMetadataClassType metadataType, IMetadataGenericArgument genericArgument) : this(metadataType, metadataType.Type) { this.genericArgument = genericArgument; }
public MetadataTypeInfoAdapter2(IMetadataClassType metadataType) : this(metadataType, metadataType.Type) { }
public MetadataTypeInfoAdapter(IMetadataTypeInfo type, IMetadataClassType classType = null) { _type = type; _classType = classType; }
public static ITypeInfo AsTypeInfo(this IMetadataTypeInfo type, IMetadataClassType classType = null) { return(new MetadataTypeInfoAdapter(type, classType)); }