Class CreateSeedExtensions

Namespace: AutoFixture
Assembly: AutoFixture.SeedExtensions.dll

Creates anonymous variables from ISpecimenContext or ISpecimenBuilder instances using the passed seed instance.

public static class CreateSeedExtensions

Inheritance

objectCreateSeedExtensions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods

Create<T>(ISpecimenBuilder, T)

Creates an anonymous object, potentially using the supplied seed as additional information when creating the object.

public static T Create<T>(this ISpecimenBuilder builder, T seed)

Parameters

builder ISpecimenBuilder

The builder used to resolve the type request.

seed T

Any data that adds additional information when creating the anonymous object.

Returns

T

An anonymous object.

Type Parameters

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.

public static T Create<T>(this ISpecimenContext context, T seed)

Parameters

context ISpecimenContext

The context used to resolve the type request.

seed T

Any data that adds additional information when creating the anonymous object.

Returns

T

An anonymous object.

Type Parameters

T

The type of object to create.

CreateMany<T>(ISpecimenBuilder, T)

Creates many anonymous objects.

public static IEnumerable<T> CreateMany<T>(this ISpecimenBuilder builder, T seed)

Parameters

builder ISpecimenBuilder

The builder used to resolve the type request.

seed T

An initial value that may or may not be used as input for the algorithm creating the return value.

Returns

IEnumerable<T>

A sequence of anonymous object of type T.

Type Parameters

T

The type of objects to create.

Remarks

The CreateMany implementation always returns a new instance of `IEnumerable%601`. Even if IEnumerable<T> is Frozen by the `IFixture)` method or explicitly assigned with the `IFixture%2c%60%600)` method, the CreateMany method returns a new, independent instance of IEnumerable<T>.

CreateMany<T>(ISpecimenContext, T)

Creates many anonymous objects.

public static IEnumerable<T> CreateMany<T>(this ISpecimenContext context, T seed)

Parameters

context ISpecimenContext

The context used to resolve the type request.

seed T

An initial value that may or may not be used as input for the algorithm creating the return value.

Returns

IEnumerable<T>

A sequence of anonymous object of type T.

Type Parameters

T

The type of objects to create.

Remarks

The CreateMany implementation always returns a new instance of `IEnumerable%601`. Even if IEnumerable<T> is Frozen by the `IFixture)` method or explicitly assigned with the `IFixture%2c%60%600)` method, the CreateMany method returns a new, independent instance of IEnumerable<T>.

CreateMany<T>(ISpecimenBuilder, T, int)

Creates many anonymous objects.

public static IEnumerable<T> CreateMany<T>(this ISpecimenBuilder builder, T seed, int count)

Parameters

builder ISpecimenBuilder

The builder used to resolve the type request.

seed T

An initial value that may or may not be used as input for the algorithm creating the return value.

count int

The number of objects to create.

Returns

IEnumerable<T>

A sequence of anonymous objects of type T.

Type Parameters

T

The type of objects to create.

Remarks

The CreateMany implementation always returns a new instance of `IEnumerable%601`. Even if IEnumerable<T> is Frozen by the `IFixture)` method or explicitly assigned with the `IFixture%2c%60%600)` method, the CreateMany method returns a new, independent instance of IEnumerable<T>.

CreateMany<T>(ISpecimenContext, T, int)

Creates many anonymous objects.

public static IEnumerable<T> CreateMany<T>(this ISpecimenContext context, T seed, int count)

Parameters

context ISpecimenContext

The context used to resolve the type request.

seed T

An initial value that may or may not be used as input for the algorithm creating the return value.

count int

The number of objects to create.

Returns

IEnumerable<T>

A sequence of anonymous objects of type T.

Type Parameters

T

The type of objects to create.

Remarks

The CreateMany implementation always returns a new instance of `IEnumerable%601`. Even if IEnumerable<T> is Frozen by the `IFixture)` method or explicitly assigned with the `IFixture%2c%60%600)` method, the CreateMany method returns a new, independent instance of IEnumerable<T>.