public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly) { Lesson4CommonValidator.ValidateStep12(tree, model, assembly); ValidatorsExtensions.ExecuteSafe(() => { var viewModel = (dynamic)assembly.CreateInstance("DotvvmAcademy.Tutorial.ViewModels.Lesson4ViewModel"); var now = DateTime.UtcNow; viewModel.SubscriptionFrom = now.AddDays(3); viewModel.SubscriptionTo = now; IEnumerable <ValidationResult> validationResults = viewModel.Validate(null); if (!validationResults.Any()) { throw new CodeValidationException(Lesson4Texts.IncorrectValidationRule); } viewModel.SubscriptionFrom = now; viewModel.SubscriptionTo = now.AddDays(5); validationResults = viewModel.Validate(null); if (validationResults.Any()) { throw new CodeValidationException(Lesson4Texts.IncorrectValidationRule); } }); }
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 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); }
public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly) { Lesson4CommonValidator.ValidateStep12(tree, model, assembly); }
public void Validate(ResolvedTreeRoot resolvedTreeRoot) { Lesson4CommonValidator.ValidateStep5(resolvedTreeRoot); }
public void Validate(ResolvedTreeRoot resolvedTreeRoot) { DotHtmlCommonValidator.CheckCountOfHtmlTag(resolvedTreeRoot, "div", 3); Lesson4CommonValidator.ValidateStep2ValidationProperties(resolvedTreeRoot); Lesson4CommonValidator.ValidateOnlyStep3Properties(resolvedTreeRoot); }