Class CreateSeedExtensions
Creates anonymous variables from ISpecimenContext or ISpecimenBuilder instances using the passed seed instance.
Inheritance
Inherited Members
Namespace: AutoFixture
Assembly: AutoFixture.SeedExtensions.dll
Syntax
public static class CreateSeedExtensions
Methods
| Improve this Doc View SourceCreate<T>(ISpecimenBuilder, T)
Creates an anonymous object, potentially using the supplied seed as additional information when creating the object.
Declaration
public static T Create<T>(this ISpecimenBuilder builder, T seed)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The builder used to resolve the type request. |
T | seed | Any data that adds additional information when creating the anonymous object. |
Returns
Type | Description |
---|---|
T | An anonymous object. |
Type Parameters
Name | Description |
---|---|
T | The type of object to create. |
Create<T>(ISpecimenContext, T)
Creates an anonymous object, potentially using the supplied seed as additional information when creating the object.
Declaration
public static T Create<T>(this ISpecimenContext context, T seed)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenContext | context | The context used to resolve the type request. |
T | seed | Any data that adds additional information when creating the anonymous object. |
Returns
Type | Description |
---|---|
T | An anonymous object. |
Type Parameters
Name | Description |
---|---|
T | The type of object to create. |
CreateAnonymous<T>(ISpecimenContext, T)
Creates an anonymous object, potentially using the supplied seed as additional information when creating the object.
Declaration
[Obsolete("Please move over to using Create<T>() as this method will be removed in the next release", true)]
public static T CreateAnonymous<T>(this ISpecimenContext context, T seed)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenContext | context | The context used to resolve the type request. |
T | seed | Any data that adds additional information when creating the anonymous object. |
Returns
Type | Description |
---|---|
T | An anonymous object. |
Type Parameters
Name | Description |
---|---|
T | The type of object to create. |
Remarks
Obsolete: Please move over to using Create<T>(ISpecimenContext) as this method will be removed in the next release.
CreateMany<T>(ISpecimenBuilder, T)
Creates many anonymous objects.
Declaration
public static IEnumerable<T> CreateMany<T>(this ISpecimenBuilder builder, T seed)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The builder used to resolve the type request. |
T | seed | An initial value that may or may not be used as input for the algorithm creating the return value. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | A sequence of anonymous object of type |
Type Parameters
Name | Description |
---|---|
T | The type of objects to create. |
Remarks
The CreateMany implementation always returns a new instance of System.Collections.Generic.IEnumerable<T>. Even if IEnumerable<T> is Frozen by the Freeze<T>(IFixture) method or explicitly assigned with the Inject<T>(IFixture, T) method, the CreateMany method returns a new, independent instance of IEnumerable<T>.
However, you can change this behavior, for example by applying the MapCreateManyToEnumerable customization.
CreateMany<T>(ISpecimenBuilder, T, Int32)
Creates many anonymous objects.
Declaration
public static IEnumerable<T> CreateMany<T>(this ISpecimenBuilder builder, T seed, int count)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenBuilder | builder | The builder used to resolve the type request. |
T | seed | An initial value that may or may not be used as input for the algorithm creating the return value. |
System.Int32 | count | The number of objects to create. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | A sequence of anonymous objects of type |
Type Parameters
Name | Description |
---|---|
T | The type of objects to create. |
Remarks
The CreateMany implementation always returns a new instance of System.Collections.Generic.IEnumerable<T>. Even if IEnumerable<T> is Frozen by the Freeze<T>(IFixture) method or explicitly assigned with the Inject<T>(IFixture, T) method, the CreateMany method returns a new, independent instance of IEnumerable<T>.
However, you can change this behavior, for example by applying the MapCreateManyToEnumerable customization.
CreateMany<T>(ISpecimenContext, T)
Creates many anonymous objects.
Declaration
public static IEnumerable<T> CreateMany<T>(this ISpecimenContext context, T seed)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenContext | context | The context used to resolve the type request. |
T | seed | An initial value that may or may not be used as input for the algorithm creating the return value. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | A sequence of anonymous object of type |
Type Parameters
Name | Description |
---|---|
T | The type of objects to create. |
Remarks
The CreateMany implementation always returns a new instance of System.Collections.Generic.IEnumerable<T>. Even if IEnumerable<T> is Frozen by the Freeze<T>(IFixture) method or explicitly assigned with the Inject<T>(IFixture, T) method, the CreateMany method returns a new, independent instance of IEnumerable<T>.
However, you can change this behavior, for example by applying the MapCreateManyToEnumerable customization.
CreateMany<T>(ISpecimenContext, T, Int32)
Creates many anonymous objects.
Declaration
public static IEnumerable<T> CreateMany<T>(this ISpecimenContext context, T seed, int count)
Parameters
Type | Name | Description |
---|---|---|
ISpecimenContext | context | The context used to resolve the type request. |
T | seed | An initial value that may or may not be used as input for the algorithm creating the return value. |
System.Int32 | count | The number of objects to create. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | A sequence of anonymous objects of type |
Type Parameters
Name | Description |
---|---|
T | The type of objects to create. |
Remarks
The CreateMany implementation always returns a new instance of System.Collections.Generic.IEnumerable<T>. Even if IEnumerable<T> is Frozen by the Freeze<T>(IFixture) method or explicitly assigned with the Inject<T>(IFixture, T) method, the CreateMany method returns a new, independent instance of IEnumerable<T>.
However, you can change this behavior, for example by applying the MapCreateManyToEnumerable customization.