Beispiel #1
0
        /// <summary>
        /// Builds a ParameterizedMetodSuite containing individual
        /// test cases for each set of parameters provided for
        /// this method.
        /// </summary>
        /// <param name="method">The MethodInfo for which a test is to be built</param>
        /// <param name="parentSuite">The test suite for which the method is being built</param>
        /// <returns>A ParameterizedMethodSuite populated with test cases</returns>
        public Test BuildParameterizedMethodSuite(MethodInfo method, Test parentSuite)
        {
            ParameterizedMethodSuite methodSuite = new ParameterizedMethodSuite(method);

#if PORTABLE
            methodSuite.ApplyAttributesToTest(method.AsCustomAttributeProvider());
#else
            methodSuite.ApplyAttributesToTest(method);
#endif

            foreach (ITestCaseData testcase in testCaseProvider.GetTestCasesFor(method))
            {
                ParameterSet parms = testcase as ParameterSet;
                if (parms == null)
                {
                    parms = new ParameterSet(testcase);
                }

                TestMethod test = BuildSingleTestMethod(method, parentSuite, parms);

                methodSuite.Add(test);
            }

            return(methodSuite);
        }
Beispiel #2
0
        public Test BuildParameterizedMethodSuite(MethodInfo method, Test parentSuite)
        {
            ParameterizedMethodSuite parameterizedMethodSuite = new ParameterizedMethodSuite(method);

            parameterizedMethodSuite.ApplyCommonAttributes(method);
            foreach (ITestCaseData item in testCaseProvider.GetTestCasesFor(method))
            {
                ParameterSet parameterSet = item as ParameterSet;
                if (parameterSet == null)
                {
                    parameterSet = new ParameterSet(item);
                }
                TestMethod test = BuildSingleTestMethod(method, parentSuite, parameterSet);
                parameterizedMethodSuite.Add(test);
            }
            return(parameterizedMethodSuite);
        }