Skip to content

Commit 93a38a0

Browse files
committed
Fix tests.
1 parent 9f24c35 commit 93a38a0

3 files changed

Lines changed: 21 additions & 14 deletions

File tree

PropertyChangedAnalyzers.Benchmarks/BenchmarkTests.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace PropertyChangedAnalyzers.Benchmarks
1+
namespace PropertyChangedAnalyzers.Benchmarks
22
{
33
using System;
44
using System.Collections.Generic;
@@ -9,11 +9,13 @@ namespace PropertyChangedAnalyzers.Benchmarks
99

1010
public class BenchmarkTests
1111
{
12-
private static IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers { get; } = typeof(KnownSymbol).Assembly
13-
.GetTypes()
14-
.Where(typeof(DiagnosticAnalyzer).IsAssignableFrom)
15-
.Select(t => (DiagnosticAnalyzer)Activator.CreateInstance(t))
16-
.ToArray();
12+
private static IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers { get; } =
13+
typeof(KnownSymbol)
14+
.Assembly
15+
.GetTypes()
16+
.Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t) && !t.IsAbstract)
17+
.Select(t => (DiagnosticAnalyzer)Activator.CreateInstance(t))
18+
.ToArray();
1719

1820
private static IReadOnlyList<Gu.Roslyn.Asserts.Benchmark> AllBenchmarks { get; } = AllAnalyzers
1921
.Select(x => Gu.Roslyn.Asserts.Benchmark.Create(Code.ValidCodeProject, x))

PropertyChangedAnalyzers.Benchmarks/Benchmarks/Codegen/Code.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
namespace PropertyChangedAnalyzers.Benchmarks.Benchmarks
1+
namespace PropertyChangedAnalyzers.Benchmarks.Benchmarks
22
{
33
using System;
44
using System.Collections.Generic;
55
using System.Collections.Immutable;
66
using System.IO;
77
using System.Linq;
88
using System.Net;
9+
910
using Gu.Roslyn.Asserts;
11+
1012
using Microsoft.CodeAnalysis;
1113
using Microsoft.CodeAnalysis.CSharp;
1214
using Microsoft.CodeAnalysis.Diagnostics;
@@ -24,11 +26,13 @@ public static class Code
2426
MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location),
2527
};
2628

27-
private static readonly IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers = typeof(KnownSymbol).Assembly
28-
.GetTypes()
29-
.Where(typeof(DiagnosticAnalyzer).IsAssignableFrom)
30-
.Select(t => (DiagnosticAnalyzer)Activator.CreateInstance(t))
31-
.ToArray();
29+
private static readonly IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers =
30+
typeof(KnownSymbol)
31+
.Assembly
32+
.GetTypes()
33+
.Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t) && !t.IsAbstract)
34+
.Select(t => (DiagnosticAnalyzer)Activator.CreateInstance(t))
35+
.ToArray();
3236

3337
public static string ProjectDirectory { get; } = ProjectFile.Find("PropertyChangedAnalyzers.Benchmarks.csproj").DirectoryName;
3438

PropertyChangedAnalyzers.Test/ValidWithAllAnalyzers.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
public static class ValidWithAllAnalyzers
1313
{
14-
private static readonly IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers = typeof(Descriptors)
14+
private static readonly IReadOnlyList<DiagnosticAnalyzer> AllAnalyzers =
15+
typeof(Descriptors)
1516
.Assembly
1617
.GetTypes()
17-
.Where(typeof(DiagnosticAnalyzer).IsAssignableFrom)
18+
.Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t) && !t.IsAbstract)
1819
.Select(t => (DiagnosticAnalyzer)Activator.CreateInstance(t))
1920
.ToArray();
2021

0 commit comments

Comments
 (0)