예제 #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is ExpressionFilter <T> filter))
            {
                return(false);
            }

            return(Ranges.SetEquals(filter.Ranges) &&
                   SingleValues.SetEquals(filter.SingleValues) &&
                   ComparablePredicates.SetEquals(filter.ComparablePredicates) &&
                   LikePredicates.SetEquals(filter.LikePredicates) &&
                   this[VariableClauseTypes.Range].SetEquals(filter[VariableClauseTypes.Range]) &&
                   this[VariableClauseTypes.Value].SetEquals(filter[VariableClauseTypes.Value]) &&
                   this[VariableClauseTypes.Predicate].SetEquals(filter[VariableClauseTypes.Predicate]) &&
                   this[VariableClauseTypes.Is].SetEquals(filter[VariableClauseTypes.Is]) &&
                   Limits.Equals(filter.Limits));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogInfoResponse other &&
                   ((Context == null && other.Context == null) || (Context?.Equals(other.Context) == true)) &&
                   ((Errors == null && other.Errors == null) || (Errors?.Equals(other.Errors) == true)) &&
                   ((Limits == null && other.Limits == null) || (Limits?.Equals(other.Limits) == true)) &&
                   ((StandardUnitDescriptionGroup == null && other.StandardUnitDescriptionGroup == null) || (StandardUnitDescriptionGroup?.Equals(other.StandardUnitDescriptionGroup) == true)));
        }
예제 #3
0
        public void Equals()
        {
            var a = new Limits(1);
            var b = new Limits(1);

            Assert.That(a.Equals(a), Is.True);
            Assert.That(a.Equals(b), Is.True);
            Assert.That(a.Equals(null), Is.False);
            Assert.That(a.Equals((object)a), Is.True);
            Assert.That(a.Equals((object)b), Is.True);
            Assert.That(a.Equals((object)null), Is.False);
            Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode()));
            Assert.That(a == b, Is.True);
            Assert.That(a != b, Is.False);
        }