Exemplo n.º 1
0
 public void MagicNumber()
 {
     var diagnostic = new MagicNumber
     {
         Exceptions = ImmutableHashSet.Create("0", "1", "0x0", "0x00", ".0", ".1", "0.0", "1.0")
     };
     Verifier.Verify(@"TestCases\MagicNumber.cs", diagnostic);
 }
Exemplo n.º 2
0
 private void AddAnalyzerMagicNumber(ImmutableArray<DiagnosticAnalyzer>.Builder builder)
 {
     var analyzer = new MagicNumber();
     if (!AnalyzerIds.Contains(analyzer.SupportedDiagnostics.Single().Id))
     {
         return;
     }
     analyzer.Exceptions =
         Parameters[analyzer.SupportedDiagnostics.Single().Id].Single()["exceptions"]
             .Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)
             .Select(e => e.Trim())
             .ToImmutableHashSet();
     builder.Add(analyzer);
 }