Class ConstructorCustomization

Namespace: AutoFixture
Assembly: AutoFixture.dll

A customization that uses a particular constructor selection mechanism to pick and invoke a constructor to create specimens of the targeted type.

public class ConstructorCustomization : ICustomization

Inheritance

objectConstructorCustomization

Implements

ICustomization

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

ConstructorCustomization(Type, IMethodQuery)

Initializes a new instance of the ConstructorCustomization class.

public ConstructorCustomization(Type targetType, IMethodQuery query)

Parameters

targetType Type

The Type for which query should be used to select the most appropriate constructor.

query IMethodQuery

The query that selects a constructor for targetType.

Properties

Query

Gets the query that selects a constructor for TargetType.

public IMethodQuery Query { get; }

Property Value

IMethodQuery

TargetType

Gets the Type for which Query should be used to select the most appropriate constructor.

public Type TargetType { get; }

Property Value

Type

Methods

Customize(IFixture)

Customizes the specified fixture by modifying TargetType to use Query as the strategy for creating new specimens.

public void Customize(IFixture fixture)

Parameters

fixture IFixture

The fixture to customize.