Class FactoryMethodQuery

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Selects public factory methods ordered by the modest first.

public class FactoryMethodQuery : IMethodQuery

Inheritance

objectFactoryMethodQuery

Implements

IMethodQuery

Inherited Members

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

Constructors

FactoryMethodQuery()

public FactoryMethodQuery()

Methods

SelectMethods(Type)

Selects the public factory methods for the supplied type.

public IEnumerable<IMethod> SelectMethods(Type type)

Parameters

type Type

The type.

Returns

IEnumerable<IMethod>

All public factory methods for type, ordered by the modest first.

Remarks

The ordering of the returned methods is based on the number of parameters of the method. Methods with fewer parameters are returned before methods with more parameters. This means that if a default parameterless factory methods exists, it will be the first one returned.

In case of two factory methods with an equal number of parameters, the ordering is unspecified.

Factory methods that contain parameters of the requested type are skipped in order to avoid circular references.