Class SpecimenFactory<TInput1, TInput2, T>

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Creates a new specimen using a Func%603.

public class SpecimenFactory<TInput1, TInput2, T> : ISpecimenBuilder

Type Parameters

TInput1

The type of the first parameter provided to the Func.

TInput2

The type of the second parameter provided to the Func.

T

The type of specimen to create.

Inheritance

objectSpecimenFactory<TInput1, TInput2, T>

Implements

ISpecimenBuilder

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

SpecimenFactory(Func<TInput1, TInput2, T>)

Initializes a new instance of the SpecimenFactory%603 class.

public SpecimenFactory(Func<TInput1, TInput2, T> factory)

Parameters

factory Func<TInput1, TInput2, T>

The func that will create specimens.

Remarks

The input parameters to factory will be supplied by the `ISpecimenContext` passed to the `ISpecimenContext)` method.

Properties

Factory

Gets the factory that creates specimens.

public Func<TInput1, TInput2, T> Factory { get; }

Property Value

Func<TInput1, TInput2, T>

Methods

Create(object, ISpecimenContext)

Creates a new specimen based on a request.

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

object

The specimen created by the Func contained by this instance.

Remarks

request is ignored. Instead, the Func contained by this instance is used to create a specimen. The parameters for the Func is supplied by context.