DataPointProviders are used to supply data for an individual parameter of a parameterized test method.
Addins use the host to access this extension point by name:
IExtensionPoint listeners = host.GetExtensionPoint( "DataPointProviders" );
The extension object passed to Install must implement either the IDataPointProvider or the IDataPointProvider2 interface:
public interface IDataPointProvider { bool HasDataFor( ParameterInfo parameter ); IEnumerable GetDataFor( ParameterInfo parameter ); } public interface IDataPointProvider2 : IDatapointProvider { bool HasDataFor( ParameterInfo parameter, Test parentSuite ); IEnumerable GetDataFor( ParameterInfo parameter, Test parentSuite ); }
NUnit will call IDataPointProvider2 if it is available. Otherwise IDataPointProvider will be used.
The HasDataFor method should return true if the provider is able to supply data for the specified parameter. If a provider only wants to be used on certain types of tests, it can examine the supplied ParameterInfo and its associated MethodInfo and Type and/or the parent test suite.
The GetDataFor method should return a list of individual values to use for the supplied parameter in running the test.