C# Class AutoFixture.Kernel.Criterion

Serves as a criterion against which a value can be compared. When a given value equals the criterion, it can be said to match the criterion; otherwise not.

Sometimes you need to compare various candidates against a particular value, but the comparison rules may vary. Sometimes, strict equality is warranted, but otherwise (e.g. when comparing strings) looser comparison rules can be applied (e.g. case-insensitve comparison of strings).

The Criterion class enables you to capture the desied value (the Target) together with the appropriate comparison method (the Comparer) in a single object.

Inheritance: IEquatable
Mostra file Open project: nxzzkj/lazyiot

Public Methods

Method Description
Criterion ( target, IEqualityComparer comparer ) : System

Initializes a new instance of the Criterion{T} class.

Equals ( other ) : bool

Compares a candidate value against this Criterion{T}.

This method compares the candidate other against Target, using Comparer as the comparison method. If this combination of target value and comparison method deems the candidate to be equal to this criterion, the return value is .

Equals ( object obj ) : bool

Determines whether this object is equal to another object.

GetHashCode ( ) : int

Returns the hash code for the object.

Method Details

Criterion() public method

Initializes a new instance of the Criterion{T} class.
/// is . ///
public Criterion ( target, IEqualityComparer comparer ) : System
target /// The target value against which candidates will be compared. Can be /// . ///
comparer IEqualityComparer /// The comparison method used to compare candidates against /// . ///
return System

Equals() public method

Compares a candidate value against this Criterion{T}.

This method compares the candidate other against Target, using Comparer as the comparison method. If this combination of target value and comparison method deems the candidate to be equal to this criterion, the return value is .

public Equals ( other ) : bool
other /// The candidate to compare against this value. ///
return bool

Equals() public method

Determines whether this object is equal to another object.
public Equals ( object obj ) : bool
obj object The object to compare to this object.
return bool

GetHashCode() public method

Returns the hash code for the object.
public GetHashCode ( ) : int
return int