public void TestWhereClauseEquals()
        {
            WhereClause first = new WhereClause()
            {
                Expression = new BooleanScalarExpression()
                {
                    ScalarExpression = new ColumnReference()
                    {
                        Identifiers = new List <string>()
                        {
                            "c1"
                        }
                    }
                }
            };

            WhereClause firstClone = new WhereClause()
            {
                Expression = new BooleanScalarExpression()
                {
                    ScalarExpression = new ColumnReference()
                    {
                        Identifiers = new List <string>()
                        {
                            "c1"
                        }
                    }
                }
            };

            WhereClause second = new WhereClause()
            {
                Expression = new BooleanScalarExpression()
                {
                    ScalarExpression = 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());
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = FeatureClass.GetHashCode();
         hashCode = (hashCode * 397) ^ (WhereClause != null ? WhereClause.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)GeometryType;
         return(hashCode);
     }
 }
Exemple #3
0
 public override int GetHashCode()
 {
     unchecked {
         return(((EntityName != null ? EntityName.GetHashCode() : 0) * 397) ^ (WhereClause != null ? WhereClause.GetHashCode() : 0));
     }
 }