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 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); } }
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 ValidateOnlyStep3Properties(ResolvedTreeRoot resolvedTreeRoot) { DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 3); DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, CreateStep2ControlProperties()); }
public static void ValidateStep8(ResolvedTreeRoot resolvedTreeRoot) { ValidateStep5(resolvedTreeRoot); DotHtmlCommonValidator.CheckControlTypeCount <ValidationSummary>(resolvedTreeRoot, 1); }
public static void CheckStep11Controls(ResolvedTreeRoot resolvedTreeRoot) { CheckStep5Controls(resolvedTreeRoot); DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot, CreateStep11Properties()); DotHtmlCommonValidator.CheckControlTypeCount <ComboBox>(resolvedTreeRoot, 1); }
public static void CheckStep5Controls(ResolvedTreeRoot resolvedTreeRoot) { CheckStep3Controls(resolvedTreeRoot); DotHtmlCommonValidator.CheckControlTypeCount <RadioButton>(resolvedTreeRoot, 2); }
public static void CheckStep3Controls(ResolvedTreeRoot resolvedTreeRoot) { DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 2); }
public static void ValidateBasicControls(ResolvedTreeRoot resolvedTreeRoot) { DotHtmlCommonValidator.CheckControlTypeCount <TextBox>(resolvedTreeRoot, 3); DotHtmlCommonValidator.CheckControlTypeCount <Button>(resolvedTreeRoot, 1); }