public void TestSetVariableStatementEquals() { SetVariableStatement first = new SetVariableStatement() { ScalarExpression = new StringLiteral() { Value = "test" }, VariableReference = new VariableReference() { Name = "t" } }; SetVariableStatement firstClone = new SetVariableStatement() { ScalarExpression = new StringLiteral() { Value = "test" }, VariableReference = new VariableReference() { Name = "t" } }; SetVariableStatement second = new SetVariableStatement() { ScalarExpression = new StringLiteral() { Value = "test2" }, VariableReference = new VariableReference() { Name = "t" } }; SetVariableStatement third = new SetVariableStatement() { ScalarExpression = new StringLiteral() { Value = "test" }, VariableReference = new VariableReference() { Name = "t2" } }; //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, "other type")); //Hash code Assert.AreEqual(first.GetHashCode(), firstClone.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), third.GetHashCode()); }