Class CompositePostprocessComposer<T>

Namespace: AutoFixture.Dsl
Assembly: AutoFixture.dll

Aggregates an arbitrary number of IPostprocessComposer%601 instances.

[Obsolete("This class is deprecated and will be removed in future versions of AutoFixture. Please file an issue on GitHub if you need this class in your project.")]
public class CompositePostprocessComposer<T> : IPostprocessComposer<T>, ISpecimenBuilder

Type Parameters

T

The type of specimen to customize.

Inheritance

objectCompositePostprocessComposer<T>

Implements

IPostprocessComposer<T>, ISpecimenBuilder

Inherited Members

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

Extension Methods

SpecimenFactory.Create<T>(ISpecimenBuilder), SpecimenFactory.Create<T>(IPostprocessComposer<T>), SpecimenFactory.CreateAnonymous<T>(IPostprocessComposer<T>), SpecimenFactory.CreateMany<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(IPostprocessComposer<T>), SpecimenFactory.CreateMany<T>(ISpecimenBuilder, int), SpecimenFactory.CreateMany<T>(IPostprocessComposer<T>, int), SpecimenCommand.Do<T>(ISpecimenBuilder, Action<T>), SpecimenCommand.Do<T1, T2>(ISpecimenBuilder, Action<T1, T2>), SpecimenCommand.Do<T1, T2, T3>(ISpecimenBuilder, Action<T1, T2, T3>), SpecimenCommand.Do<T1, T2, T3, T4>(ISpecimenBuilder, Action<T1, T2, T3, T4>), SpecimenQuery.Get<T, TResult>(ISpecimenBuilder, Func<T, TResult>), SpecimenQuery.Get<T1, T2, TResult>(ISpecimenBuilder, Func<T1, T2, TResult>), SpecimenQuery.Get<T1, T2, T3, TResult>(ISpecimenBuilder, Func<T1, T2, T3, TResult>), SpecimenQuery.Get<T1, T2, T3, T4, TResult>(ISpecimenBuilder, Func<T1, T2, T3, T4, TResult>), CustomizationExtensions.ToCustomization(ISpecimenBuilder)

Constructors

CompositePostprocessComposer(IEnumerable<IPostprocessComposer<T>>)

Initializes a new instance of the CompositePostprocessComposer%601 class with a sequence of IPostprocessComposer%601 instances.

public CompositePostprocessComposer(IEnumerable<IPostprocessComposer<T>> composers)

Parameters

composers IEnumerable<IPostprocessComposer<T>>

The composers to aggregate.

CompositePostprocessComposer(params IPostprocessComposer<T>[])

Initializes a new instance of the CompositePostprocessComposer%601 class with an array of IPostprocessComposer%601 instances.

public CompositePostprocessComposer(params IPostprocessComposer<T>[] composers)

Parameters

composers IPostprocessComposer<T>[]

The composers to aggregate.

Properties

Composers

Gets the aggregated composers.

public IEnumerable<IPostprocessComposer<T>> Composers { get; }

Property Value

IEnumerable<IPostprocessComposer<T>>

Methods

Create(object, ISpecimenContext)

Creates a new specimen based on a request.

public object Create(object request, ISpecimenContext context)

Parameters

request object

The request that describes what to create.

context ISpecimenContext

A context that can be used to create other specimens.

Returns

object

The requested specimen if possible; otherwise a NoSpecimen instance.

Remarks

The request can be any object, but will often be a `Type` or other `MemberInfo` instances.

Note to implementers: Implementations are expected to return a `NoSpecimen` instance if they can't satisfy the request.

Do(Action<T>)

Performs the specified action on a specimen.

public IPostprocessComposer<T> Do(Action<T> action)

Parameters

action Action<T>

The action to perform.

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

OmitAutoProperties()

Disables auto-properties for a type of specimen.

public IPostprocessComposer<T> OmitAutoProperties()

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

With<TProperty>(Expression<Func<T, TProperty>>)

Registers that a writable property or field should be assigned an anonymous value as part of specimen post-processing.

public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker)

Parameters

propertyPicker Expression<Func<T, TProperty>>

An expression that identifies the property or field that will should have a value assigned.

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

Type Parameters

TProperty

The type of the property of field.

With<TProperty>(Expression<Func<T, TProperty>>, TProperty)

Registers that a writable property or field should be assigned a specific value as part of specimen post-processing.

public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker, TProperty value)

Parameters

propertyPicker Expression<Func<T, TProperty>>

An expression that identifies the property or field that will have value assigned.

value TProperty

The value to assign to the property or field identified by propertyPicker.

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

Type Parameters

TProperty

The type of the property of field.

With<TProperty>(Expression<Func<T, TProperty>>, Func<TProperty>)

Registers that a writable property or field should be assigned generated value as a part of specimen post-processing.

public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker, Func<TProperty> valueFactory)

Parameters

propertyPicker Expression<Func<T, TProperty>>

An expression that identifies the property or field that will have valueFactory result assigned.

valueFactory Func<TProperty>

The factory of value to assign to the property or field identified by propertyPicker.

Returns

IPostprocessComposer<T>

Type Parameters

TProperty

With<TProperty, TInput>(Expression<Func<T, TProperty>>, Func<TInput, TProperty>)

Registers that a writable property or field should be assigned generated value as a part of specimen post-processing.

public IPostprocessComposer<T> With<TProperty, TInput>(Expression<Func<T, TProperty>> propertyPicker, Func<TInput, TProperty> valueFactory)

Parameters

propertyPicker Expression<Func<T, TProperty>>

An expression that identifies the property or field that will have valueFactory result assigned.

valueFactory Func<TInput, TProperty>

The factory of value to assign to the property or field identified by propertyPicker.

Returns

IPostprocessComposer<T>

Type Parameters

TProperty

TInput

WithAutoProperties()

Enables auto-properties for a type of specimen.

public IPostprocessComposer<T> WithAutoProperties()

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

Without<TProperty>(Expression<Func<T, TProperty>>)

Registers that a writable property should not be assigned any automatic value as part of specimen post-processing.

public IPostprocessComposer<T> Without<TProperty>(Expression<Func<T, TProperty>> propertyPicker)

Parameters

propertyPicker Expression<Func<T, TProperty>>

An expression that identifies the property or field to be ignored.

Returns

IPostprocessComposer<T>

An IPostprocessComposer%601 which can be used to further customize the post-processing of created specimens.

Type Parameters

TProperty

The type of the property or field to ignore.