Exemple #1
0
        public QaError([NotNull] ITest test,
                       [NotNull] string description,
                       [NotNull] IEnumerable <InvolvedRow> involvedRows,
                       [CanBeNull] IGeometry geometry,
                       [CanBeNull] IssueCode issueCode,
                       [CanBeNull] string affectedComponent,
                       bool assertionFailed = false,
                       [CanBeNull] IEnumerable <object> values = null)
        {
            Assert.ArgumentNotNull(test, nameof(test));
            Assert.ArgumentNotNullOrEmpty(description, nameof(description));
            Assert.ArgumentNotNull(involvedRows, nameof(involvedRows));

            Test         = test;
            InvolvedRows = new List <InvolvedRow>(involvedRows);

            _errorGeometry = new QaErrorGeometry(geometry);

            IssueCode         = issueCode;
            AffectedComponent = affectedComponent;
            Description       = description;
            AssertionFailed   = assertionFailed;
            Values            = values?.ToList();

            Duplicate = false;
        }
        public int CompareEnvelope(QaErrorGeometry other)
        {
            if (!_hasGeometry)
            {
                return(other._hasGeometry
                                               ? -1
                                               : 0);
            }

            if (!other._hasGeometry)
            {
                return(1);
            }

            bool thisHasEnv  = VerifyEnvelope();
            bool otherHasEnv = other.VerifyEnvelope();

            if (thisHasEnv == false)
            {
                return(otherHasEnv
                                               ? -1
                                               : 0);
            }

            if (!otherHasEnv)
            {
                return(1);
            }

            if (!IsWithinTolerance(_xMin, other._xMin))
            {
                return(Math.Sign(_xMin - other._xMin));
            }

            if (!IsWithinTolerance(_yMin, other._yMin))
            {
                return(Math.Sign(_yMin - other._yMin));
            }

            if (!IsWithinTolerance(_xMax, other._xMax))
            {
                return(Math.Sign(_xMax - other._xMax));
            }

            if (!IsWithinTolerance(_yMax, other._yMax))
            {
                return(Math.Sign(_yMax - other._yMax));
            }

            return(0);
        }