Class ParameterSpecification

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

A specification that determines whether the request is a request for a ParameterInfo matching the specified name and Type.

public class ParameterSpecification : IRequestSpecification

Inheritance

objectParameterSpecification

Implements

IRequestSpecification

Inherited Members

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

Constructors

ParameterSpecification(Type, string)

Initializes a new instance of the ParameterSpecification class.

public ParameterSpecification(Type targetType, string targetName)

Parameters

targetType Type

The Type with which the requested ParameterInfo type should be compatible.

targetName string

The name which the requested ParameterInfo name should match exactly.

Exceptions

ArgumentNullException

targetType or targetName is null.

ParameterSpecification(IEquatable<ParameterInfo>)

Initializes a new instance of the ParameterSpecification class.

public ParameterSpecification(IEquatable<ParameterInfo> target)

Parameters

target IEquatable<ParameterInfo>

The criteria used to match the requested ParameterInfo.

Exceptions

ArgumentNullException

target is null.

Properties

TargetName

The name which the requested ParameterInfo name should match exactly.

[Obsolete("This value is only available if the constructor taking a target type and name is used. Otherwise, it'll be null. Use with caution. This property will be removed in a future version of AutoFixture.", true)]
public string TargetName { get; }

Property Value

string

TargetType

The Type with which the requested ParameterInfo type should be compatible.

[Obsolete("This value is only available if the constructor taking a target type and name is used. Otherwise, it'll be null. Use with caution. This property will be removed in a future version of AutoFixture.", true)]
public Type TargetType { get; }

Property Value

Type

Methods

IsSatisfiedBy(object)

Evaluates a request for a specimen.

public bool IsSatisfiedBy(object request)

Parameters

request object

The specimen request.

Returns

bool

true if request is satisfied by the Specification; otherwise, false.