Beispiel #1
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.PresentableName.StartsWith("System.Void"))
            {
                return(false);
            }

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

            return(false);
        }
Beispiel #2
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);
        }