public static void ValidateRepeaterControl(ResolvedTreeRoot resolvedTreeRoot)
        {
            ValidateAddTaskControlBindings(resolvedTreeRoot);

            DotHtmlCommonValidator.CheckControlTypeCount <Repeater>(resolvedTreeRoot, 1);

            var repeater = resolvedTreeRoot.GetDescendantControls <Repeater>().Single();

            DotHtmlCommonValidator.ValidatePropertyBinding(resolvedTreeRoot, CreateStep6Property());

            DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "div", 1);

            IAbstractPropertySetter setter;

            if (!repeater.TryGetProperty(Repeater.ItemTemplateProperty, out setter) ||
                !(setter is ResolvedPropertyTemplate))
            {
                throw new CodeValidationException(Lesson2Texts.RepeaterTemplateMissingDivError);
            }
            var template = (ResolvedPropertyTemplate)setter;

            var div = template.GetDescendantControls <HtmlGenericControl>().ToList();

            if (div.Count(d => d.DothtmlNode.As <DothtmlElementNode>()?.TagName == "div") != 1)
            {
                throw new CodeValidationException(Lesson2Texts.RepeaterTemplateMissingDivError);
            }
        }
        public static void ValidateRepeaterTemplate1(ResolvedTreeRoot root)
        {
            ValidateRepeaterControl(root);

            DotHtmlCommonValidator.ValidatePropertyBinding(root, CreateStep5TitleProperty());
            DotHtmlCommonValidator.CheckControlTypeCountInRepeater <LinkButton>(root, 1);
        }
Пример #3
0
        public void Validate(ResolvedTreeRoot resolvedTreeRoot)
        {
            Lesson3CommonValidator.CheckStep11Controls(resolvedTreeRoot);
            DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "div", 1);

            DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, Lesson3CommonValidator.CreateStep14Properties());
        }
Пример #4
0
        public void Validate(ResolvedTreeRoot resolvedTreeRoot)
        {
            var step9Properties  = Lesson3CommonValidator.CreateStep9Properties();
            var contriesProperty = step9Properties.Single(p => p.TargetControlBindName == ControlBindName.ComboBoxDataSource);

            contriesProperty.Name = $"_parent.{contriesProperty.Name}";
            DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, step9Properties);
        }
        public static void ValidateRepeaterTemplate3(ResolvedTreeRoot root)
        {
            ValidateRepeaterTemplate2(root);

            var linkButton = DotHtmlCommonValidator.GetControlInRepeater <LinkButton>(root);

            linkButton.ValidateCommandBindingExpression(ButtonBase.ClickProperty, "_parent.CompleteTask(_this)");
        }
        public static void ValidateAddTaskControlBindings(ResolvedTreeRoot root)
        {
            ValidateAddTaskControls(root);

            DotHtmlCommonValidator.ValidatePropertyBinding(root, CreateStep3Property());

            root.GetDescendantControls <Button>().Single()
            .ValidateCommandBindingExpression(ButtonBase.ClickProperty, "AddTask()");
        }
        public static void ValidateRepeaterTemplate2(ResolvedTreeRoot root)
        {
            ValidateRepeaterTemplate1(root);
            var linkButton = DotHtmlCommonValidator.GetControlInRepeater <LinkButton>(root);

            if (linkButton.GetValueBindingText(HtmlGenericControl.VisibleProperty) != "!IsCompleted")
            {
                throw new CodeValidationException(Lesson2Texts.InvalidVisibleBinding);
            }
        }
Пример #8
0
        public void Validate(ResolvedTreeRoot resolvedTreeRoot)
        {
            Lesson4CommonValidator.ValidateStep5(resolvedTreeRoot);
            DotHtmlCommonValidator.CheckControlTypeCount <Validator>(resolvedTreeRoot, 1);

            DotHtmlCommonValidator.ValidatePropertyBinding(resolvedTreeRoot,
                                                           Lesson4CommonValidator.CreateStep7ValidatorEmail());
            var property = new Property("True", "fakeProp", ControlBindName.ValidatorShowErrorMessageText);

            DotHtmlCommonValidator.ValidatePropertyBinding(resolvedTreeRoot, property);
        }
        public static void ValidateAddTaskControls(ResolvedTreeRoot resolvedTreeRoot)
        {
            DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 1);
            DotHtmlCommonValidator.CheckControlTypeCount <Button>(resolvedTreeRoot, 1);

            var buttonText = resolvedTreeRoot.GetDescendantControls <Button>()
                             .Select(c => c.GetValue(ButtonBase.TextProperty))
                             .SingleOrDefault();

            if (buttonText == null)
            {
                throw new CodeValidationException(Lesson2Texts.ButtonDoesNotHaveText);
            }
        }
Пример #10
0
        public void Validate(ResolvedTreeRoot resolvedTreeRoot)
        {
            DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "div", 3);
            Lesson4CommonValidator.ValidateStep2ValidationProperties(resolvedTreeRoot);
            Lesson4CommonValidator.ValidateOnlyStep3Properties(resolvedTreeRoot);

            var property = new Property("has-error", "none", ControlBindName.DivValidatorInvalidCssClass);

            DotHtmlCommonValidator.ValidatePropertyBinding(resolvedTreeRoot, property);

            var invalidCssException = new CodeValidationException(Lesson4Texts.AllDivsMustHaveInvalidCssClass);

            DotHtmlCommonValidator.CheckCountOfHtmlTagWithPropertyDescriptor(resolvedTreeRoot, "div", 3, Validator.InvalidCssClassProperty, invalidCssException);
        }
Пример #11
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 static void ValidateStep5(ResolvedTreeRoot resolvedTreeRoot)
        {
            var divEnwrapException = new CodeValidationException(Lesson4Texts.WrapDivsInForm);

            DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "form", 1, divEnwrapException);

            var property = new Property("has-error", "fakeProp", ControlBindName.FormValidatorInvalidCssClass);

            DotHtmlCommonValidator.ValidatePropertyBinding(resolvedTreeRoot, property);

            var contentNode = resolvedTreeRoot.GetDescendantControls <HtmlGenericControl>().
                              FirstOrDefault(d => d.DothtmlNode.As <DothtmlElementNode>()?.TagName == "form");

            DotHtmlCommonValidator.CheckCountOfHtmlTag(contentNode, "div", 3);

            var redundantInvalidCssException = new CodeValidationException(Lesson4Texts.ChildDivsDontNeedInvalidCssClassAnymore);

            ValidateStep2ValidationProperties(contentNode);
            DotHtmlCommonValidator.CheckCountOfHtmlTagWithPropertyDescriptor(contentNode, "div", 0, Validator.InvalidCssClassProperty, redundantInvalidCssException);

            property.TargetControlBindName = ControlBindName.DivValidatorInvalidCssClassRemove;
            DotHtmlCommonValidator.ValidatePropertyBinding(contentNode, property);
        }
 public static void ValidateStep2ValidationProperties(ResolvedContentNode resolvedContentNode)
 {
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedContentNode, CreateStep2ValidationValueProperties());
 }
Пример #14
0
 public static void CheckStep11Controls(ResolvedTreeRoot resolvedTreeRoot)
 {
     CheckStep5Controls(resolvedTreeRoot);
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, CreateStep11Properties());
     DotHtmlCommonValidator.CheckControlTypeCount <ComboBox>(resolvedTreeRoot, 1);
 }
Пример #15
0
 public static void CheckStep5Controls(ResolvedTreeRoot resolvedTreeRoot)
 {
     CheckStep3Controls(resolvedTreeRoot);
     DotHtmlCommonValidator.CheckControlTypeCount <RadioButton>(resolvedTreeRoot, 2);
 }
Пример #16
0
 public static void CheckStep3Controls(ResolvedTreeRoot resolvedTreeRoot)
 {
     DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 2);
 }
Пример #17
0
 public static void ValidateBasicControls(ResolvedTreeRoot resolvedTreeRoot)
 {
     DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 3);
     DotHtmlCommonValidator.CheckControlTypeCount <Button>(resolvedTreeRoot, 1);
 }
 public void Validate(ResolvedTreeRoot resolvedTreeRoot)
 {
     Lesson3CommonValidator.CheckStep5Controls(resolvedTreeRoot);
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot,
                                                       Lesson3CommonValidator.CreateStep4Properties());
 }
Пример #19
0
 public static void ValidateTextBoxBindings(ResolvedTreeRoot resolvedTreeRoot)
 {
     ValidateBasicControls(resolvedTreeRoot);
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, CreateStep4Properties());
 }
 public static void ValidateStep8(ResolvedTreeRoot resolvedTreeRoot)
 {
     ValidateStep5(resolvedTreeRoot);
     DotHtmlCommonValidator.CheckControlTypeCount <ValidationSummary>(resolvedTreeRoot, 1);
 }
 public static void ValidateOnlyStep3Properties(ResolvedTreeRoot resolvedTreeRoot)
 {
     DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 3);
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, CreateStep2ControlProperties());
 }
 public void Validate(ResolvedTreeRoot resolvedTreeRoot)
 {
     DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "div", 3);
     Lesson4CommonValidator.ValidateStep2ValidationProperties(resolvedTreeRoot);
     Lesson4CommonValidator.ValidateOnlyStep3Properties(resolvedTreeRoot);
 }