Class TracingBuilder
Tracks any request and passes it on to the container. Tracks any returned object from the container and passes it on.
Inheritance
Implements
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class TracingBuilder : ISpecimenBuilder
Constructors
| Improve this Doc View SourceTracingBuilder(ISpecimenBuilder)
Initializes a new instance of the TracingBuilder class with a decorated ISpecimenBuilder.
Declaration
public TracingBuilder(ISpecimenBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The ISpecimenBuilder to decorate. |
Properties
| Improve this Doc View SourceBuilder
Gets the builder decorated by this instance.
Declaration
public ISpecimenBuilder Builder { get; }
Property Value
Type | Description |
---|---|
ISpecimenBuilder |
Filter
Gets or sets a filter for tracking.
Declaration
public IRequestSpecification Filter { get; set; }
Property Value
Type | Description |
---|---|
IRequestSpecification |
Remarks
By default, Filter tracks all requests and created Specimens, but you can provide a custom filter to only allow certain requests to be traced.
As this is a variation of the Specification pattern, the filter must return true to allow the request to be tracked.
Methods
| Improve this Doc View SourceCreate(Object, ISpecimenContext)
Creates a new specimen based on a request and raises events tracing the progress.
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.
OnSpecimenCreated(SpecimenCreatedEventArgs)
Raises the SpecimenCreated event.
Declaration
protected virtual void OnSpecimenCreated(SpecimenCreatedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
SpecimenCreatedEventArgs | e | The event arguments for the event. |
OnSpecimenRequested(RequestTraceEventArgs)
Raises the SpecimenRequested event.
Declaration
protected virtual void OnSpecimenRequested(RequestTraceEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RequestTraceEventArgs | e | The event arguments for the event. |
Events
| Improve this Doc View SourceSpecimenCreated
Raised when a specimen was created.
Declaration
public event EventHandler<SpecimenCreatedEventArgs> SpecimenCreated
Event Type
Type | Description |
---|---|
System.EventHandler<SpecimenCreatedEventArgs> |
SpecimenRequested
Raised when a specimen is requested.
Declaration
public event EventHandler<RequestTraceEventArgs> SpecimenRequested
Event Type
Type | Description |
---|---|
System.EventHandler<RequestTraceEventArgs> |