public override bool Equals(object obj)
{
if (ReferenceEquals(obj, this))
{
return true;
}
if (obj == null)
{
return false;
}
if (GetType() != obj.GetType())
{
return false;
}
var other = obj as Query;
if (Number.FloatToIntBits(Boost) != Number.FloatToIntBits(other.Boost))
{
return false;
}
return true;
}
}
/// <summary> /// check very basic hashCode and equals </summary> public static void CheckHashEquals(Query q) { Query q2 = (Query)q.Clone(); CheckEqual(q, q2); Query q3 = (Query)q.Clone(); q3.Boost = 7.21792348f; CheckUnequal(q, q3); // test that a class check is done so that no exception is thrown // in the implementation of equals() Query whacky = new QueryAnonymousInnerClassHelper(); whacky.Boost = q.Boost; CheckUnequal(q, whacky); // null test Assert.IsFalse(q.Equals(null)); }