Exemple #1
0
        protected override IList <ITest> GetTests(QualitySpecification specification,
                                                  out QualityVerification qualityVerification)
        {
            IList <ITest>       result       = null;
            QualityVerification verification = null;

            // TODO: Copy from QualityVerificationService
            // Consider moving to base or provide the (properly initialized) tests together with the
            // verification in VerifyQuality() or move the condition/test dictionaries and collections
            // to a separate factory/provider class that can be called previously inside the appropriate
            // transaction
            _domainTransactions.UseTransaction(
                delegate
            {
                ICollection <Dataset> datasets =
                    QualitySpecificationUtils.GetQualityConditionDatasets(specification);

                _domainTransactions.Reattach(datasets);

                _backgroundVerificationInputs.InitializeSchema(datasets);

                result = GetTestsCore(specification, out verification);
            });

            qualityVerification = verification;
            return(result);
        }
Exemple #2
0
        private static void Initialize(
            [NotNull] QualityVerification verification,
            [NotNull] IDomainTransactionManager domainTransactionManager)
        {
            Assert.ArgumentNotNull(verification, nameof(verification));
            Assert.ArgumentNotNull(domainTransactionManager, nameof(domainTransactionManager));

            if (verification.IsPersistent)
            {
                domainTransactionManager.Reattach(verification);
                domainTransactionManager.Initialize(verification.VerificationDatasets);
            }

            foreach (
                QualityConditionVerification conditionVerification in
                verification.ConditionVerifications)
            {
                QualityCondition qualityCondition =
                    conditionVerification.DisplayableCondition;

                if (qualityCondition.IsPersistent)
                {
                    domainTransactionManager.Reattach(qualityCondition);
                }

                foreach (TestParameterValue value in qualityCondition.ParameterValues)
                {
                    if (value.IsPersistent)
                    {
                        domainTransactionManager.Reattach(value);
                    }
                }
            }

            // NOTE this causes NonUniqueObjectExceptions in case of datasets from other models (only?)
            // But: it does not seem to be really needed
            //foreach (
            //    QualityVerificationDataset verificationDataset in
            //        verification.VerificationDatasets)
            //{
            //    domainTransactionManager.Reattach(verificationDataset.Dataset);
            //}
        }
        private void SetQualityConditionVerification(
            [NotNull] QualityConditionVerification conditionVerification)
        {
            Assert.ArgumentNotNull(conditionVerification, nameof(conditionVerification));

            _domainTransactionManager.UseTransaction(
                delegate
            {
                QualityCondition condition = conditionVerification.DisplayableCondition;

                if (condition.IsPersistent)
                {
                    _domainTransactionManager.Reattach(condition);
                }

                _qualityConditionVerificationControl.SetCondition(conditionVerification);
            });
        }