Exemple #1
0
        public IEnumerable <ValidationMetaData> Validate(
            DomainId <IQuestionnaireRootNode> rootNode)
        {
            var untypedOperators = GetUntypedOperators();

            foreach (var untypedOperator in untypedOperators)
            {
                var leftName = m_domainItemLocator
                               .Get <IUntypedVariableNode>(untypedOperator.LeftExpression.Id)
                               .VariableName;

                var rightName = m_domainItemLocator
                                .Get <IUntypedVariableNode>(untypedOperator.RightExpression.Id)
                                .VariableName;

                if (m_variableService.AreCompatible(leftName, rightName))
                {
                    var type = m_variableService.GetQuestionType(leftName);
                    if (!type.IsValidOperation(untypedOperator))
                    {
                        yield return(IncompatableOperationError(untypedOperator, leftName, rightName));
                    }

                    continue;
                }

                yield return(IncompatibleTypeError(leftName, rightName, untypedOperator));
            }
        }