Class NoSpecimen

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Signifies that it's not a specimen.

public class NoSpecimen : IEquatable<NoSpecimen>

Inheritance

objectNoSpecimen

Implements

IEquatable<NoSpecimen>

Inherited Members

object.GetType(), object.MemberwiseClone(), 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 with a null request.

public NoSpecimen()

NoSpecimen(object)

Initializes a new instance of the NoSpecimen class with the supplied request.

[Obsolete("Use NoSpecimen() instead of NoSpecimen(object). The Request property, and this constructor that populates it, is being retired in future versions of AutoFixture, as it has turned out that no one uses it. You can still use the parameterless NoSpecimen constructor overload. The NoSpecimen class itself will remain. If you're seeing this warning in AutoFixture 3.x, and, despite expectations, have a real need to use the Request property, please provide feedback on https://github.com/AutoFixture/AutoFixture/issues/475 .", true)]
public NoSpecimen(object request)

Parameters

request object

The original request that prompts the creation of this instance.

Properties

Request

Gets the original request that prompted the creation of the current instance.

[Obsolete("The Request property is being retired in future versions of AutoFixture, as it has turned out that no one uses it. If you're seeing this warning in AutoFixture 3.x, and, despite expectations, have a real need to use the Request property, please provide feedback on https://github.com/AutoFixture/AutoFixture/issues/475.", true)]
public object Request { get; }

Property Value

object

Remarks

This property value may be null.

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.