Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether the method is a test method. A method
        /// is considered to be a test method if it contains the NUnit Test attribute.
        /// If the method has parameters it cannot be a test method.
        /// </summary>
        bool IsTestMethod(IMember member)
        {
            if (member == null)
            {
                return(false);
            }

            StringComparer nameComparer = GetNameComparer(member.DeclaringType);

            if (nameComparer != null)
            {
                MbUnitTestAttributeName testAttribute = new MbUnitTestAttributeName("Test", nameComparer);
                foreach (IAttribute attribute in member.Attributes)
                {
                    if (testAttribute.IsEqual(attribute))
                    {
                        IMethod method = (IMethod)member;
                        if (method.Parameters.Count == 0)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
		public bool IsTestClass(IClass c)
		{
			StringComparer nameComparer = GetNameComparer(c);
			if (nameComparer != null) {
				MbUnitTestAttributeName testAttributeName = new MbUnitTestAttributeName("TestFixture", nameComparer);
				foreach (IAttribute attribute in c.Attributes) {
					if (testAttributeName.IsEqual(attribute)) {
						return true;
					}
				}
			}
			return false;
		}
Ejemplo n.º 3
0
        public bool IsTestClass(IClass c)
        {
            StringComparer nameComparer = GetNameComparer(c);

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