예제 #1
0
        public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly)
        {
            var className = "CountryInfo";

            CSharpCommonValidator.ValidateClass(tree, model, className);
            CSharpCommonValidator.ValidateProperties(tree, model, Lesson3CommonValidator.CreateStep8Properties());
        }
        public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model,
                             Assembly assembly)
        {
            var propertiesToValidate = Lesson3CommonValidator.CreateStep4Properties();

            CSharpCommonValidator.ValidateProperties(tree, model, propertiesToValidate);
        }
예제 #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);
        }
예제 #5
0
        public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model,
                             Assembly assembly)
        {
            var properties = Lesson3CommonValidator.CreateOnlyStep9Properties();

            properties.Add(Lesson3CommonValidator.CreateNewCustomerProperty());
            CSharpCommonValidator.ValidateProperties(tree, model, properties);
        }
        public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly)
        {
            CSharpCommonValidator.ValidateProperties(tree, model, Lesson3CommonValidator.CreateStep9Properties());

            ValidatorsExtensions.ExecuteSafe(() =>
            {
                var viewModel = (dynamic)assembly.CreateInstance("DotvvmAcademy.Tutorial.ViewModels.Lesson3ViewModel");

                var usa = viewModel?.Countries[0];
                if (usa == null || usa.Name != "USA" || usa.Id != 1)
                {
                    throw new CodeValidationException(string.Format(Lesson3Texts.CountryInfoError, "USA", 1));
                }
                var canada = viewModel?.Countries[1];
                if (canada == null || canada.Name != "Canada" || canada.Id != 2)
                {
                    throw new CodeValidationException(string.Format(Lesson3Texts.CountryInfoError, "Canada", 2));
                }
            });
        }
예제 #7
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(ResolvedTreeRoot resolvedTreeRoot)
 {
     Lesson3CommonValidator.CheckStep5Controls(resolvedTreeRoot);
     DotHtmlCommonValidator.ValidatePropertiesBindings(resolvedTreeRoot,
                                                       Lesson3CommonValidator.CreateStep4Properties());
 }
예제 #9
0
 public void Validate(ResolvedTreeRoot resolvedTreeRoot)
 {
     Lesson3CommonValidator.CheckStep11Controls(resolvedTreeRoot);
 }