Class NoSpecimen

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Signifies that it's not a specimen.

public sealed class NoSpecimen : IEquatable<NoSpecimen>

Inheritance

objectNoSpecimen

Implements

IEquatable<NoSpecimen>

Inherited Members

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

Remarks

`ISpecimenBuilder` implementations are expected to return `NoSpecimen` instances if they can't handle the request. This ensures that null can be used as a proper return value.

Constructors

NoSpecimen()

Initializes a new instance of the NoSpecimen class.

[Obsolete("Use the NoSpecimen.Instance property instead of calling new NoSpecimen(). This constructor is being deprecated in future versions of AutoFixture, as creating many NoSpecimen instances causes excessive memory usage: https://github.com/AutoFixture/AutoFixture/issues/1489", false)]
public NoSpecimen()

Properties

Instance

The singleton instance of NoSpecimen.

public static NoSpecimen Instance { get; }

Property Value

NoSpecimen

Methods

Equals(object)

Determines whether the specified Object is equal to the current NoSpecimen instance.

public override bool Equals(object obj)

Parameters

obj object

The Object to compare to the current instance.

Returns

bool

true if the specified Object is equal to the current instance; otherwise, false.

Equals(NoSpecimen)

Indicates whether the current instance is equal to another NoSpecimen instance.

public bool Equals(NoSpecimen other)

Parameters

other NoSpecimen

A NoSpecimen instance to compare with this instance.

Returns

bool

true if the current instance is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as a hash function for the NoSpecimen class.

public override int GetHashCode()

Returns

int

A hash code for the current NoSpecimen instance.