Show / Hide Table of Contents

Class MemberDataAttributeBase

Provides a base class for attributes that will provide member data. The member data must return something compatible with . Caution: the property is completely enumerated by .ToList() before any test is run. Hence it should return independent object sets.

Inheritance
Object
DataAttribute
MemberDataAttributeBase
MemberDataAttribute
Inherited Members
DataAttribute.Skip
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public abstract class MemberDataAttributeBase : DataAttribute

Constructors

| Improve this Doc View Source

MemberDataAttributeBase(String, Object[])

Initializes a new instance of the MemberDataAttributeBase class.

Declaration
protected MemberDataAttributeBase(string memberName, object[] parameters)
Parameters
Type Name Description
String memberName

The name of the public static member on the test class that will provide the test data

Object[] parameters

The parameters for the member (only supported for methods; ignored for everything else)

Properties

| Improve this Doc View Source

DisableDiscoveryEnumeration

Returns true if the data attribute wants to skip enumerating data during discovery. This will cause the theory to yield a single test case for all data, and the data discovery will be during test execution instead of discovery.

Declaration
public bool DisableDiscoveryEnumeration { get; set; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

MemberName

Gets the member name.

Declaration
public string MemberName { get; }
Property Value
Type Description
String
| Improve this Doc View Source

MemberType

Gets or sets the type to retrieve the member from. If not set, then the property will be retrieved from the unit test class.

Declaration
public Type MemberType { get; set; }
Property Value
Type Description
Type
| Improve this Doc View Source

Parameters

Gets or sets the parameters passed to the member. Only supported for static methods.

Declaration
public object[] Parameters { get; }
Property Value
Type Description
Object[]

Methods

| Improve this Doc View Source

ConvertDataItem(MethodInfo, Object)

Converts an item yielded by the data member to an object array, for return from GetData(MethodInfo).

Declaration
protected abstract object[] ConvertDataItem(MethodInfo testMethod, object item)
Parameters
Type Name Description
MethodInfo testMethod

The method that is being tested.

Object item

An item yielded from the data member.

Returns
Type Description
Object[]

An object[] suitable for return from GetData(MethodInfo).

| Improve this Doc View Source

GetData(MethodInfo)

Declaration
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
Parameters
Type Name Description
MethodInfo testMethod
Returns
Type Description
IEnumerable<Object[]>
Overrides
DataAttribute.GetData(MethodInfo)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX