Esempio n. 1
0
        public static NUnitTestMethod MakeTestCase(object fixture, string methodName)
        {
            NUnitTestMethod test = MakeTestCase(fixture.GetType(), methodName);

            test.Fixture = fixture;
            return(test);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes an instance of <see cref="InconclusiveTestCase"/>.
        /// </summary>
        /// <param name="testCase">Original test case.</param>
        public InconclusiveTestCase(NUnitTestMethod testCase)
            : base(testCase.Method)
        {
            NUnitFramework.ApplyCommonAttributes(testCase.Method, this);
            NUnitFramework.ApplyExpectedExceptionAttribute(testCase.Method, this);

            // Copy all the attributes of the original test
            this.BuilderException   = testCase.BuilderException;
            this.Categories         = testCase.Categories;
            this.Description        = testCase.Description;
            this.ExceptionProcessor = testCase.ExceptionProcessor;
            this.Fixture            = testCase.Fixture;
            this.IgnoreReason       = testCase.IgnoreReason;
            this.Parent             = testCase.Parent;
            this.Properties         = testCase.Properties;
            this.RunState           = testCase.RunState;
            this.TestName.Name      = testCase.TestName.Name;
            this.TestName.FullName  = testCase.TestName.FullName;
            this.TestName.RunnerID  = testCase.TestName.RunnerID;
            this.TestName.TestID    = testCase.TestName.TestID;

            this.setUpMethods    = GetFieldValue <MethodInfo[]>(typeof(TestMethod), testCase, "setUpMethods");
            this.tearDownMethods = GetFieldValue <MethodInfo[]>(typeof(TestMethod), testCase, "tearDownMethods");
            this.actions         = GetFieldValue <TestAction[]>(typeof(TestMethod), testCase, "actions");
            this.suiteActions    = GetFieldValue <TestAction[]>(typeof(TestMethod), testCase, "suiteActions");

            this.SetFieldValue("arguments", GetFieldValue <object[]>(typeof(TestMethod), testCase, "arguments"));
            this.SetFieldValue("expectedResult", GetFieldValue <object>(typeof(TestMethod), testCase, "expectedResult"));
            this.SetFieldValue("hasExpectedResult", GetFieldValue <bool>(typeof(TestMethod), testCase, "hasExpectedResult"));
        }
Esempio n. 3
0
 public WebDriverTestMethod(NUnitTestMethod method, bool needsNewDriverBeforeTest, bool needsNewDriverAfterTest)
     : base(method.Method)
 {
     this.needsDriverBefore  = needsNewDriverBeforeTest;
     this.needsDriverAfter   = needsNewDriverAfterTest;
     this.ExceptionProcessor = method.ExceptionProcessor;
 }
Esempio n. 4
0
        public void TestCases(MethodInfo method, RunState state)
        {
            Test built = _sut.BuildFrom(method);

            NUnitTestMethod testMethod = built.Tests[0] as NUnitTestMethod;

            Assert.IsNotNull(testMethod);

            Assert.That(testMethod.RunState, Is.EqualTo(state));
        }
Esempio n. 5
0
        public void SetUp()
        {
            MethodInfo fakeTestMethod1 = GetType()
                                         .GetMethod("FakeTestMethod1", BindingFlags.Instance | BindingFlags.NonPublic);

            fakeTest1 = new NUnitTestMethod(fakeTestMethod1);
            MethodInfo fakeTestMethod2 = GetType()
                                         .GetMethod("FakeTestMethod2", BindingFlags.Instance | BindingFlags.NonPublic);

            fakeTest2 = new NUnitTestMethod(fakeTestMethod2);
        }
        public WebDriverTestMethod(NUnitTestMethod method, bool needsNewDriverBeforeTest, bool needsNewDriverAfterTest)
            : base(method.Method)
        {
            this.needsDriverBefore = needsNewDriverBeforeTest;
            this.needsDriverAfter  = needsNewDriverAfterTest;

            this.ExceptionExpected     = method.ExceptionExpected;
            this.ExceptionHandler      = method.ExceptionHandler;
            this.ExpectedExceptionName = method.ExpectedExceptionName;
            this.ExpectedExceptionType = method.ExpectedExceptionType;
            this.ExpectedMessage       = method.ExpectedMessage;
        }
Esempio n. 7
0
        public string SetTestName(NUnitTestMethod test, string newName)
        {
            string previousName = test.TestName.Name;

            test.TestName.Name = newName;
            // Just in case the class name is the same as the test name, we only want to replace the test name portion
            // test.TestName.FullName = test.TestName.FullName.Replace(previousName, newName);
            int indexOfTestName = test.TestName.FullName.LastIndexOf(previousName);

            test.TestName.FullName  = test.TestName.FullName.Remove(indexOfTestName);
            test.TestName.FullName += newName;
            return(test.TestName.FullName);
        }
Esempio n. 8
0
        public RetriedTestMethod(NUnitTestMethod test, int tryCount, int requiredPassCount)
            : base(test.TestName)
        {
            this.backingTest       = test;
            this.tryCount          = tryCount;
            this.requiredPassCount = requiredPassCount;

            this.Properties   = backingTest.Properties;
            this.Categories   = backingTest.Categories;
            this.Description  = backingTest.Description;
            this.IgnoreReason = backingTest.IgnoreReason;
            this.RunState     = backingTest.RunState;
        }
Esempio n. 9
0
        public void TestMethodSpecifiedInInitialize()
        {
            var method     = new DefaultUnresolvedMethod(new DefaultUnresolvedTypeDefinition("TestFixture"), "Test");
            var testMethod = new NUnitTestMethod(testProject, method);
            NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testMethod });

            app.NoLogo          = false;
            app.ShadowCopy      = true;
            app.NoXmlOutputFile = false;

            string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture.Test\"";

            Assert.AreEqual(expectedCommandLine, app.GetArguments());
        }
        public override void SetUp()
        {
            base.SetUp();
            AddCodeFile("test.cs", @"using NUnit.Framework;
namespace RootNamespace.Tests {
	[TestFixture]
	class MyTestFixture {
		[Test] public void TestMethod1() {}
		[Test] public void TestMethod2() {}
	}
}");
            testClass   = testProject.GetTestClass(new FullTypeName("RootNamespace.Tests.MyTestFixture"));
            testMethod1 = testClass.FindTestMethod("TestMethod1");
            testMethod2 = testClass.FindTestMethod("TestMethod2");
        }
Esempio n. 11
0
        public Test Decorate(Test test, MemberInfo member)
        {
            NUnitTestMethod testMethod = test as NUnitTestMethod;

            if (testMethod != null && testMethod.RunState == RunState.Runnable)
            {
                List <Attribute> ignoreAttributes = new List <Attribute>();
                Attribute[]      ignoreAttr       = Reflect.GetAttributes(member, IgnoreBrowserAttributeTypeFullName, true);
                if (ignoreAttr != null)
                {
                    ignoreAttributes.AddRange(ignoreAttr);
                }

                Attribute[] ignoreClassAttributes = Reflect.GetAttributes(member.DeclaringType, IgnoreBrowserAttributeTypeFullName, true);
                if (ignoreClassAttributes != null)
                {
                    ignoreAttributes.AddRange(ignoreClassAttributes);
                }

                foreach (Attribute attr in ignoreAttributes)
                {
                    IgnoreBrowserAttribute browserToIgnoreAttr = attr as IgnoreBrowserAttribute;
                    if (browserToIgnoreAttr != null && IgnoreTestForBrowser(browserToIgnoreAttr.Value))
                    {
                        string ignoreReason = "Ignoring browser " + EnvironmentManager.Instance.Browser.ToString() + ".";
                        if (!string.IsNullOrEmpty(browserToIgnoreAttr.Reason))
                        {
                            ignoreReason = ignoreReason + " " + browserToIgnoreAttr.Reason;
                        }

                        test.RunState     = RunState.Ignored;
                        test.IgnoreReason = ignoreReason;
                    }
                }


                if (test.RunState == RunState.Runnable)
                {
                    NeedsFreshDriverAttribute needsDriverAttr = Reflect.GetAttribute(member, NeedsFreshDriverAttributeTypeFullName, false) as NeedsFreshDriverAttribute;
                    if (needsDriverAttr != null)
                    {
                        test = new WebDriverTestMethod(testMethod, needsDriverAttr.BeforeTest, needsDriverAttr.AfterTest);
                    }
                }
            }

            return(test);
        }
        /// <summary>
        /// Initializes an instance of this class.
        /// </summary>
        /// <param name="fixtureType">The type of the test fixture</param>
        /// <param name="param">The argument to pass to the Test Fixture Set Up method</param>
        public BrowserStackFixture(Type fixtureType, string param) : base(fixtureType)
        {
            this.Fixture = Reflect.Construct(fixtureType);
            this.Param   = param;
            ModifyTestName(this.TestName, param);
            this.fixtureTearDownMethods = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.FixtureTearDownAttribute, true);
            this.setUpMethods           = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.SetUpAttribute, true);
            this.tearDownMethods        = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TearDownAttribute, true);

            foreach (MethodInfo method in Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TestAttribute, true))
            {
                NUnitTestMethod methodTest = new NUnitTestMethod(method);
                ModifyTestName(methodTest.TestName, param);
                this.Add(methodTest);
            }
        }
        public override void SetUp()
        {
            base.SetUp();
            resultChangedCalled = false;
            AddCodeFile("test.cs", @"
using NUnit.Framework;
namespace RootNamespace.Tests {
	[TestFixture]
	class MyTestFixture {
		[Test]
		public void TestMethod() { }
	}
}");
            testClass  = (NUnitTestClass)testProject.NestedTests.Single().NestedTests.Single();
            testMethod = (NUnitTestMethod)testClass.NestedTests.Single();
        }
        /// <summary>
        /// Builds a single NUnitTestMethod, either as a child of the fixture
        /// or as one of a set of test cases under a ParameterizedTestMethodSuite.
        /// </summary>
        /// <param name="method">The MethodInfo from which to construct the TestMethod</param>
        /// <param name="parms">The ParameterSet to be used, or null</param>
        /// <returns></returns>
        public static NUnitTestMethod BuildSingleTestMethod(MethodInfo method, ParameterSet parms)
        {
            NUnitTestMethod testMethod = new NUnitTestMethod(method);

            if (CheckTestMethodSignature(testMethod, parms))
            {
                NUnitFramework.ApplyCommonAttributes(method, testMethod);
                NUnitFramework.ApplyExpectedExceptionAttribute(method, testMethod);
            }

            if (parms != null)
            {
                // NOTE: After the call to CheckTestMethodSignature, the Method
                // property of testMethod may no longer be the same as the
                // original MethodInfo, so we reassign it here.
                method = testMethod.Method;
                if (parms.TestName != null)
                {
                    testMethod.TestName.Name     = parms.TestName;
                    testMethod.TestName.FullName = method.ReflectedType.FullName + "." + parms.TestName;
                }
                else if (parms.Arguments != null)
                {
                    string name = MethodHelper.GetDisplayName(method, parms.Arguments);
                    testMethod.TestName.Name     = name;
                    testMethod.TestName.FullName = method.ReflectedType.FullName + "." + name;
                }

                if (parms.ExpectedExceptionName != null)
                {
                    testMethod.exceptionProcessor = new ExpectedExceptionProcessor(testMethod, parms);
                }

                foreach (string key in parms.Properties.Keys)
                {
                    testMethod.Properties.Add(key, parms.Properties[key]);
                }

                // Description is stored in parms.Properties
                if (parms.Description != null)
                {
                    testMethod.Description = parms.Description;
                }
            }

            return(testMethod);
        }
        public override void SetUp()
        {
            base.SetUp();
            AddCodeFileInNamespace("base.cs", @"
abstract class MyTestFixtureBase {
	[Test] public void MyTest() {}
	[Test] public void MyTest() {}
}");
            AddCodeFileInNamespace("derived.cs", @"
class MyTestFixture : MyTestFixtureBase {
	[Test] public void MyTest() {}
	[Test] public void MyTest() {}
}");
            testClass     = testProject.NestedTests.Cast <NUnitTestClass>().Single(c => c.ClassName == "MyTestFixture");
            baseMethod    = testClass.FindTestMethod("MyTestFixtureBase.MyTest");
            derivedMethod = testClass.FindTestMethod("MyTest");
        }
Esempio n. 16
0
		public MaxTimeTestCase( NUnitTestMethod testCase, int maxTime, bool expectFailure )
			: base( testCase.Method )
		{
			this.maxTime = maxTime;
			this.expectFailure = expectFailure;

			// Copy all the attributes of the original test
			this.Description = testCase.Description;
			this.Fixture = testCase.Fixture;
			this.Parent = testCase.Parent;
			this.RunState = testCase.RunState;
			this.IgnoreReason = testCase.IgnoreReason;
			this.ExceptionExpected = testCase.ExceptionExpected;
			this.ExpectedExceptionName = testCase.ExpectedExceptionName;
			this.ExpectedExceptionType = testCase.ExpectedExceptionType;
			this.ExpectedMessage = testCase.ExpectedMessage;
			this.Properties = testCase.Properties;
			this.Categories = testCase.Categories;
		}
Esempio n. 17
0
        public MaxTimeTestCase(NUnitTestMethod testCase, int maxTime, bool expectFailure)
            : base(testCase.Method)
        {
            this.maxTime       = maxTime;
            this.expectFailure = expectFailure;

            // Copy all the attributes of the original test
            this.Description           = testCase.Description;
            this.Fixture               = testCase.Fixture;
            this.Parent                = testCase.Parent;
            this.RunState              = testCase.RunState;
            this.IgnoreReason          = testCase.IgnoreReason;
            this.ExceptionExpected     = testCase.ExceptionExpected;
            this.ExpectedExceptionName = testCase.ExpectedExceptionName;
            this.ExpectedExceptionType = testCase.ExpectedExceptionType;
            this.ExpectedMessage       = testCase.ExpectedMessage;
            this.Properties            = testCase.Properties;
            this.Categories            = testCase.Categories;
        }
Esempio n. 18
0
        public void SetUp()
        {
            MethodInfo fakeTestMethod = GetType().GetMethod("FakeTestCase", BindingFlags.Instance | BindingFlags.NonPublic);
            var        nunitTest      = new NUnitTestMethod(fakeTestMethod);

            nunitTest.Categories.Add("cat1");
            nunitTest.Properties.Add("Priority", "medium");

            var nunitFixture = new TestSuite("FakeNUnitFixture");

            nunitFixture.Categories.Add("super");
            nunitFixture.Add(nunitTest);

            Assert.That(nunitTest.Parent, Is.SameAs(nunitFixture));

            var fixtureNode = new TestNode(nunitFixture);

            fakeNUnitTest = (ITest)fixtureNode.Tests[0];

            testConverter = new TestConverter(new TestLogger(), ThisAssemblyPath);
        }
        /// <summary>
        /// Builds a single NUnitTestMethod, either as a child of the fixture 
        /// or as one of a set of test cases under a ParameterizedTestMethodSuite.
        /// </summary>
        /// <param name="method">The MethodInfo from which to construct the TestMethod</param>
        /// <param name="parms">The ParameterSet to be used, or null</param>
        /// <returns></returns>
        public static NUnitTestMethod BuildSingleTestMethod(MethodInfo method, Test parentSuite, ParameterSet parms)
        {
            NUnitTestMethod testMethod = new NUnitTestMethod(method);

            string prefix = method.ReflectedType.FullName;

            if (parentSuite != null)
            {
                prefix = parentSuite.TestName.FullName;
                testMethod.TestName.FullName = prefix + "." + testMethod.TestName.Name;
            }

            if (CheckTestMethodSignature(testMethod, parms))
            {
                if (parms == null)
                    NUnitFramework.ApplyCommonAttributes(method, testMethod);
                NUnitFramework.ApplyExpectedExceptionAttribute(method, testMethod);
            }

            if (parms != null)
            {
                // NOTE: After the call to CheckTestMethodSignature, the Method
                // property of testMethod may no longer be the same as the
                // original MethodInfo, so we reassign it here.
                method = testMethod.Method;

                if (parms.TestName != null)
                {
                    testMethod.TestName.Name = parms.TestName;
                    testMethod.TestName.FullName = prefix + "." + parms.TestName;
                }
                else if (parms.OriginalArguments != null)
                {
                    string name = MethodHelper.GetDisplayName(method, parms.OriginalArguments);
                    testMethod.TestName.Name = name;
                    testMethod.TestName.FullName = prefix + "." + name;
                }

                if (parms.Ignored)
                {
                    testMethod.RunState = RunState.Ignored;
                    testMethod.IgnoreReason = parms.IgnoreReason;
                }

                if (parms.ExpectedExceptionName != null)
                    testMethod.exceptionProcessor = new ExpectedExceptionProcessor(testMethod, parms);

                foreach (string key in parms.Properties.Keys)
                    testMethod.Properties[key] = parms.Properties[key];

                // Description is stored in parms.Properties
                if (parms.Description != null)
                    testMethod.Description = parms.Description;
            }

            if (testMethod.BuilderException != null)
                testMethod.RunState = RunState.NotRunnable;

            return testMethod;
        }
 public RetriedTestMethod(NUnitTestMethod test, int tryCount, int requiredPassCount)
     : base(test.Method)
 {
     _tryCount          = tryCount;
     _requiredPassCount = requiredPassCount;
 }
        /// <summary>
        /// Builds a single NUnitTestMethod, either as a child of the fixture 
        /// or as one of a set of test cases under a ParameterizedTestMethodSuite.
        /// </summary>
        /// <param name="method">The MethodInfo from which to construct the TestMethod</param>
        /// <param name="parms">The ParameterSet to be used, or null</param>
        /// <returns></returns>
        public static NUnitTestMethod BuildSingleTestMethod(MethodInfo method, ParameterSet parms)
        {
            NUnitTestMethod testMethod = new NUnitTestMethod(method);

            if (CheckTestMethodSignature(testMethod, parms))
            {
                NUnitFramework.ApplyCommonAttributes(method, testMethod);
                NUnitFramework.ApplyExpectedExceptionAttribute(method, testMethod);
            }

            if (parms != null)
            {
                // NOTE: After the call to CheckTestMethodSignature, the Method
                // property of testMethod may no longer be the same as the
                // original MethodInfo, so we reassign it here.
                method = testMethod.Method;
                if (parms.TestName != null)
                {
                    testMethod.TestName.Name = parms.TestName;
                    testMethod.TestName.FullName = method.ReflectedType.FullName + "." + parms.TestName;
                }
                else if (parms.Arguments != null)
                {
                    string name = MethodHelper.GetDisplayName(method, parms.Arguments);
                    testMethod.TestName.Name = name;
                    testMethod.TestName.FullName = method.ReflectedType.FullName + "." + name;
                }

                if (parms.ExpectedExceptionName != null)
                    testMethod.exceptionProcessor = new ExpectedExceptionProcessor(testMethod, parms);

                foreach (string key in parms.Properties.Keys)
                    testMethod.Properties.Add(key, parms.Properties[key]);

                // Description is stored in parms.Properties
                if (parms.Description != null)
                    testMethod.Description = parms.Description;
            }

            return testMethod;
        }
Esempio n. 22
0
        /// <summary>
        /// Get Testcase with Test case attributes
        /// </summary>
        /// <param name="method">The MethodInfo object.</param>
        public ArrayList GetTestCasesWithTestCaseAttribute(MethodInfo method)
        {
            ArrayList testCaseCollection = new ArrayList();

            testMethods = Reflect.IsAsyncMethod(method) ? new NUnitAsyncTestMethod(method) : new NUnitTestMethod(method);
            ParameterizedMethodSuite methodSuite = new ParameterizedMethodSuite(method);

            NUnitFramework.ApplyCommonAttributes(method, methodSuite);
            IEnumerable ParameterList = ParamProvider.GetTestCasesFor(method);

            testCaseCollection.Add(testMethods.FixtureType.FullName + "." + method.Name);
            foreach (object source in ParameterList)
            {
                ParameterSet parms;
                if (source == null)
                {
                    parms           = new ParameterSet();
                    parms.Arguments = new object[] { null };
                }
                else
                {
                    parms = source as ParameterSet;
                }
                if (parms == null)
                {
                    if (source.GetType().GetInterface("NUnit.Framework.ITestCaseData") != null)
                    {
                        parms = ParameterSet.FromDataSource(source);
                    }
                    else
                    {
                        parms = new ParameterSet();
                        ParameterInfo[] parameters = method.GetParameters();
                        Type            sourceType = source.GetType();
                        if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(sourceType))
                        {
                            parms.Arguments = new object[] { source }
                        }
                        ;
                        else if (source is object[])
                        {
                            parms.Arguments = (object[])source;
                        }
                        else if (source is Array)
                        {
                            Array array = (Array)source;
                            if (array.Rank == 1)
                            {
                                parms.Arguments = new object[array.Length];
                                for (int i = 0; i < array.Length; i++)
                                {
                                    parms.Arguments[i] = (object)array.GetValue(i);
                                }
                            }
                        }
                        else
                        {
                            parms.Arguments = new object[] { source }
                        };
                    }
                }
                TestMethod testMethod = NUnit.Core.Builders.NUnitTestCaseBuilder.BuildSingleTestMethod(method, null, parms);
                testCaseCollection.Add(testMethod.TestName.FullName);
            }
            return(testCaseCollection);
        }
Esempio n. 23
0
        public override System.Collections.IEnumerable GetTestCasesFor(MethodInfo method)
        {
            Configuration_WebCommonAttribute assignedAttributeForMethod =
                Attribute.GetCustomAttribute(method, typeof(Configuration_WebCommonAttribute), false)
                as Configuration_WebCommonAttribute;

            List <TestCaseData> returnTestCases    = new List <TestCaseData>();
            List <TestCaseData> generatedTestCases = null;

            if (assignedAttributeForMethod.DataGeneratorClass != null && !string.IsNullOrEmpty(assignedAttributeForMethod.DataGeneratorMethod))
            {
                ConstructorInfo methodsClass = assignedAttributeForMethod.DataGeneratorClass.GetConstructor(Type.EmptyTypes);
                MethodInfo      methodInfo   = assignedAttributeForMethod.DataGeneratorClass.GetMethod(assignedAttributeForMethod.DataGeneratorMethod);

                object   methodsClassObject = methodsClass.Invoke(new object[] { });
                object[] methodParameter    = new object[] { };
                if (assignedAttributeForMethod.PassDataGeneratorConfigurationObject)
                {
                    methodParameter = new object[] { assignedAttributeForMethod }
                }
                ;
                generatedTestCases = (List <TestCaseData>)methodInfo.Invoke(methodsClassObject, methodParameter);
            }

            // If user did not specify a method to generate test data from
            // We should just go on with the test and set up configuration information
            if (generatedTestCases == null)
            {
                generatedTestCases = new List <TestCaseData>()
                {
                    new TestCaseData()
                }
            }
            ;

            // Browser will always add the method to the changed list
            foreach (Browser browser in Enum.GetValues(typeof(Browser)))
            {
                // Try to split up Browser.ALL to separate test cases
                if (!assignedAttributeForMethod.Cfg_Browser.HasFlag(browser) || browser == Browser.ALL)
                {
                    continue;
                }

                foreach (TestCaseData arguments in generatedTestCases)
                {
                    NUnitTestMethod test = new NUnitTestMethod(method);

                    Configuration_WebCommonAttribute configurationForTestCase = Attribute.GetCustomAttribute(method,
                                                                                                             typeof(Configuration_WebCommonAttribute), false) as Configuration_WebCommonAttribute;
                    configurationForTestCase.Cfg_Browser = browser;

                    string newTestName = string.Format("{0}({1})_{2}",
                                                       test.TestName.Name, GetArgumentsAsString(arguments.Arguments), browser.ToString());
                    SetTestName(test, newTestName);

                    TestCaseData browserTestData = new TestCaseData(arguments.Arguments);
                    browserTestData.SetName(test.TestName.Name);

                    Configuration.Changes.Add(test.TestName.FullName, configurationForTestCase);
                    returnTestCases.Add(browserTestData);
                }
            }

            return(returnTestCases);
        }
    }
}
        /// <summary>
        /// Builds a single NUnitTestMethod, either as a child of the fixture
        /// or as one of a set of test cases under a ParameterizedTestMethodSuite.
        /// </summary>
        /// <param name="method">The MethodInfo from which to construct the TestMethod</param>
        /// <param name="parms">The ParameterSet to be used, or null</param>
        /// <returns></returns>
        public static NUnitTestMethod BuildSingleTestMethod(MethodInfo method, Test parentSuite, ParameterSet parms)
        {
            NUnitTestMethod testMethod = new NUnitTestMethod(method);

            string prefix = method.ReflectedType.FullName;

            if (parentSuite != null)
            {
                prefix = parentSuite.TestName.FullName;
                testMethod.TestName.FullName = prefix + "." + testMethod.TestName.Name;
            }

            if (CheckTestMethodSignature(testMethod, parms))
            {
                if (parms == null)
                {
                    NUnitFramework.ApplyCommonAttributes(method, testMethod);
                }
                NUnitFramework.ApplyExpectedExceptionAttribute(method, testMethod);
            }

            if (parms != null)
            {
                // NOTE: After the call to CheckTestMethodSignature, the Method
                // property of testMethod may no longer be the same as the
                // original MethodInfo, so we reassign it here.
                method = testMethod.Method;

                if (parms.TestName != null)
                {
                    testMethod.TestName.Name     = parms.TestName;
                    testMethod.TestName.FullName = prefix + "." + parms.TestName;
                }
                else if (parms.OriginalArguments != null)
                {
                    string name = MethodHelper.GetDisplayName(method, parms.OriginalArguments);
                    testMethod.TestName.Name     = name;
                    testMethod.TestName.FullName = prefix + "." + name;
                }

                if (parms.Ignored)
                {
                    testMethod.RunState     = RunState.Ignored;
                    testMethod.IgnoreReason = parms.IgnoreReason;
                }
                else if (parms.Explicit)
                {
                    testMethod.RunState = RunState.Explicit;
                }

                if (parms.ExpectedExceptionName != null)
                {
                    testMethod.exceptionProcessor = new ExpectedExceptionProcessor(testMethod, parms);
                }

                foreach (string key in parms.Properties.Keys)
                {
                    testMethod.Properties[key] = parms.Properties[key];
                }

                // Description is stored in parms.Properties
                if (parms.Description != null)
                {
                    testMethod.Description = parms.Description;
                }
            }

            //if (testMethod.BuilderException != null && testMethod.RunState != RunState.NotRunnable)
            //{
            //    testMethod.RunState = RunState.NotRunnable;
            //    testMethod.IgnoreReason = testMethod.BuilderException.Message;
            //}

            if (parentSuite != null)
            {
                if (parentSuite.RunState == RunState.NotRunnable && testMethod.RunState != RunState.NotRunnable)
                {
                    testMethod.RunState     = RunState.NotRunnable;
                    testMethod.IgnoreReason = parentSuite.IgnoreReason;
                }

                if (parentSuite.RunState == RunState.Ignored && testMethod.RunState != RunState.Ignored && testMethod.RunState != RunState.NotRunnable)
                {
                    testMethod.RunState     = RunState.Ignored;
                    testMethod.IgnoreReason = parentSuite.IgnoreReason;
                }
            }

            return(testMethod);
        }