Class SeedIgnoringRelay

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Unwraps a request for a SeededRequest to a request for its Request while ignoring the Seed.

public class SeedIgnoringRelay : ISpecimenBuilder

Inheritance

objectSeedIgnoringRelay

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

SeedIgnoringRelay()

public SeedIgnoringRelay()

Methods

Create(object, ISpecimenContext)

Creates an anonymous value by unwrapping a seeded request and ignoring the seed.

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

A specimen based on request if possible; otherwise, null.

Remarks

If request is a seeded request, the Create method unwraps the inner request and forwards it to context. The seed value is ignored.

The purpose of this class is to provide a fallback to handle seeded requests that no other `ISpecimenBuilder` instances have been able to handle. By ignoring the seed value, it handles those scenarios where the seed value and the inner request don't match and can't be combined, ensuring that at least some value is returned.