public void Equality() { var idt = new SymbolTable(); FullSymbol a1 = FullSymbol.Create(idt, @"c.AAA.CCC"); FullSymbol a2 = FullSymbol.Create(idt, @"c.AAA.CCC"); FullSymbol a3 = FullSymbol.Create(idt, @"c.BBB.CCC"); XAssert.IsTrue(a1.Equals(a1)); XAssert.IsTrue(a1.Equals(a2)); XAssert.IsTrue(a2.Equals(a1)); XAssert.IsFalse(a1.Equals(a3)); XAssert.IsFalse(a2.Equals(a3)); XAssert.IsTrue(a1.Equals((object)a1)); XAssert.IsTrue(a1.Equals((object)a2)); XAssert.IsTrue(a2.Equals((object)a1)); XAssert.IsFalse(a1.Equals((object)a3)); XAssert.IsFalse(a2.Equals((object)a3)); XAssert.IsTrue(a1 == a2); XAssert.IsTrue(a2 == a1); XAssert.IsFalse(a1 == a3); XAssert.IsFalse(a2 == a3); XAssert.IsFalse(a1 != a2); XAssert.IsFalse(a2 != a1); XAssert.IsTrue(a1 != a3); XAssert.IsTrue(a2 != a3); int h1 = a1.GetHashCode(); int h2 = a2.GetHashCode(); XAssert.AreEqual(h1, h2); }
/// <inheritdoc /> public override int GetHashCode() { return(HashCodeHelper.Combine( ParentIdentifier.GetHashCode(), ParentQualifier.GetHashCode(), ChildIdentifier.GetHashCode(), ChildQualifier.GetHashCode())); }
/// <inheritdoc/> protected override int GetDerivedSpecificHashCode() { return(m_value.GetHashCode()); }