ITestDataSource.GetData(MethodInfo) Method

Definition

Gets the test data from custom test data source.

public:
 System::Collections::Generic::IEnumerable<cli::array <System::Object ^> ^> ^ GetData(System::Reflection::MethodInfo ^ methodInfo);
public System.Collections.Generic.IEnumerable<object[]> GetData(System.Reflection.MethodInfo methodInfo);
public System.Collections.Generic.IEnumerable<object?[]> GetData(System.Reflection.MethodInfo methodInfo);
abstract member GetData : System.Reflection.MethodInfo -> seq<obj[]>
Public Function GetData (methodInfo As MethodInfo) As IEnumerable(Of Object())

Parameters

methodInfo
MethodInfo

The method info of test method.

Returns

Test data for calling test method.

Remarks

Each element of the returned sequence represents the arguments for a single invocation of the test method. In the common case, an element is an Object array whose items are the positional arguments passed to the test method.

To attach per-row metadata (such as a custom display name, an ignore reason, or test categories), return a single-element Object array whose only item is a TestDataRow<T> instance, for example new object[] { new TestDataRow<(int, int, int)>((1, 2, 3)) { DisplayName = "my row" } }. When MSTest sees a TestDataRow<T>, it unwraps its Value to obtain the actual test method arguments and applies the row's DisplayName, IgnoreMessage, and TestCategories.

The whole data source can be ignored (rather than a single row) by implementing ITestDataSourceIgnoreCapability on the data source type.

Applies to