Class CompositePostprocessComposer<T>
Aggregates an arbitrary number of IPostprocessComposer<T> instances.
Inheritance
Inherited Members
Namespace: AutoFixture.Dsl
Assembly: AutoFixture.dll
Syntax
[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
Name | Description |
---|---|
T | The type of specimen to customize. |
Constructors
| Improve this Doc View SourceCompositePostprocessComposer(IPostprocessComposer<T>[])
Initializes a new instance of the CompositePostprocessComposer<T> class with an array of IPostprocessComposer<T> instances.
Declaration
public CompositePostprocessComposer(params IPostprocessComposer<T>[] composers)
Parameters
Type | Name | Description |
---|---|---|
IPostprocessComposer<T>[] | composers | The composers to aggregate. |
CompositePostprocessComposer(IEnumerable<IPostprocessComposer<T>>)
Initializes a new instance of the CompositePostprocessComposer<T> class with a sequence of IPostprocessComposer<T> instances.
Declaration
public CompositePostprocessComposer(IEnumerable<IPostprocessComposer<T>> composers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IPostprocessComposer<T>> | composers | The composers to aggregate. |
Properties
| Improve this Doc View SourceComposers
Gets the aggregated composers.
Declaration
public IEnumerable<IPostprocessComposer<T>> Composers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IPostprocessComposer<T>> |
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a new specimen based on a request.
Declaration
public object Create(object request, ISpecimenContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | request | The request that describes what to create. |
ISpecimenContext | context | A context that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | The requested specimen if possible; otherwise a NoSpecimen instance. |
Remarks
The request
can be any object, but will often be a
System.Type or other System.Reflection.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.
Declaration
public IPostprocessComposer<T> Do(Action<T> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | action | The action to perform. |
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> which can be used to further customize the post-processing of created specimens. |
OmitAutoProperties()
Disables auto-properties for a type of specimen.
Declaration
public IPostprocessComposer<T> OmitAutoProperties()
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> 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.
Declaration
public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, TProperty>> | propertyPicker | An expression that identifies the property or field that will should have a value assigned. |
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> which can be used to further customize the post-processing of created specimens. |
Type Parameters
Name | Description |
---|---|
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.
Declaration
public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker, TProperty value)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, TProperty>> | propertyPicker | An expression that identifies the property or field that will have
|
TProperty | value | The value to assign to the property or field identified by
|
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> which can be used to further customize the post-processing of created specimens. |
Type Parameters
Name | Description |
---|---|
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.
Declaration
public IPostprocessComposer<T> With<TProperty>(Expression<Func<T, TProperty>> propertyPicker, Func<TProperty> valueFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, TProperty>> | propertyPicker | An expression that identifies the property or field that will have |
System.Func<TProperty> | valueFactory | The factory of value to assign to the property or field identified by |
Returns
Type | Description |
---|---|
IPostprocessComposer<T> |
Type Parameters
Name | Description |
---|---|
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.
Declaration
public IPostprocessComposer<T> With<TProperty, TInput>(Expression<Func<T, TProperty>> propertyPicker, Func<TInput, TProperty> valueFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, TProperty>> | propertyPicker | An expression that identifies the property or field that will have |
System.Func<TInput, TProperty> | valueFactory | The factory of value to assign to the property or field identified by |
Returns
Type | Description |
---|---|
IPostprocessComposer<T> |
Type Parameters
Name | Description |
---|---|
TProperty | |
TInput |
WithAutoProperties()
Enables auto-properties for a type of specimen.
Declaration
public IPostprocessComposer<T> WithAutoProperties()
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> 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.
Declaration
public IPostprocessComposer<T> Without<TProperty>(Expression<Func<T, TProperty>> propertyPicker)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, TProperty>> | propertyPicker | An expression that identifies the property or field to be ignored. |
Returns
Type | Description |
---|---|
IPostprocessComposer<T> | An IPostprocessComposer<T> which can be used to further customize the post-processing of created specimens. |
Type Parameters
Name | Description |
---|---|
TProperty | The type of the property or field to ignore. |