Show / Hide Table of Contents

Class MemberDataAttribute

Provides a data source for a data theory, with the data coming from one of the following sources:

  1. A static property
  2. A static field
  3. A static method (with parameters) The member must return something compatible with IEnumerable<object[]> with the test data. 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
MemberDataAttributeBase.DisableDiscoveryEnumeration
MemberDataAttributeBase.MemberName
MemberDataAttributeBase.MemberType
MemberDataAttributeBase.Parameters
MemberDataAttributeBase.GetData(MethodInfo)
DataAttribute.Skip
Namespace: Xunit
Assembly: xunit.core.dll
Syntax
public sealed class MemberDataAttribute : MemberDataAttributeBase

Constructors

| Improve this Doc View Source

MemberDataAttribute(String, Object[])

Initializes a new instance of the MemberDataAttribute class.

Declaration
public MemberDataAttribute(string memberName, params 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)

Methods

| Improve this Doc View Source

ConvertDataItem(MethodInfo, Object)

Declaration
protected override object[] ConvertDataItem(MethodInfo testMethod, object item)
Parameters
Type Name Description
MethodInfo testMethod
Object item
Returns
Type Description
Object[]
Overrides
MemberDataAttributeBase.ConvertDataItem(MethodInfo, Object)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX