Class CompositeSpecimenBuilder
Creates specimens by returning the first specimen created by its children.
Inheritance
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class CompositeSpecimenBuilder : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable
Constructors
| Improve this Doc View SourceCompositeSpecimenBuilder(ISpecimenBuilder[])
Initializes a new instance of the CompositeSpecimenBuilder class with the supplied builders.
Declaration
public CompositeSpecimenBuilder(params ISpecimenBuilder[] builders)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder[] | builders | The child builders. |
CompositeSpecimenBuilder(IEnumerable<ISpecimenBuilder>)
Initializes a new instance of the CompositeSpecimenBuilder class with the supplied builders.
Declaration
public CompositeSpecimenBuilder(IEnumerable<ISpecimenBuilder> builders)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISpecimenBuilder> | builders | The child builders. |
Properties
| Improve this Doc View SourceBuilders
Gets the child builders.
Declaration
public IEnumerable<ISpecimenBuilder> Builders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISpecimenBuilder> |
Methods
| Improve this Doc View SourceCompose(IEnumerable<ISpecimenBuilder>)
Composes the supplied builders.
Declaration
public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISpecimenBuilder> | builders | The builders to compose. |
Returns
Type | Description |
---|---|
ISpecimenBuilderNode | A new ISpecimenBuilderNode instance containing
|
Create(Object, ISpecimenContext)
Creates a new specimen by delegating to Builders.
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 container that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | The first result created by Builders. |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ISpecimenBuilder> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ISpecimenBuilder> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |