Class BehaviorRoot
A marker class, used to explicitly identify the root of the behaviors role in an ISpecimenBuilderNode graph.
Inheritance
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.dll
Syntax
public class BehaviorRoot : ISpecimenBuilderNode, ISpecimenBuilder, IEnumerable<ISpecimenBuilder>, IEnumerable
Remarks
The only purpose of this class is to act as an easily identifiable container. This makes it easier to find the root of the of behaviors even if it is buried deep in a larger graph.
Constructors
| Improve this Doc View SourceBehaviorRoot(ISpecimenBuilder)
Initializes a new instance of the BehaviorRoot class.
Declaration
public BehaviorRoot(ISpecimenBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The builder to decorate. |
Remarks
After initialization builder
is available via
the Builder property.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
See Also
Properties
| Improve this Doc View SourceBuilder
Gets the builder decorated by this instance.
Declaration
public ISpecimenBuilder Builder { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilder | The builder originally supplied via the constructor. |
See Also
Methods
| Improve this Doc View SourceCompose(IEnumerable<ISpecimenBuilder>)
Composes the supplied builders.
Declaration
public 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 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.
GetEnumerator()
Returns the decorated builder as a sequence.
Declaration
public IEnumerator<ISpecimenBuilder> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ISpecimenBuilder> | Builder wrapped in an Iterator. |
See Also
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. |