Class TracingBuilder
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Tracks any request and passes it on to the container. Tracks any returned object from the container and passes it on.
public class TracingBuilder : ISpecimenBuilderInheritance
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Extension Methods
SpecimenFactory.Create<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder), SpecimenFactory.CreateMany<T>(ISpecimenBuilder, int), SpecimenCommand.Do<T>(ISpecimenBuilder, Action<T>), SpecimenCommand.Do<T1, T2>(ISpecimenBuilder, Action<T1, T2>), SpecimenCommand.Do<T1, T2, T3>(ISpecimenBuilder, Action<T1, T2, T3>), SpecimenCommand.Do<T1, T2, T3, T4>(ISpecimenBuilder, Action<T1, T2, T3, T4>), SpecimenQuery.Get<T, TResult>(ISpecimenBuilder, Func<T, TResult>), SpecimenQuery.Get<T1, T2, TResult>(ISpecimenBuilder, Func<T1, T2, TResult>), SpecimenQuery.Get<T1, T2, T3, TResult>(ISpecimenBuilder, Func<T1, T2, T3, TResult>), SpecimenQuery.Get<T1, T2, T3, T4, TResult>(ISpecimenBuilder, Func<T1, T2, T3, T4, TResult>), CustomizationExtensions.ToCustomization(ISpecimenBuilder)
Constructors
TracingBuilder(ISpecimenBuilder)
Initializes a new instance of the TracingBuilder class with a decorated
ISpecimenBuilder.
public TracingBuilder(ISpecimenBuilder builder)Parameters
builder ISpecimenBuilder
The ISpecimenBuilder to decorate.
Properties
Builder
Gets the builder decorated by this instance.
public ISpecimenBuilder Builder { get; }Property Value
Filter
Gets or sets a filter for tracking.
public IRequestSpecification Filter { get; set; }Property Value
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
Create(object, ISpecimenContext)
Creates a new specimen based on a request and raises events tracing the progress.
public object Create(object request, ISpecimenContext context)Parameters
request object
The request that describes what to create.
context ISpecimenContext
A context that can be used to create other specimens.
Returns
The requested specimen if possible; otherwise a NoSpecimen instance.
Remarks
The request can be any object, but will often be a
`Type` or other `MemberInfo` instances.
OnSpecimenCreated(SpecimenCreatedEventArgs)
Raises the SpecimenCreated event.
protected virtual void OnSpecimenCreated(SpecimenCreatedEventArgs e)Parameters
The event arguments for the event.
OnSpecimenRequested(RequestTraceEventArgs)
Raises the SpecimenRequested event.
protected virtual void OnSpecimenRequested(RequestTraceEventArgs e)Parameters
The event arguments for the event.
SpecimenCreated
Raised when a specimen was created.
public event EventHandler<SpecimenCreatedEventArgs> SpecimenCreatedEvent Type
EventHandler<SpecimenCreatedEventArgs>
SpecimenRequested
Raised when a specimen is requested.
public event EventHandler<RequestTraceEventArgs> SpecimenRequested