Class TestFixtureSourceAttribute
TestCaseSourceAttribute indicates the source to be used to provide test fixture instances for a test class.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class TestFixtureSourceAttribute : NUnitAttribute, IFixtureBuilder
- Inheritance
-
TestFixtureSourceAttribute
- Implements
- Inherited Members
Constructors
TestFixtureSourceAttribute(string)
Construct with the name of the method, property or field that will provide data
public TestFixtureSourceAttribute(string sourceName)
Parameters
sourceName
stringThe name of a static method, property or field that will provide data.
TestFixtureSourceAttribute(Type)
Construct with a Type
public TestFixtureSourceAttribute(Type sourceType)
Parameters
sourceType
TypeThe type that will provide data
TestFixtureSourceAttribute(Type, string)
Construct with a Type and name
public TestFixtureSourceAttribute(Type sourceType, string sourceName)
Parameters
sourceType
TypeThe Type that will provide data
sourceName
stringThe name of a static method, property or field that will provide data.
Fields
MUST_BE_STATIC
Error message string is public so the tests can use it
public const string MUST_BE_STATIC = "The sourceName specified on a TestCaseSourceAttribute must refer to a static field, property or method."
Field Value
Properties
Category
Gets or sets the category associated with every fixture created from this attribute. May be a single category or a comma-separated list.
public string Category { get; set; }
Property Value
SourceName
The name of a the method, property or fiend to be used as a source
public string SourceName { get; }
Property Value
SourceType
A Type to be used as a source
public Type SourceType { get; }
Property Value
Methods
BuildFrom(Type)
Construct one or more TestFixtures from a given Type, using available parameter data.
public IEnumerable<TestSuite> BuildFrom(Type type)
Parameters
type
TypeThe Type for which fixures are to be constructed.
Returns
- IEnumerable<TestSuite>
One or more TestFixtures as TestSuite
GetParametersFor(Type)
Returns a set of ITestFixtureData items for use as arguments to a parameterized test fixture.
public IEnumerable<ITestFixtureData> GetParametersFor(Type type)
Parameters
type
TypeThe type for which data is needed.