Class CompositeDataAttribute

Namespace: AutoFixture.Xunit
Assembly: AutoFixture.Xunit.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

Constructors

CompositeDataAttribute(IEnumerable<DataAttribute>)

Initializes a new instance of the CompositeDataAttribute class.

public CompositeDataAttribute(IEnumerable<DataAttribute> attributes)

Parameters

attributes IEnumerable<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, Type[])

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 methodUnderTest, Type[] parameterTypes)

Parameters

methodUnderTest MethodInfo

The method that is being tested.

parameterTypes Type[]

The types of the parameters for the test method.

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.