Ejemplo n.º 1
0
        public void Equality()
        {
            var fieldValue  = new FieldValue("A", "B");
            var fieldValue2 = new FieldValue("A", "B");

            Assert.True(fieldValue.Equals(fieldValue2));
        }
Ejemplo n.º 2
0
        // ReSharper disable DoNotCallOverridableMethodsInConstructor
        ///<summary>
        ///Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        ///</summary>
        ///
        ///<returns>
        ///true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        ///</returns>
        ///
        ///<param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>. </param><filterpriority>2</filterpriority>
        public override bool Equals(object obj)
        {
            Criteria otherCriteria = obj as Criteria;

            if (otherCriteria == null)
            {
                return(false);
            }
            if (IsComposite())
            {
                if (!otherCriteria.IsComposite())
                {
                    return(false);
                }
                if (LeftCriteria == null && otherCriteria.LeftCriteria == null)
                {
                    return(LogicalOperator == otherCriteria.LogicalOperator && RightCriteria.Equals(otherCriteria.RightCriteria));
                }
                if (LeftCriteria == null)
                {
                    return(false);
                }
                if (!LeftCriteria.Equals(otherCriteria.LeftCriteria))
                {
                    return(false);
                }
                return(LogicalOperator == otherCriteria.LogicalOperator && RightCriteria.Equals(otherCriteria.RightCriteria));
            }
            if (ComparisonOperator != otherCriteria.ComparisonOperator)
            {
                return(false);
            }
            if (String.Compare(Field.PropertyName, otherCriteria.Field.PropertyName) != 0)
            {
                return(false);
            }
            if (FieldValue == null && otherCriteria.FieldValue == null)
            {
                return(true);
            }
            if (FieldValue == null)
            {
                return(false);
            }
            if (FieldValue is IEnumerable && otherCriteria.FieldValue is IEnumerable)
            {
                return(((IEnumerable)FieldValue).IsEqualTo((IEnumerable)otherCriteria.FieldValue));
            }
            return(FieldValue.Equals(otherCriteria.FieldValue));
        }
Ejemplo n.º 3
0
 public override bool Equals(object other)
 {
     if (this == other)
     {
         return(true);
     }
     if (other == null || GetType() != other.GetType())
     {
         return(false);
     }
     Db4objects.Db4o.NativeQueries.Expr.ComparisonExpression casted = (Db4objects.Db4o.NativeQueries.Expr.ComparisonExpression
                                                                       )other;
     return(_left.Equals(casted._left) && _right.Equals(casted._right) && _op.Equals(casted
                                                                                     ._op));
 }
Ejemplo n.º 4
0
        public override bool Equals(object other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other == null || GetType() != other.GetType())
            {
                return(false);
            }
            var casted = (ComparisonExpression
                          )other;

            return(_left.Equals(casted._left) && _right.Equals(casted._right) && _op.Equals(casted
                                                                                            ._op));
        }