/// <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)); }
/// <summary> /// Check very basic <see cref="object.GetHashCode()"/> and <see cref="object.Equals(object)"/>. </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)); }