Class FixtureFreezer

Namespace: AutoFixture
Assembly: AutoFixture.dll

Contains extension methods for freezing specimens in IFixture instances.

public static class FixtureFreezer

Inheritance

objectFixtureFreezer

Inherited Members

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

Methods

Freeze<T>(IFixture)

Freezes the type to a single value.

public static T Freeze<T>(this IFixture fixture)

Parameters

fixture IFixture

The fixture.

Returns

T

The value that will subsequently always be created for T.

Type Parameters

T

The type to freeze.

Remarks

The `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

FixtureFreezer.Freeze<T>(IFixture, Func<ICustomizationComposer<T>, ISpecimenBuilder>)

Freeze<T>(IFixture, Func<ICustomizationComposer<T>, ISpecimenBuilder>)

Freezes the type to a single value.

public static T Freeze<T>(this IFixture fixture, Func<ICustomizationComposer<T>, ISpecimenBuilder> composerTransformation)

Parameters

fixture IFixture

The fixture.

composerTransformation Func<ICustomizationComposer<T>, ISpecimenBuilder>

A function that customizes a given ICustomizationComposer%601 and returns the modified composer.

Returns

T

The value that will subsequently always be created for T.

Type Parameters

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.

See Also

FixtureFreezer.Freeze<T>(IFixture)