Class OmitSpecimen

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

A signal type used to indicate to the Auto-Property feature that a given request should be ignored, and no further processing performed.

public class OmitSpecimen : IEquatable<OmitSpecimen>

Inheritance

objectOmitSpecimen

Implements

IEquatable<OmitSpecimen>

Inherited Members

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

Remarks

This signal type is different from `NoSpecimen` in that it stops further processing. Where NoSpecimen is simply an indication that a particular `ISpecimenBuilder` can't provide a value for a request, an OmitSpecimen instance explicitly indicates that no value will be provided for a request - not even null.

The OmitSpecimen type is explicitly understood by `AutoPropertiesCommand`, but can be returned by any ISpecimenBuilder.

Constructors

OmitSpecimen()

public OmitSpecimen()

Methods

Equals(object)

Determines whether the specified Object is equal to this instance.

public override bool Equals(object obj)

Parameters

obj object

The Object to compare with this instance.

Returns

bool

true if the specified Object is an instance of OmitSpecimen; otherwise, false.

See Also

OmitSpecimen.Equals(OmitSpecimen)

Equals(OmitSpecimen)

Determines whether the specified OmitSpecimen instance is equal to the current instance.

public bool Equals(OmitSpecimen other)

Parameters

other OmitSpecimen

The other instance.

Returns

bool

true if other is not null; otherwise false.

Remarks

It may seem a little strange that any `OmitSpecimen` instance is equal to any other instance of that type, but the class is a pure signal type that carries no state, so there's no reason to distinguish between instances. In essence, it could just as well have been modeled as a Singleton, but wasn't because it seems to bring no particular extra benefit.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.