public void TestGetHashCode() { UnaryExpressionStub expression1 = new UnaryExpressionStub(new VariableExpression(new Variable("scooby"))); UnaryExpressionStub expression2 = new UnaryExpressionStub(new VariableExpression(new Variable("scooby"))); UnaryExpressionStub expression3 = new UnaryExpressionStub(new VariableExpression(new Variable("velma"))); Assert.IsTrue(expression1.GetHashCode() == expression2.GetHashCode(), "expression1 should have same hash code as expression2"); Assert.IsTrue(expression1.GetHashCode() != expression3.GetHashCode(), "expression1 should not have same hash code as expression3"); }
public void TestEquals() { UnaryExpressionStub expression1 = new UnaryExpressionStub(new VariableExpression(new Variable("scooby"))); UnaryExpressionStub expression2 = new UnaryExpressionStub(new VariableExpression(new Variable("scooby"))); UnaryExpressionStub expression3 = new UnaryExpressionStub(new VariableExpression(new Variable("velma"))); Assert.IsTrue(expression1.Equals(expression2), "expression1 should equal expression2"); Assert.IsTrue(!expression1.Equals(expression3), "expression1 should not equal expression3"); }