Class FilteringSpecimenBuilder
Decorates an ISpecimenBuilder and filters requests so that only some requests are passed through to the decorated builder.
Inheritance
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class FilteringSpecimenBuilder : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable
Constructors
| Improve this Doc View SourceFilteringSpecimenBuilder(ISpecimenBuilder, IRequestSpecification)
Initializes a new instance of the FilteringSpecimenBuilder class.
Declaration
public FilteringSpecimenBuilder(ISpecimenBuilder builder, IRequestSpecification specification)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | A specimen builder to decorate. |
IRequestSpecification | specification | A specification that determines whether |
Properties
| Improve this Doc View SourceBuilder
Gets the decorated builder.
Declaration
public ISpecimenBuilder Builder { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilder |
Specification
Gets the specification that determines whether Builder will be invoked or not.
Declaration
public IRequestSpecification Specification { get; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
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 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 container that can be used to create other specimens. |
Returns
Type | Description |
---|---|
System.Object | A specimen created by the decorated ISpecimenBuilder if the filter allows the request through; otherwise, a NoSpecimen instance. |
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()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |