コード例 #1
0
        public void CreateOrUpdate(DomainId <IQuestionnaireRootNode> questionnaireRootNode)
        {
            var isValid = m_questionnaireTypeChecker
                          .Validate(questionnaireRootNode);

            if (isValid)
            {
                m_calculationService.UpdateCalculations();
                m_buildOutputVisitor.Build(questionnaireRootNode);
            }
        }
コード例 #2
0
        private void CreateAndValidateForm(string validText)
        {
            var questionnaireCreator = m_serviceProvider
                                       .GetService <IQuestionnaireAstCreator>();

            m_questionnaireTypeChecker = m_serviceProvider
                                         .GetService <IQuestionnaireTypeChecker>();

            var domainItemId = questionnaireCreator.
                               Create(validText);

            Assert.IsNotNull(domainItemId, @"should have created a for from a valid definition");
            m_questionnaireTypeChecker.Validate(domainItemId);
        }
コード例 #3
0
        public void Execute(CreateDefinitionFromTextCommand command)
        {
            m_astCreator.Create(command.DefinitionText);

            var questionnaireRef = m_domainItemLocator
                                   .GetAllRefs <IQuestionnaireRootNode>()
                                   .FirstOrDefault();

            var isValid = m_questionnaireTypeChecker
                          .Validate(questionnaireRef);

            if (!isValid)
            {
                var errorMessage = string.Join(
                    Environment.NewLine,
                    m_questionnaireTypeChecker
                    .Results
                    .Select(x => x.Message));
                throw new QlValidationException(errorMessage, null);
            }

            m_outputCreator.CreateOrUpdate(questionnaireRef);
        }