Class FixtureFreezer
Contains extension methods for freezing specimens in IFixture instances.
Inheritance
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public static class FixtureFreezer
Methods
| Improve this Doc View SourceFreeze<T>(IFixture)
Freezes the type to a single value.
Declaration
public static T Freeze<T>(this IFixture fixture)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture. |
Returns
Type | Description |
---|---|
T | The value that will subsequently always be created for |
Type Parameters
Name | Description |
---|---|
T | The type to freeze. |
Remarks
The Freeze<T>(IFixture) method freezes the type to always return the same instance whenever an instance of the type is requested either directly, or indirectly as a nested value of other types.
See Also
| Improve this Doc View SourceFreeze<T>(IFixture, Func<ICustomizationComposer<T>, ISpecimenBuilder>)
Freezes the type to a single value.
Declaration
public static T Freeze<T>(this IFixture fixture, Func<ICustomizationComposer<T>, ISpecimenBuilder> composerTransformation)
Parameters
Type | Name | Description |
---|---|---|
IFixture | fixture | The fixture. |
System.Func<ICustomizationComposer<T>, ISpecimenBuilder> | composerTransformation | A function that customizes a given ICustomizationComposer<T> and returns the modified composer. |
Returns
Type | Description |
---|---|
T | The value that will subsequently always be created for |
Type Parameters
Name | Description |
---|---|
T | The type to freeze. |
Remarks
This method freezes the type to always return the
same instance whenever an instance of the type is requested either directly, or
indirectly as a nested value of other types. The frozen instance is created by an
ISpecimenBuilder that is the result of applying the
composerTransformation
.