コード例 #1
0
 private MetadataMethodInfoAdapter2(MetadataTypeInfoAdapter2 typeInfo, IMetadataMethod method,
                                    ITypeInfo[] substitutions)
 {
     this.typeInfo      = typeInfo;
     this.method        = method;
     this.substitutions = substitutions;
 }
コード例 #2
0
        public bool IsValidTestMethod(IProject project, IMetadataMethod metadataMethod)
        {
            if (project == null || metadataMethod == null)
                return false;

            return IsValidTestMethod(project, metadataMethod.DeclaringType.FullyQualifiedName, metadataMethod.Name);
        }
コード例 #3
0
 private MetadataMethodInfoAdapter2(MetadataTypeInfoAdapter2 typeInfo, IMetadataMethod method,
     ITypeInfo[] substitutions)
 {
     this.typeInfo = typeInfo;
     this.method = method;
     this.substitutions = substitutions;
 }
コード例 #4
0
 private bool IsTestMethod(IMetadataMethod method)
 {
     if (method.IsAbstract || !method.IsPublic)
     {
         return(false);
     }
     return(HasAttributeOrDerivedAttribute(method, UnityTestProvider.UnityTestAttribute));
 }
コード例 #5
0
 public static MethodModifiers FromMethod(IMetadataMethod method)
 {
     if (method == null)
     {
         throw new ArgumentNullException(nameof(method));
     }
     return(new MethodModifiers(method.Visibility, method.IsStatic, method.IsAbstract, method.IsVirtual, method.IsFinal, method.IsOverride));
 }
コード例 #6
0
        public bool IsValidTestMethod(IProject project, IMetadataMethod metadataMethod)
        {
            if (project == null || metadataMethod == null)
            {
                return(false);
            }

            return(IsValidTestMethod(project, metadataMethod.DeclaringType.FullyQualifiedName, metadataMethod.Name));
        }
コード例 #7
0
 public ReaderProperty(MetadataReader reader, TypeReferenceTypeProvider typeProvider, PropertyDefinition definition, GenericContext genericContext, IMetadataMethod getAccessor, IMetadataMethod setAccessor)
 {
     this.reader         = reader;
     this.typeProvider   = typeProvider;
     this.definition     = definition;
     this.genericContext = genericContext;
     GetAccessor         = getAccessor;
     SetAccessor         = setAccessor;
 }
コード例 #8
0
 public ReaderEvent(MetadataReader reader, TypeReferenceTypeProvider typeProvider, EventDefinition definition, GenericContext genericContext, IMetadataMethod addAccessor, IMetadataMethod removeAccessor, IMetadataMethod raiseAccessor)
 {
     this.reader         = reader;
     this.typeProvider   = typeProvider;
     this.definition     = definition;
     this.genericContext = genericContext;
     AddAccessor         = addAccessor;
     RemoveAccessor      = removeAccessor;
     RaiseAccessor       = raiseAccessor;
 }
コード例 #9
0
        private static string GetAttributeName(IMetadataCustomAttribute attribute)
        {
            IMetadataMethod constructor = attribute.UsedConstructor;

            if (constructor == null)
            {
                return(null);
            }

            IMetadataTypeInfo declaringType = constructor.DeclaringType;

            if (declaringType == null)
            {
                return(null);
            }

            return(declaringType.FullyQualifiedName);
        }
コード例 #10
0
ファイル: MSTestProvider.cs プロジェクト: locbet/sneal
        private static bool IsTestMethod(IMetadataMethod method)
        {
            if (method.IsStatic || method.IsAbstract || !method.IsPublic)
            {
                return(false);
            }
            if (method.Parameters.Length != 0 || method.GenericArguments.Length != 0)
            {
                return(false);
            }
            if (!method.ReturnValue.Type.PresentableName.StartsWith("System.Void"))
            {
                return(false);
            }

            if (method.HasCustomAttribute(TestAttribute.ClrName))
            {
                return(true);
            }

            return(false);
        }
コード例 #11
0
        private static bool IsTestMethod(IMetadataMethod method)
        {
            if (method.IsStatic || method.IsAbstract || !method.IsPublic)
            {
                return(false);
            }
            if (method.Parameters.Length != 0 || method.GenericArguments.Length != 0)
            {
                return(false);
            }
            if (!method.ReturnValue.Type.AssemblyQualifiedName.StartsWith("System.Void"))
            {
                return(false);
            }

            if (method.HasCustomAttribute(TestAttribute.ClrName))
            {
                return(true);
            }

            if (method.Name.StartsWith("test", true, CultureInfo.InvariantCulture))
            {
                IMetadataCustomAttribute[] attributes = method.CustomAttributes;
                foreach (IMetadataCustomAttribute attribute in attributes)
                {
                    string name = GetAttributeName(attribute);
                    if (name != null && name.StartsWith("csUnit."))
                    {
                        return(false);
                    }
                }
                return(true);
            }

            return(false);
        }
コード例 #12
0
 public MetadataMethodInfoAdapter(IMetadataMethod method)
 {
     this.method = method;
 }
コード例 #13
0
 public static CommonMember ToCommon(this IMetadataMethod member)
 {
     return(IntrospectionUtility.Instance.GetCommonMember(member));
 }
コード例 #14
0
 public MetadataMethodInfoAdapter2(MetadataTypeInfoAdapter2 typeInfo, IMetadataMethod method)
     : this(typeInfo, method, null)
 {
 }
コード例 #15
0
        private void ExploreMethod(IProject project, IMetadataAssembly metadataAssembly, UnitTestElementConsumer consumer, IMetadataMethod metadataMethod)
        {
            if (conventionCheck.IsValidTestMethod(project, metadataMethod))
            {
                bool isParameterised = conventionCheck.IsParameterizedMethod(
                    project,
                    metadataMethod.DeclaringType.FullyQualifiedName,
                    metadataMethod.Name);

                var methodUnitTestElement = unitTestElementFactory.GetOrCreateTestMethod(project, new ClrTypeName(metadataMethod.DeclaringType.FullyQualifiedName), metadataMethod.Name, metadataAssembly.Location.FullPath, isParameterised);
                consumer(methodUnitTestElement);
            }
        }
コード例 #16
0
			public MetadataMethodWrapper(IMetadataMethod metadataMethod)
			{
				this.metadataMethod = metadataMethod;
			}
コード例 #17
0
 private bool HasAttributeOrDerivedAttribute(IMetadataMethod method, params IClrTypeName[] attributeClrNames)
 {
     return(myUnitTestAttributeCache.HasAttributeOrDerivedAttribute(myProject, method, attributeClrNames));
 }
コード例 #18
0
 public MetadataMethodInfoAdapter2(MetadataTypeInfoAdapter2 typeInfo, IMetadataMethod method)
     : this(typeInfo, method, null)
 {
 }
コード例 #19
0
 public CommonMember GetCommonMember(IMetadataMethod member)
 {
     return(GetCommonMember(member, member.ReturnValue.Type));
 }
コード例 #20
0
 public static IMethodInfo AsMethodInfo(this IMetadataMethod method)
 {
     return(new MetadataMethodInfoAdapter(method));
 }
コード例 #21
0
 public MetadataMethodInfoAdapter(IMetadataMethod method)
 {
     this.method = method;
 }