Interface ISpecimenBuilderNode
A node in a graph of ISpecimenBuilder instances.
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public interface ISpecimenBuilderNode : ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable
Remarks
AutoFixture's kernel basically works as a 'Graph of Responsibility'. Each ISpecimenBuilder gets a chance to handle a request, and if it can't do that, the next ISpecimenBuilder is asked to handle the request. When an ISpecimenBuilder instance returns a useful specimen, that instance is returned and the results (if any) from lower-priority ISpecimenBuilder instances are ignored.
In theory, one could order all ISpecimenBuilder instances in a flat Chain of Responsibility, but instead, the ISpecimenBuilderNode interface defines the responsibilities of a 'parent' node in a deeper graph. Each ISpecimenBuilder node constitute an intermediate node in a graph, while itself being a parent to other nodes. In the degenerate case when an ISpecimenBuilderNode has no child nodes, it effectively becomes a leaf node. Otherwise, leaf nodes are typically ISpecimenBuilder instances.
Methods
| Improve this Doc View SourceCompose(IEnumerable<ISpecimenBuilder>)
Composes the supplied builders.
Declaration
ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISpecimenBuilder> | builders | The builders to compose. |
Returns
Type | Description |
---|---|
ISpecimenBuilderNode | A ISpecimenBuilderNode instance. |
Remarks
Note to implementers:
The intent of this method is to compose the supplied
builders
into a new instance of the type
implementing ISpecimenBuilderNode. Thus, the
concrete return type is expected to the same type as the type
implementing the method. However, it is not considered a failure to
deviate from this idiom - it would just not be a mainstream
implementation.
The returned instance is normally expected to contain the builders supplied as an argument, but again this is not strictly required. The implementation may decide to filter the sequence or add to it during composition.