Class FreezeOnMatchCustomization
A customization that freezes specimens of a specific System.Type and uses them to satisfy requests that match a set of criteria.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public class FreezeOnMatchCustomization : ICustomization
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
| Improve this Doc View SourceFreezeOnMatchCustomization(Object)
Initializes a new instance of the FreezeOnMatchCustomization class.
Declaration
public FreezeOnMatchCustomization(object request)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request used to create a specimen to freeze. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
FreezeOnMatchCustomization(Object, IRequestSpecification)
Initializes a new instance of the FreezeOnMatchCustomization class.
Declaration
public FreezeOnMatchCustomization(object request, IRequestSpecification matcher)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request used to create a specimen to freeze. |
IRequestSpecification | matcher | The IRequestSpecification used to match the requests that will be satisfied by the frozen specimen. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceMatcher
The IRequestSpecification used to match the requests that will be satisfied by the frozen specimen.
Declaration
public IRequestSpecification Matcher { get; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
Request
The request used to resolve specimens. By default that is TargetType.
Declaration
public object Request { get; }
Property Value
Type | Description |
---|---|
System.Object |
TargetType
The System.Type of the frozen specimen.
Declaration
[Obsolete("Please use the Request property instead.")]
public Type TargetType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Methods
| Improve this Doc View SourceCustomize(IFixture)
Customizes the specified fixture.
Declaration
public void Customize(IFixture fixture)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture to customize. |