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.NUnitTestFixtureBuilder Class Reference

NUnitTestFixtureBuilder is able to build a fixture given a class marked with a TestFixtureAttribute or an unmarked class containing test methods. In the first case, it is called by the attribute and in the second directly by NUnitSuiteBuilder. More...

+ Collaboration diagram for NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder:

Public Member Functions

TestSuite BuildFrom (ITypeInfo typeInfo)
 Build a TestFixture from type provided. A non-null TestSuite must always be returned, since the method is generally called because the user has marked the target class as a fixture. If something prevents the fixture from being used, it should be returned nonetheless, labelled as non-runnable. More...
 
TestSuite BuildFrom (ITypeInfo typeInfo, ITestFixtureData testFixtureData)
 Overload of BuildFrom called by tests that have arguments. Builds a fixture using the provided type and information in the ITestFixtureData object. More...
 

Private Member Functions

void AddTestCasesToFixture (TestFixture fixture)
 Method to add test cases to the newly constructed fixture. More...
 
Test BuildTestCase (IMethodInfo method, TestSuite suite)
 Method to create a test case from a MethodInfo and add it to the fixture being built. It first checks to see if any global TestCaseBuilder addin wants to build the test case. If not, it uses the internal builder collection maintained by this fixture builder. More...
 

Static Private Member Functions

static void CheckTestFixtureIsValid (TestFixture fixture)
 
static bool IsStaticClass (Type type)
 

Private Attributes

ITestCaseBuilder _testBuilder = new DefaultTestCaseBuilder()
 

Static Private Attributes

static readonly string NO_TYPE_ARGS_MSG
 

Detailed Description

NUnitTestFixtureBuilder is able to build a fixture given a class marked with a TestFixtureAttribute or an unmarked class containing test methods. In the first case, it is called by the attribute and in the second directly by NUnitSuiteBuilder.

Member Function Documentation

TestSuite NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.BuildFrom ( ITypeInfo  typeInfo)
inline

Build a TestFixture from type provided. A non-null TestSuite must always be returned, since the method is generally called because the user has marked the target class as a fixture. If something prevents the fixture from being used, it should be returned nonetheless, labelled as non-runnable.

Parameters
typeInfoAn ITypeInfo for the fixture to be used.
Returns
A TestSuite object or one derived from TestSuite.

References NUnit.Framework.Interfaces.ITypeInfo.Type.

Referenced by NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom().

TestSuite NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.BuildFrom ( ITypeInfo  typeInfo,
ITestFixtureData  testFixtureData 
)
inline

Overload of BuildFrom called by tests that have arguments. Builds a fixture using the provided type and information in the ITestFixtureData object.

Parameters
typeInfoThe TypeInfo for which to construct a fixture.
testFixtureDataAn object implementing ITestFixtureData or null.
Returns

References NUnit.Framework.Interfaces.ITestData.Arguments, NUnit.Framework.Internal.TypeHelper.CanDeduceTypeArgsFromArgs(), NUnit.Framework.Interfaces.ITypeInfo.ContainsGenericParameters, NUnit.Framework.Interfaces.ITypeInfo.GetDisplayName(), NUnit.Framework.Interfaces.ITypeInfo.MakeGenericType(), NUnit.Framework.Interfaces.ITypeInfo.Namespace, NUnit.Framework.Interfaces.ITestData.RunState, NUnit.Framework.Interfaces.ITypeInfo.Type, and NUnit.Framework.Interfaces.ITestFixtureData.TypeArgs.

void NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.AddTestCasesToFixture ( TestFixture  fixture)
inlineprivate
Test NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.BuildTestCase ( IMethodInfo  method,
TestSuite  suite 
)
inlineprivate

Method to create a test case from a MethodInfo and add it to the fixture being built. It first checks to see if any global TestCaseBuilder addin wants to build the test case. If not, it uses the internal builder collection maintained by this fixture builder.

The default implementation has no test case builders. Derived classes should add builders to the collection in their constructor.

Parameters
methodThe method for which a test is to be created
suiteThe test suite being built.
Returns
A newly constructed Test

References NUnit.Framework.Interfaces.ITestCaseBuilder.BuildFrom(), and NUnit.Framework.Interfaces.ITestCaseBuilder.CanBuildFrom().

static bool NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.IsStaticClass ( Type  type)
inlinestaticprivate

Member Data Documentation

readonly string NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.NO_TYPE_ARGS_MSG
staticprivate
Initial value:
=
"Fixture type contains generic parameters. You must either provide " +
"Type arguments or specify constructor arguments that allow NUnit " +
"to deduce the Type arguments."
ITestCaseBuilder NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder._testBuilder = new DefaultTestCaseBuilder()
private

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