Class CompositeDataAttribute

Namespace: AutoFixture.Xunit2
Assembly: AutoFixture.Xunit2.dll

An implementation of DataAttribute that composes other DataAttribute instances.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
[CLSCompliant(false)]
public class CompositeDataAttribute : DataAttribute

Inheritance

DataAttribute ← CompositeDataAttribute

Derived

InlineAutoDataAttribute, MemberAutoDataAttribute

Constructors

CompositeDataAttribute(IReadOnlyCollection<DataAttribute>)

Initializes a new instance of the CompositeDataAttribute class.

public CompositeDataAttribute(IReadOnlyCollection<DataAttribute> attributes)

Parameters

attributes IReadOnlyCollection<DataAttribute>

The attributes representing a data source for a data theory.

CompositeDataAttribute(params DataAttribute[])

Initializes a new instance of the CompositeDataAttribute class.

public CompositeDataAttribute(params DataAttribute[] attributes)

Parameters

attributes DataAttribute[]

The attributes representing a data source for a data theory.

Properties

Attributes

Gets the attributes supplied through one of the constructors.

public IEnumerable<DataAttribute> Attributes { get; }

Property Value

IEnumerable<DataAttribute>

Methods

GetData(MethodInfo)

Returns the composition of data to be used to test the theory. Favors the data returned by DataAttributes in ascending order. Data already returned is ignored on next DataAttribute returned data.

public override IEnumerable<object[]> GetData(MethodInfo testMethod)

Parameters

testMethod MethodInfo

The method that is being tested.

Returns

IEnumerable<object[]>

Returns the composition of the theory data.

Remarks

The number of combined data sets is restricted to the length of the attribute which provides the fewest data sets.