public void TestOrderByClauseEquals() { OrderByClause first = new OrderByClause() { OrderExpressions = new List <OrderBy.OrderElement>() { new OrderExpression() { Ascending = true, Expression = new ColumnReference() { Identifiers = new List <string>() { "c1" } } } } }; OrderByClause firstClone = new OrderByClause() { OrderExpressions = new List <OrderBy.OrderElement>() { new OrderExpression() { Ascending = true, Expression = new ColumnReference() { Identifiers = new List <string>() { "c1" } } } } }; OrderByClause second = new OrderByClause() { OrderExpressions = new List <OrderBy.OrderElement>() { new OrderExpression() { Ascending = true, Expression = new ColumnReference() { Identifiers = new List <string>() { "c2" } } } } }; //Equals Assert.IsTrue(Equals(first, firstClone)); Assert.IsFalse(Equals(first, null)); Assert.IsFalse(Equals(first, second)); Assert.IsFalse(Equals(first, "other type")); //Hash code Assert.AreEqual(first.GetHashCode(), firstClone.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); }