/// <summary>
        /// Initializes a new instance of the <see cref="QualityConditionVerification"/> class.
        /// </summary>
        /// <param name="element">The specification element that was verified.</param>
        public QualityConditionVerification([NotNull] QualitySpecificationElement element)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            QualityCondition qualityCondition = element.QualityCondition;

            _qualityCondition            = qualityCondition;
            _qualityConditionId          = qualityCondition.Id;
            _qualityConditionVersion     = qualityCondition.Version;
            _qualityConditionName        = qualityCondition.Name;
            _qualityConditionParamValues =
                qualityCondition.GetParameterValuesString(_maxLengthParamValues);

            TestDescriptor  testDescriptor = qualityCondition.TestDescriptor;
            ClassDescriptor testClass      = testDescriptor.TestClass;

            if (testClass != null)
            {
                _testType      = testClass.TypeName;
                _constructorId = testDescriptor.TestConstructorId;
            }
            else
            {
                ClassDescriptor factoryDescriptor = testDescriptor.TestFactoryDescriptor;
                Assert.NotNull(factoryDescriptor,
                               "both TestClass and TestFactory descriptors are null");

                _testType      = factoryDescriptor.TypeName;
                _constructorId = -1;
            }

            _allowErrors = element.AllowErrors;
            _stopOnError = element.StopOnError;
        }
Esempio n. 2
0
        private void MoveElementTo([NotNull] QualitySpecificationElement element,
                                   int toIndex)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            _elements.Remove(element);
            _elements.Insert(toIndex, element);
        }
Esempio n. 3
0
        public bool RemoveElement([NotNull] QualityCondition qualityCondition)
        {
            Assert.ArgumentNotNull(qualityCondition, nameof(qualityCondition));

            QualitySpecificationElement element = GetElement(qualityCondition);

            return(element != null && _elements.Remove(element));
        }
Esempio n. 4
0
        private int IndexOf([NotNull] QualityCondition condition)
        {
            for (var i = 0; i < _elements.Count; i++)
            {
                QualitySpecificationElement element = _elements[i];
                if (element.QualityCondition.Equals(condition))
                {
                    return(i);
                }
            }

            return(-1);
        }
Esempio n. 5
0
        public QualitySpecificationElement AddElement(
            [NotNull] QualityCondition qualityCondition, bool?stopOnErrorOverride,
            bool?allowErrorsOverride, int insertIndex, bool disabled = false)
        {
            Assert.ArgumentNotNull(qualityCondition, nameof(qualityCondition));

            var element = new QualitySpecificationElement(
                qualityCondition, stopOnErrorOverride, allowErrorsOverride, disabled);

            _elements.Insert(insertIndex, element);

            return(element);
        }
Esempio n. 6
0
        public void MoveElementTo(int fromIndex, int toIndex)
        {
            QualitySpecificationElement element = _elements[fromIndex];

            MoveElementTo(element, toIndex);
        }
Esempio n. 7
0
        public bool RemoveElement([NotNull] QualitySpecificationElement element)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            return(_elements.Remove(element));
        }