ParameterizedMethodSuite holds a collection of individual TestMethods with their arguments applied.
Inheritance: TestSuite
        public void CopyParameterizedMethodSuiteReturnsCorrectType()
        {
            TestSuite parameterizedMethodSuite = new ParameterizedMethodSuite(new MethodWrapper(
                                                                                  typeof(NUnit.TestData.ParameterizedTestFixture),
                                                                                  nameof(NUnit.TestData.ParameterizedTestFixture.MethodWithParams)));
            var copiedparameterizedMethodSuite = parameterizedMethodSuite.Copy(TestFilter.Empty);

            Assert.That(copiedparameterizedMethodSuite, Is.TypeOf <ParameterizedMethodSuite>());
        }
        /// <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);
            methodSuite.ApplyAttributesToTest(method);

            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;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a copy of the given suite with only the descendants that pass the specified filter.
 /// </summary>
 /// <param name="suite">The <see cref="ParameterizedMethodSuite"/> to copy.</param>
 /// <param name="filter">Determines which descendants are copied.</param>
 public ParameterizedMethodSuite(ParameterizedMethodSuite suite, ITestFilter filter)
     : base(suite, filter)
 {
 }