Class SpecimenFactory<T>
Creates a new specimen using a System.Func<TResult>.
Inheritance
System.Object
SpecimenFactory<T>
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class SpecimenFactory<T> : ISpecimenBuilder
Type Parameters
Name | Description |
---|---|
T | The type of specimen to create. |
Constructors
| Improve this Doc View SourceSpecimenFactory(Func<T>)
Initializes a new instance of the SpecimenFactory<T> class.
Declaration
public SpecimenFactory(Func<T> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T> | factory | The func that will create specimens. |
Properties
| Improve this Doc View SourceFactory
Gets the factory that will create specimens.
Declaration
public Func<T> Factory { get; }
Property Value
Type | Description |
---|---|
System.Func<T> |
Methods
| Improve this Doc View SourceCreate(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 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.