Class FreezingCustomization

Namespace: AutoFixture
Assembly: AutoFixture.dll

A customization that will freeze a specimen of a given Type.

public class FreezingCustomization : ICustomization

Inheritance

objectFreezingCustomization

Implements

ICustomization

Inherited Members

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

Constructors

FreezingCustomization(Type)

Initializes a new instance of the FreezingCustomization class.

public FreezingCustomization(Type targetType)

Parameters

targetType Type

The Type to freeze.

Exceptions

ArgumentNullException

targetType is null.

FreezingCustomization(Type, Type)

Initializes a new instance of the FreezingCustomization class.

public FreezingCustomization(Type targetType, Type registeredType)

Parameters

targetType Type

The Type to freeze.

registeredType Type

The Type to map the frozen targetType value to.

Exceptions

ArgumentNullException

Either targetType or registeredType is null.

ArgumentException

registeredType is not assignable from targetType.

Properties

RegisteredType

Gets the Type to which the frozen TargetType value should be mapped to. Defaults to the same Type as TargetType.

public Type RegisteredType { get; }

Property Value

Type

TargetType

Gets the Type to freeze.

public Type TargetType { get; }

Property Value

Type

Methods

Customize(IFixture)

Customizes the fixture by freezing the value of TargetType.

public void Customize(IFixture fixture)

Parameters

fixture IFixture

The fixture to customize.

Exceptions

ArgumentNullException

fixture is null.