예제 #1
0
        /// <summary>
        /// Determines whether the method is a test method. A method
        /// is considered to be a test method if it contains certain
        /// test attributes. If the method has parameters it cannot
        /// be a test method.
        /// </summary>
        public static bool IsTestMethod(IMember member)
        {
            if (member == null)
            {
                return(false);
            }

            StringComparer nameComparer = TestClass.GetNameComparer(member.DeclaringType);

            if (nameComparer != null)
            {
                TestAttributeName testAttribute = new TestAttributeName("Test", nameComparer);
                foreach (IAttribute attribute in member.Attributes)
                {
                    if (testAttribute.IsEqual(attribute.AttributeType.FullyQualifiedName))
                    {
                        IMethod method = (IMethod)member;
                        if (method.Parameters.Count == 0)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
예제 #2
0
		/// <summary>
		/// Determines whether the class is a test fixture. A class
		/// is considered to be a test class if it contains certain
		/// test attributes.
		/// </summary>
		public static bool IsTestClass(IClass c)
		{
			StringComparer nameComparer = GetNameComparer(c);
			if (nameComparer != null) {
				TestAttributeName testAttributeName = new TestAttributeName("TestFixture", nameComparer);
				foreach (IAttribute attribute in c.Attributes) {
					if (testAttributeName.IsEqual(attribute.AttributeType.FullyQualifiedName)) {
						return true;
					}
				}
			}
			return false;
		}
예제 #3
0
        /// <summary>
        /// Determines whether the class is a test fixture. A class
        /// is considered to be a test class if it contains certain
        /// test attributes.
        /// </summary>
        public static bool IsTestClass(IClass c)
        {
            StringComparer nameComparer = GetNameComparer(c);

            if (nameComparer != null)
            {
                TestAttributeName testAttributeName = new TestAttributeName("TestFixture", nameComparer);
                foreach (IAttribute attribute in c.Attributes)
                {
                    if (testAttributeName.IsEqual(attribute.AttributeType.FullyQualifiedName))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #4
0
		/// <summary>
		/// Determines whether the method is a test method. A method
		/// is considered to be a test method if it contains certain
		/// test attributes. If the method has parameters it cannot
		/// be a test method.
		/// </summary>
		public static bool IsTestMethod(IMember member)
		{
			if (member == null) {
				return false;
			}
			
			StringComparer nameComparer = TestClass.GetNameComparer(member.DeclaringType);
			if (nameComparer != null) {
				TestAttributeName testAttribute = new TestAttributeName("Test", nameComparer);
				foreach (IAttribute attribute in member.Attributes) {
					if (testAttribute.IsEqual(attribute.AttributeType.FullyQualifiedName)) {
						IMethod method = (IMethod)member;
						if (method.Parameters.Count == 0) {
							return true;
						}
					}
				}
			}
			return false;
		}