Exemplo n.º 1
0
        public void VisualStudio_NoRuleTemplates()
        {
            var analyzers = GetDiagnosticAnalyzerTypes(new[] { RuleFinder.GetPackagedRuleAssembly() });

            foreach (var analyzer in analyzers.Where(RuleFinder.IsRuleTemplate))
            {
                Assert.Fail("Visual Studio rules cannot be templates, remove DiagnosticAnalyzer '{0}'.", analyzer.Name);
            }
        }
Exemplo n.º 2
0
        public void VisualStudio_OnlyParameterlessRules()
        {
            var analyzers = GetDiagnosticAnalyzerTypes(new[] { RuleFinder.GetPackagedRuleAssembly() });

            foreach (var analyzer in analyzers)
            {
                var hasParameter = analyzer.GetProperties().Any(p => p.GetCustomAttributes <RuleParameterAttribute>().Any());
                if (hasParameter)
                {
                    Assert.Fail("Visual Studio rules cannot have parameters, remove DiagnosticAnalyzer '{0}'.", analyzer.Name);
                }
            }
        }
Exemplo n.º 3
0
 public void GetPackagedRuleAssembly()
 {
     Assert.IsNotNull(RuleFinder.GetPackagedRuleAssembly());
 }