public override bool Like(SemanticException other)
        {
            bool result = base.Like(other);

            ObjectAlreadyChangedException otherObjectAlreadyChangedException = other as ObjectAlreadyChangedException;
            return result
                   && otherObjectAlreadyChangedException != null
                   && Sender == otherObjectAlreadyChangedException.Sender;
        }
        public override bool Like(SemanticException other)
        {
            bool result = base.Like(other);

            RepositorySqlException otherRepositorySqlException = other as RepositorySqlException;
            return result
                   && otherRepositorySqlException != null
                   && string.Equals(SqlString, otherRepositorySqlException.SqlString, StringComparison.Ordinal)
                   && string.Equals(Constraint, otherRepositorySqlException.Constraint, StringComparison.Ordinal);
        }
コード例 #3
0
        /// <summary>
        ///     This exception is semantically like the <paramref name="other" />
        ///     exception, and contains exceptions that are
        ///     <see cref="Like">alike</see>.
        /// </summary>
        /// <param name="other">The <see cref="SemanticException" /> to compare against.</param>
        /// <returns>
        ///     A boolean indicating whether <see cref="CompoundSemanticException">this</see>
        ///     and <paramref name="other" /> are alike.
        /// </returns>
        public override bool Like(SemanticException other)
        {
            if (!base.Like(other))
            {
                return(false);
            }

            CompoundSemanticException ce = (CompoundSemanticException)other;

            return((ce.Elements.Count == Elements.Count) &&
                   Elements.All(x => ce.Elements.Any(x.Like)) &&
                   ce.Elements.All(x => Elements.Any(x.Like)));
        }
コード例 #4
0
        public override bool Like(SemanticException other)
        {
            Contract.Ensures((base.Like(other) &&
                              ((PropertyException)other).Sender == Sender &&
                              ((PropertyException)other).PropertyName == PropertyName) == Contract.Result <bool>());

            if (!base.Like(other))
            {
                return(false);
            }

            PropertyException pe = (PropertyException)other;

            return((pe.PropertyName == PropertyName) && (pe.Sender == Sender));
        }
コード例 #5
0
        public override bool Like(SemanticException other)
        {
            Contract.Ensures((base.Like(other) &&
                              Equals(((ValueException)other).OldValue, OldValue) &&
                              Equals(((ValueException)other).NewValue, NewValue))
                             == Contract.Result <bool>());

            if (!base.Like(other))
            {
                return(false);
            }

            ValueException ve = (ValueException)other;

            return(Equals(ve.OldValue, OldValue) && Equals(ve.NewValue, NewValue));
        }
コード例 #6
0
        public virtual bool Like(SemanticException other)
        {
            Contract.Ensures(other != null || Contract.Result<bool>() == false);
            Contract.Ensures(other != this || Contract.Result<bool>());
#if EXTRA_CONTRACTS
            Contract.Ensures(other == null || GetType() == other.GetType() || Contract.Result<bool>() == false);
#endif
            Contract.Ensures(other == null || other.Message == Message || Contract.Result<bool>() == false);
            Contract.Ensures(other == null || other.InnerException == InnerException || Contract.Result<bool>() == false);

            if (other == null || GetType() != other.GetType())
            {
                return false;
            }
            if (other == this)
            {
                return true;
            }
            return (other.Message == Message) && (other.InnerException == InnerException);
        }
コード例 #7
0
        public virtual bool Like(SemanticException other)
        {
            Contract.Ensures(other != null || Contract.Result <bool>() == false);
            Contract.Ensures(other != this || Contract.Result <bool>());
#if EXTRA_CONTRACTS
            Contract.Ensures(other == null || GetType() == other.GetType() || Contract.Result <bool>() == false);
#endif
            Contract.Ensures(other == null || other.Message == Message || Contract.Result <bool>() == false);
            Contract.Ensures(other == null || other.InnerException == InnerException || Contract.Result <bool>() == false);

            if (other == null || GetType() != other.GetType())
            {
                return(false);
            }

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

            return((other.Message == Message) && (other.InnerException == InnerException));
        }
コード例 #8
0
        /// <summary>
        ///     Add an element exception to <see cref="Elements" />.
        /// </summary>
        /// <param name="exception">The exception that must be added.</param>
        public void AddElement(SemanticException exception)
        {
            Contract.Requires(exception != null);
            Contract.Requires(!Closed);
            Contract.Ensures(
                exception is CompoundSemanticException
                    ? ((CompoundSemanticException)exception).Elements.All(ContainsElement)
                    : Elements.Contains(exception));

            CompoundSemanticException cse = exception as CompoundSemanticException;

            if (cse == null)
            {
                Set.Add(exception);
            }
            else
            {
                foreach (SemanticException ex in cse.Elements)
                {
                    AddElement(ex);
                }
            }
        }
コード例 #9
0
        public override bool Like(SemanticException other)
        {
            Contract.Ensures((base.Like(other)
                              && Equals(((ValueException)other).OldValue, OldValue)
                              && Equals(((ValueException)other).NewValue, NewValue))
                             == Contract.Result<bool>());

            if (!base.Like(other))
            {
                return false;
            }

            ValueException ve = (ValueException)other;
            return Equals(ve.OldValue, OldValue) && Equals(ve.NewValue, NewValue);
        }
コード例 #10
0
        public bool ContainsElement(SemanticException exception)
        {
            Contract.Ensures(Contract.Result <bool>() == Elements.Any(x => x.Like(exception)));

            return(Set.Any(x => x.Like(exception)));
        }
        public override bool Like(SemanticException other)
        {
            Contract.Ensures((base.Like(other)
                              && ((PropertyException)other).Sender == Sender
                              && ((PropertyException)other).PropertyName == PropertyName) == Contract.Result<bool>());

            if (!base.Like(other))
            {
                return false;
            }

            PropertyException pe = (PropertyException)other;
            return (pe.PropertyName == PropertyName) && (pe.Sender == Sender);
        }
        /// <summary>
        /// This exception is semantically like the <paramref name="other"/>
        /// exception, and contains exceptions that are
        /// <see cref="Like">alike</see>.
        /// </summary>
        public override bool Like(SemanticException other)
        {
            if (!base.Like(other))
            {
                return false;
            }

            CompoundSemanticException ce = (CompoundSemanticException)other;
            return (ce.Elements.Count == Elements.Count)
                   && Elements.All(x => ce.Elements.Any(x.Like))
                   && ce.Elements.All(x => Elements.Any(x.Like));
        }
        public bool ContainsElement(SemanticException exception)
        {
            Contract.Ensures(Contract.Result<bool>() == Elements.Any(x => x.Like(exception)));

            return Set.Any(x => x.Like(exception));
        }
        /// <summary>
        /// Add an element exception to <see cref="Elements"/>.
        /// </summary>
        public void AddElement(SemanticException exception)
        {
            Contract.Requires(exception != null);
            Contract.Requires(!Closed);
            Contract.Ensures(
                exception is CompoundSemanticException
                    ? ((CompoundSemanticException)exception).Elements.All(ContainsElement)
                    : Elements.Contains(exception));

            CompoundSemanticException cse = exception as CompoundSemanticException;
            if (cse == null)
            {
                Set.Add(exception);
            }
            else
            {
                foreach (SemanticException ex in cse.Elements)
                {
                    AddElement(ex);
                }
            }
        }