IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder Class Reference

Class to build ether a parameterized or a normal NUnitTestMethod. There are four cases that the builder must deal with: More...

+ Inheritance diagram for NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder:
+ Collaboration diagram for NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder:

Public Member Functions

bool CanBuildFrom (IMethodInfo method)
 Determines if the method can be used to build an NUnit test test method of some kind. The method must normally be marked with an identifying attribute for this to be true. More...
 
Test BuildFrom (IMethodInfo method)
 Build a Test from the provided MethodInfo. Depending on whether the method takes arguments and on the availability of test case data, this method may return a single test or a group of tests contained in a ParameterizedMethodSuite. More...
 
bool CanBuildFrom (IMethodInfo method, Test parentSuite)
 Determines if the method can be used to build an NUnit test test method of some kind. The method must normally be marked with an identifying attribute for this to be true. More...
 
Test BuildFrom (IMethodInfo method, Test parentSuite)
 Build a Test from the provided MethodInfo. Depending on whether the method takes arguments and on the availability of test case data, this method may return a single test or a group of tests contained in a ParameterizedMethodSuite. More...
 

Private Member Functions

Test BuildParameterizedMethodSuite (IMethodInfo method, IEnumerable< TestMethod > tests)
 Builds a ParameterizedMethodSuite containing individual test cases. More...
 
Test BuildSingleTestMethod (IMethodInfo method, Test suite)
 Build a simple, non-parameterized TestMethod for this method. More...
 

Private Attributes

NUnitTestCaseBuilder _nunitTestCaseBuilder = new NUnitTestCaseBuilder()
 

Detailed Description

Class to build ether a parameterized or a normal NUnitTestMethod. There are four cases that the builder must deal with:

  1. The method needs no params and none are provided
  2. The method needs params and they are provided
  3. The method needs no params but they are provided in error
  4. The method needs params but they are not provided This could have been done using two different builders, but it turned out to be simpler to have just one. The BuildFrom method takes a different branch depending on whether any parameters are provided, but all four cases are dealt with in lower-level methods

Member Function Documentation

bool NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.CanBuildFrom ( IMethodInfo  method)
inline

Determines if the method can be used to build an NUnit test test method of some kind. The method must normally be marked with an identifying attribute for this to be true.

Note that this method does not check that the signature of the method for validity. If we did that here, any test methods with invalid signatures would be passed over in silence in the test run. Since we want such methods to be reported, the check for validity is made in BuildFrom rather than here.

Parameters
methodAn IMethodInfo for the method being used as a test method
Returns
True if the builder can create a test case from this method
Test NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.BuildFrom ( IMethodInfo  method)
inline

Build a Test from the provided MethodInfo. Depending on whether the method takes arguments and on the availability of test case data, this method may return a single test or a group of tests contained in a ParameterizedMethodSuite.

Parameters
methodThe method for which a test is to be built
Returns
A Test representing one or more method invocations
bool NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.CanBuildFrom ( IMethodInfo  method,
Test  parentSuite 
)
inline

Determines if the method can be used to build an NUnit test test method of some kind. The method must normally be marked with an identifying attribute for this to be true.

Note that this method does not check that the signature of the method for validity. If we did that here, any test methods with invalid signatures would be passed over in silence in the test run. Since we want such methods to be reported, the check for validity is made in BuildFrom rather than here.

Parameters
methodAn IMethodInfo for the method being used as a test method
parentSuiteThe test suite being built, to which the new test would be added
Returns
True if the builder can create a test case from this method

Implements NUnit.Framework.Interfaces.ITestCaseBuilder.

Test NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.BuildFrom ( IMethodInfo  method,
Test  parentSuite 
)
inline

Build a Test from the provided MethodInfo. Depending on whether the method takes arguments and on the availability of test case data, this method may return a single test or a group of tests contained in a ParameterizedMethodSuite.

Parameters
methodThe method for which a test is to be built
parentSuiteThe test fixture being populated, or null
Returns
A Test representing one or more method invocations

Implements NUnit.Framework.Interfaces.ITestCaseBuilder.

Test NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.BuildParameterizedMethodSuite ( IMethodInfo  method,
IEnumerable< TestMethod tests 
)
inlineprivate

Builds a ParameterizedMethodSuite containing individual test cases.

Parameters
methodThe method for which a test is to be built.
testsThe list of test cases to include.
Returns
A ParameterizedMethodSuite populated with test cases

References NUnit.Framework.Internal.Test.ApplyAttributesToTest(), and NUnit.Framework.Interfaces.IMethodInfo.MethodInfo.

Test NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.BuildSingleTestMethod ( IMethodInfo  method,
Test  suite 
)
inlineprivate

Build a simple, non-parameterized TestMethod for this method.

Parameters
methodThe MethodInfo for which a test is to be built
suiteThe test suite for which the method is being built
Returns
A TestMethod.

References NUnit.Framework.Interfaces.ISimpleTestBuilder.BuildFrom(), and NUnit.Framework.Internal.Builders.NUnitTestCaseBuilder.BuildTestMethod().

Member Data Documentation

NUnitTestCaseBuilder NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder._nunitTestCaseBuilder = new NUnitTestCaseBuilder()
private

The documentation for this class was generated from the following file: