Class MemberAutoDataAttribute
Namespace: AutoFixture.Xunit2
Assembly: AutoFixture.Xunit2.dll
Provides a data source for a data theory, with the data coming from one of the following sources and combined with auto-generated data specimens generated by AutoFixture:
- A static property
- A static field
- A static method (with parameters) The member must return something compatible with IEnumerable<object[]> with the test data.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
[CLSCompliant(false)]
public class MemberAutoDataAttribute : CompositeDataAttributeInheritance
DataAttribute ← CompositeDataAttribute ← MemberAutoDataAttribute
Inherited Members
CompositeDataAttribute.GetData(MethodInfo), CompositeDataAttribute.Attributes
Constructors
MemberAutoDataAttribute(string, params object[])
Initializes a new instance of the MemberAutoDataAttribute class.
public MemberAutoDataAttribute(string memberName, params object[] parameters)Parameters
memberName string
The name of the public static member on the test class that will provide the test data.
parameters object[]
The parameters for the member (only supported for methods; ignored for everything else).
MemberAutoDataAttribute(DataAttribute, string, params object[])
Initializes a new instance of the MemberAutoDataAttribute class.
protected MemberAutoDataAttribute(DataAttribute autoDataAttribute, string memberName, params object[] parameters)Parameters
autoDataAttribute DataAttribute
An DataAttribute.
memberName string
The name of the public static member on the test class that will provide the test data.
parameters object[]
The parameters for the member (only supported for methods; ignored for everything else).
Remarks
This constructor overload exists to enable a derived attribute to supply a custom `DataAttribute` that again may contain custom behavior.
Properties
AutoDataAttribute
Gets the attribute used to automatically generate the remaining theory parameters, which are not fixed.
public DataAttribute AutoDataAttribute { get; }Property Value
DataAttribute
MemberName
Gets the member name.
public string MemberName { get; }Property Value
Parameters
Gets the parameters passed to the member. Only supported for static methods.
public IEnumerable<object> Parameters { get; }