Class AutoDataAttribute

Namespace: AutoFixture.NUnit3
Assembly: AutoFixture.NUnit3.dll

This attribute uses AutoFixture to generate values for unit test parameters. This implementation is based on TestCaseAttribute of NUnit3.

[AttributeUsage(AttributeTargets.Method)]
public class AutoDataAttribute : Attribute, ITestBuilder

Inheritance

objectAttributeAutoDataAttribute

Implements

ITestBuilder

Inherited Members

Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.Equals(object?), Attribute.GetHashCode(), Attribute.Match(object?), Attribute.IsDefaultAttribute(), Attribute.TypeId, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

AutoDataAttribute()

Construct a AutoDataAttribute.

public AutoDataAttribute()

AutoDataAttribute(IFixture)

Construct a AutoDataAttribute with an IFixture.

[Obsolete("This constructor overload is deprecated because it offers poor performance, and will be removed in a future version. Please use the AutoDataAttribute(Func<IFixture> fixtureFactory) overload, so fixture will be constructed only if needed.")]
protected AutoDataAttribute(IFixture fixture)

Parameters

fixture IFixture

AutoDataAttribute(Func<IFixture>)

Initializes a new instance of the AutoDataAttribute class with the supplied fixtureFactory. Fixture will be created on demand using the provided factory.

protected AutoDataAttribute(Func<IFixture> fixtureFactory)

Parameters

fixtureFactory Func<IFixture>

The fixture factory used to construct the fixture.

Properties

TestMethodBuilder

Gets or sets the current ITestMethodBuilder strategy.

public ITestMethodBuilder TestMethodBuilder { get; set; }

Property Value

ITestMethodBuilder

Methods

BuildFrom(IMethodInfo, Test)

Construct one or more TestMethods from a given MethodInfo, using available parameter data.

public IEnumerable<TestMethod> BuildFrom(IMethodInfo method, Test suite)

Parameters

method IMethodInfo

The MethodInfo for which tests are to be constructed.

suite Test

The suite to which the tests will be added.

Returns

IEnumerable<TestMethod>

One or more TestMethods.