Class TestCaseSourceAttribute
TestCaseSourceAttribute indicates the source to be used to provide test cases for a test method.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class TestCaseSourceAttribute : TestCaseBuilderAttribute, ITestBuilder, IImplyFixture
- Inheritance
-
TestCaseSourceAttribute
- Implements
- Inherited Members
Constructors
TestCaseSourceAttribute(string)
Construct with the name of the method, property or field that will prvide data
public TestCaseSourceAttribute(string sourceName)
Parameters
sourceName
stringThe name of the method, property or field that will provide data
TestCaseSourceAttribute(Type)
Construct with a Type
public TestCaseSourceAttribute(Type sourceType)
Parameters
sourceType
TypeThe type that will provide data
TestCaseSourceAttribute(Type, string, params object[])
Construct with a Type and name
public TestCaseSourceAttribute(Type sourceType, string sourceName, params object[] constructorParameters)
Parameters
sourceType
TypeThe Type that will provide data
sourceName
stringThe name of the method, property or field that will provide data
constructorParameters
object[]The constructor parameters to be used when instantiating the sourceType.
Properties
Category
Gets or sets the category associated with this test. 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(MethodInfo, Test)
Construct one or more TestMethods from a given MethodInfo, using available parameter data.
public IEnumerable<TestMethod> BuildFrom(MethodInfo method, Test suite)
Parameters
method
MethodInfoThe MethodInfo for which tests are to be constructed.
suite
TestThe suite to which the tests will be added.
Returns
- IEnumerable<TestMethod>
One or more TestMethods
GetTestCasesFor(MethodInfo)
Returns a set of ITestCaseDataItems for use as arguments to a parameterized test method.
public IEnumerable<ITestCaseData> GetTestCasesFor(MethodInfo method)
Parameters
method
MethodInfoThe method for which data is needed.