Ejemplo n.º 1
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 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));
                }
            });
        }
 public void Validate(CSharpCompilation compilation, CSharpSyntaxTree tree, SemanticModel model, Assembly assembly)
 {
     CSharpCommonValidator.ValidateProperties(tree, model, Lesson3CommonValidator.CreateStep9Properties());
 }