Class MemberAutoDataAttribute
Namespace: AutoFixture.Xunit3
Assembly: AutoFixture.Xunit3.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 : DataAttributeInheritance
DataAttribute ← MemberAutoDataAttribute
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(Type?, string, params object[])
Initializes a new instance of the MemberAutoDataAttribute class.
public MemberAutoDataAttribute(Type? memberType, string memberName, params object[] parameters)Parameters
memberType Type?
The type declaring the source member.
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(Func<IFixture>, string, params object[])
Initializes a new instance of the MemberAutoDataAttribute class.
protected MemberAutoDataAttribute(Func<IFixture> fixtureFactory, string memberName, params object[] parameters)Parameters
fixtureFactory Func<IFixture>
The fixture factory delegate.
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(Func<IFixture>, Type?, string, params object[]?)
Initializes a new instance of the MemberAutoDataAttribute class.
protected MemberAutoDataAttribute(Func<IFixture> fixtureFactory, Type? memberType, string memberName, params object[]? parameters)Parameters
fixtureFactory Func<IFixture>
The fixture factory delegate.
memberType Type?
The type declaring the source member.
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).
Exceptions
Thrown when arguments are null.
Properties
FixtureFactory
Gets the fixture factory that provides the missing data from MemberType.
public Func<IFixture> FixtureFactory { get; }Property Value
Func<IFixture>
MemberName
Gets the member name.
public string MemberName { get; }Property Value
MemberType
Gets the type of the class that provides the data.
public Type? MemberType { get; }Property Value
Type?
Parameters
Gets the parameters passed to the member. Only supported for static methods.
public object[] Parameters { get; }Property Value
object[]
Methods
GetData(MethodInfo, DisposalTracker)
public override ValueTask<IReadOnlyCollection<ITheoryDataRow>> GetData(MethodInfo testMethod, DisposalTracker disposalTracker)Parameters
testMethod MethodInfo
disposalTracker DisposalTracker
Returns
ValueTask<IReadOnlyCollection<ITheoryDataRow>>
SupportsDiscoveryEnumeration()
public override bool SupportsDiscoveryEnumeration()