@@ -15,18 +15,35 @@ namespace FluentAssertions.Analyzers.BenchmarkTests
15
15
[ JsonExporter ]
16
16
public class FluentAssertionsBenchmarks
17
17
{
18
- private CompilationWithAnalyzers MinimalCompiliation ;
18
+ private CompilationWithAnalyzers MinimalCompilationWithAnalyzers_ObjectStatement ;
19
+ private CompilationWithAnalyzers SmallCompilationWithAnalyzers_StringAssertions ;
19
20
20
21
[ GlobalSetup ]
21
22
public async Task GlobalSetup ( )
22
23
{
23
- MinimalCompiliation = await CreateCompilationFromAsync ( GenerateCode . ObjectStatement ( "actual.Should().Equals(expected);" ) ) ;
24
+ MinimalCompilationWithAnalyzers_ObjectStatement = await CreateCompilationFromAsync ( GenerateCode . ObjectStatement ( "actual.Should().Equals(expected);" ) ) ;
25
+ SmallCompilationWithAnalyzers_StringAssertions = await CreateCompilationFromAsync (
26
+ GenerateCode . StringAssertion ( "actual.StartsWith(expected).Should().BeTrue();" ) ,
27
+ GenerateCode . StringAssertion ( "actual.EndsWith(expected).Should().BeTrue();" ) ,
28
+ GenerateCode . StringAssertion ( "actual.Should().NotBeNull().And.NotBeEmpty();" ) ,
29
+ GenerateCode . StringAssertion ( "string.IsNullOrEmpty(actual).Should().BeTrue();" ) ,
30
+ GenerateCode . StringAssertion ( "string.IsNullOrEmpty(actual).Should().BeFalse();" ) ,
31
+ GenerateCode . StringAssertion ( "string.IsNullOrWhiteSpace(actual).Should().BeTrue();" ) ,
32
+ GenerateCode . StringAssertion ( "string.IsNullOrWhiteSpace(actual).Should().BeFalse();" ) ,
33
+ GenerateCode . StringAssertion ( "actual.Length.Should().Be(k);" )
34
+ ) ;
24
35
}
25
36
26
37
[ Benchmark ]
27
- public Task MinimalCompilation ( )
38
+ public Task MinimalCompilation_SingleSource_ObjectStatement_Analyzing ( )
28
39
{
29
- return MinimalCompiliation . GetAnalyzerDiagnosticsAsync ( ) ;
40
+ return MinimalCompilationWithAnalyzers_ObjectStatement . GetAnalyzerDiagnosticsAsync ( ) ;
41
+ }
42
+
43
+ [ Benchmark ]
44
+ public Task SmallCompilation_MultipleSources_StringAssertions_Analyzing ( )
45
+ {
46
+ return SmallCompilationWithAnalyzers_StringAssertions . GetAnalyzerDiagnosticsAsync ( ) ;
30
47
}
31
48
32
49
private async Task < CompilationWithAnalyzers > CreateCompilationFromAsync ( params string [ ] sources )
0 commit comments