Class FreezeOnMatchCustomization

Namespace: AutoFixture
Assembly: AutoFixture.dll

A customization that freezes specimens of a specific Type and uses them to satisfy requests that match a set of criteria.

public class FreezeOnMatchCustomization : ICustomization

Inheritance

objectFreezeOnMatchCustomization

Implements

ICustomization

Inherited Members

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

Remarks

The criteria that determine whether the frozen specimen will be used to satisfy a given request are specified at construction time as a IRequestSpecification object. Multiple criteria can be combined together as a boolean expression by composing them into a AndRequestSpecification or OrRequestSpecification object.

Constructors

FreezeOnMatchCustomization(object)

Initializes a new instance of the FreezeOnMatchCustomization class.

public FreezeOnMatchCustomization(object request)

Parameters

request object

The request used to create a specimen to freeze.

Exceptions

ArgumentNullException

request is null.

FreezeOnMatchCustomization(object, IRequestSpecification)

Initializes a new instance of the FreezeOnMatchCustomization class.

public FreezeOnMatchCustomization(object request, IRequestSpecification matcher)

Parameters

request object

The request used to create a specimen to freeze.

matcher IRequestSpecification

The IRequestSpecification used to match the requests that will be satisfied by the frozen specimen.

Exceptions

ArgumentNullException

request or matcher is null.

Properties

Matcher

The IRequestSpecification used to match the requests that will be satisfied by the frozen specimen.

public IRequestSpecification Matcher { get; }

Property Value

IRequestSpecification

Request

The request used to resolve specimens. By default that is TargetType.

public object Request { get; }

Property Value

object

TargetType

The Type of the frozen specimen.

[Obsolete("Please use the Request property instead.")]
public Type TargetType { get; }

Property Value

Type

Methods

Customize(IFixture)

Customizes the specified fixture.

public void Customize(IFixture fixture)

Parameters

fixture IFixture

The fixture to customize.