示例#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);
            }
        }
示例#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);
                }
            }
        }
示例#3
0
 public void GetPackagedRuleAssembly()
 {
     Assert.IsNotNull(RuleFinder.GetPackagedRuleAssembly());
 }