/// <summary>
        /// Make a test case from a given fixture type and method
        /// </summary>
        /// <param name="fixtureType">The fixture type</param>
        /// <param name="method">MethodInfo for the particular method</param>
        /// <returns>A test case or null</returns>
        public static TestCase Make(Type fixtureType, MethodInfo method)
        {
            TestCase testCase = null;

            if (Reflect.HasTestAttribute(method) || Reflect.IsObsoleteTestMethod(method))
            {
                if (Reflect.IsTestMethodSignatureCorrect(method))
                {
                    ITestBuilder builder = GetBuilder(method);
                    testCase = builder.Make(fixtureType, method);

                    if (Reflect.HasIgnoreAttribute(method))
                    {
                        testCase.ShouldRun    = false;
                        testCase.IgnoreReason = Reflect.GetIgnoreReason(method);
                    }

                    if (Reflect.HasCategoryAttribute(method))
                    {
                        IList categories = Reflect.GetCategories(method);
                        CategoryManager.Add(categories);
                        testCase.Categories = categories;
                    }

                    testCase.IsExplicit = Reflect.HasExplicitAttribute(method);

                    testCase.Description = Reflect.GetDescription(method);
                }
                else
                {
                    testCase = new NotRunnableTestCase(method);
                }
            }

            return(testCase);
        }
Beispiel #2
0
		/// <summary>
		/// Make a test case from a given fixture type and method
		/// </summary>
		/// <param name="fixtureType">The fixture type</param>
		/// <param name="method">MethodInfo for the particular method</param>
		/// <returns>A test case or null</returns>
		public static TestCase Make(Type fixtureType, MethodInfo method)
		{
			TestCase testCase = null;

			if( Reflect.HasTestAttribute(method) || Reflect.IsObsoleteTestMethod( method ) )
			{
				if( Reflect.IsTestMethodSignatureCorrect( method ) )
				{
					ITestBuilder builder = GetBuilder(method);
					testCase = builder.Make(fixtureType, method);

					if(Reflect.HasIgnoreAttribute(method))
					{
						testCase.ShouldRun = false;
						testCase.IgnoreReason = Reflect.GetIgnoreReason(method);
					}

					if (Reflect.HasCategoryAttribute(method)) 
					{
						IList categories = Reflect.GetCategories(method);
						CategoryManager.Add(categories);
						testCase.Categories = categories;
					}

					testCase.IsExplicit = Reflect.HasExplicitAttribute(method);

					testCase.Description = Reflect.GetDescription(method);
				}
				else
				{
					testCase = new NotRunnableTestCase(method);
				}
			}

			return testCase;
		}