public void TestSearchExpressionEquals() { SearchExpression first = new SearchExpression() { AllColumns = false, Columns = new List <ColumnReference>() { new ColumnReference() { Identifiers = new List <string>() { "c1" } } }, Value = new StringLiteral() { Value = "test" } }; SearchExpression firstClone = new SearchExpression() { AllColumns = false, Columns = new List <ColumnReference>() { new ColumnReference() { Identifiers = new List <string>() { "c1" } } }, Value = new StringLiteral() { Value = "test" } }; SearchExpression second = new SearchExpression() { AllColumns = true, Columns = new List <ColumnReference>() { new ColumnReference() { Identifiers = new List <string>() { "c1" } } }, Value = new StringLiteral() { Value = "test" } }; SearchExpression third = new SearchExpression() { AllColumns = false, Columns = new List <ColumnReference>() { new ColumnReference() { Identifiers = new List <string>() { "c2" } } }, Value = new StringLiteral() { Value = "test" } }; SearchExpression fourth = new SearchExpression() { AllColumns = false, Columns = new List <ColumnReference>() { new ColumnReference() { Identifiers = new List <string>() { "c1" } } }, Value = new StringLiteral() { Value = "test2" } }; //Equals Assert.IsTrue(Equals(first, firstClone)); Assert.IsFalse(Equals(first, null)); Assert.IsFalse(Equals(first, second)); Assert.IsFalse(Equals(first, third)); Assert.IsFalse(Equals(first, fourth)); Assert.IsFalse(Equals(first, "other type")); //Hash code Assert.AreEqual(first.GetHashCode(), firstClone.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), third.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), fourth.GetHashCode()); }