Class BooleanSwitch

Namespace: AutoFixture
Assembly: AutoFixture.dll

Creates an alternating sequence of true and false.

public class BooleanSwitch : ISpecimenBuilder

Inheritance

objectBooleanSwitch

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

BooleanSwitch()

Initializes a new instance of the BooleanSwitch class.

public BooleanSwitch()

Methods

Create()

Returns an alternating sequence of true and false every other time it is invoked.

[Obsolete("Please use the Create(request, context) method as this overload will be removed to make API uniform.")]
public bool Create()

Returns

bool

true, followed by false at the next invocation, and so on.

Create(object, ISpecimenContext)

Returns an alternating sequence of true and false every other time it is invoked.

public object Create(object request, ISpecimenContext context)

Parameters

request object

The request that describes what to create.

context ISpecimenContext

Not used.

Returns

object

true, followed by false at the next invocation, and so on, if request is a request for a boolean; otherwise, a NoSpecimen instance.

CreateAnonymous()

Returns an alternating sequence of true and false every other time it is invoked.

[Obsolete("Please move over to using Create() as this method will be removed in the next release", true)]
public bool CreateAnonymous()

Returns

bool

true, followed by false at the next invocation, and so on.

Remarks

Obsolete: Please move over to using Create?text=Create() as this method will be removed in the next release.