Ejemplo n.º 1
0
        public void Validate(ResolvedTreeRoot resolvedTreeRoot)
        {
            DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, Lesson3CommonValidator.CreateStep6Properties());

            Lesson3CommonValidator.CheckStep5Controls(resolvedTreeRoot);
            DotHtmlCommonValidator.CheckControlTypeCount <CheckBox>(resolvedTreeRoot, 3);

            var checkboxes = resolvedTreeRoot.GetDescendantControls <CheckBox>().ToList();

            if (!checkboxes.Any(c => c.GetValue(CheckableControlBase.CheckedValueProperty) == "M"))
            {
                throw new CodeValidationException(string.Format(ValidationErrorMessages.PropertyValueError, "CheckedValue", "M"));
            }
            if (!checkboxes.Any(c => c.GetValue(CheckableControlBase.CheckedValueProperty) == "S"))
            {
                throw new CodeValidationException(string.Format(ValidationErrorMessages.PropertyValueError, "CheckedValue", "S"));
            }
            if (!checkboxes.Any(c => c.GetValue(CheckableControlBase.CheckedValueProperty) == "N"))
            {
                throw new CodeValidationException(string.Format(ValidationErrorMessages.PropertyValueError, "CheckedValue", "N"));
            }
        }
 public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly)
 {
     CSharpCommonValidator.ValidateProperties(tree, model, Lesson3CommonValidator.CreateStep6Properties());
 }