diff --git a/src/AppAny.HotChocolate.FluentValidation.csproj b/src/AppAny.HotChocolate.FluentValidation.csproj index 9a67e7d..ca111c9 100644 --- a/src/AppAny.HotChocolate.FluentValidation.csproj +++ b/src/AppAny.HotChocolate.FluentValidation.csproj @@ -24,7 +24,7 @@ - + diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/AppAny.HotChocolate.FluentValidation.Benchmarks.csproj b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/AppAny.HotChocolate.FluentValidation.Benchmarks.csproj index 75a9bcf..123482e 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/AppAny.HotChocolate.FluentValidation.Benchmarks.csproj +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/AppAny.HotChocolate.FluentValidation.Benchmarks.csproj @@ -10,7 +10,6 @@ - diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Core/TestInputValidator.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Core/TestInputValidator.cs index 34a5aab..7177e9d 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Core/TestInputValidator.cs +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Core/TestInputValidator.cs @@ -1,8 +1,9 @@ +using FairyBread; using FluentValidation; namespace AppAny.HotChocolate.FluentValidation.Benchmarks { - public class TestInputValidator : AbstractValidator + public class TestInputValidator : AbstractValidator, IRequiresOwnScopeValidator { public TestInputValidator() { diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/EmptyInputsExplicitValidationBenchmarks.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/EmptyInputsExplicitValidationBenchmarks.cs deleted file mode 100644 index 0296c13..0000000 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/EmptyInputsExplicitValidationBenchmarks.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Threading.Tasks; -using BenchmarkDotNet.Attributes; -using FairyBread; -using FluentChoco; -using FluentValidation; -using HotChocolate.Execution; -using Microsoft.Extensions.DependencyInjection; - -namespace AppAny.HotChocolate.FluentValidation.Benchmarks -{ - [MemoryDiagnoser] - public class EmptyInputsExplicitValidationBenchmarks - { - private IRequestExecutor withoutValidation = default!; - private IRequestExecutor withExplicitValidation = default!; - private IRequestExecutor fluentChocoValidation = default!; - private IRequestExecutor fairyBreadValidation = default!; - - [GlobalSetup] - public async Task GlobalSetup() - { - withoutValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddMutationType(new TestMutationType(field => - field.Argument("input", arg => arg.Type())))); - - withExplicitValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddFluentValidation() - .AddMutationType(new TestMutationType(field => field - .Argument("input", - arg => arg.Type().UseFluentValidation(opt => opt.UseValidator>())))) - .Services.AddSingleton, TestInputValidator>()); - - fluentChocoValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.UseFluentValidation() - .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type()))) - .Services.AddSingleton, TestInputValidator>()); - - fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddFairyBread(opt => opt.AssembliesToScanForValidators = new[] { typeof(Program).Assembly }) - .AddMutationType(new TestMutationType(field => - field.Argument("input", arg => arg.Type().UseValidation()))) - .Services.AddSingleton()); - } - - [Benchmark] - public Task RunWithoutValidation() - { - return withoutValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyInput); - } - - [Benchmark(Baseline = true)] - public Task RunWithValidation() - { - return withExplicitValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyInput); - } - - // [Benchmark(Description = "Broken since 11.0.8")] - public Task RunWithFluentChocoValidation() - { - return fluentChocoValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyInput); - } - - [Benchmark] - public Task RunWithFairyBreadValidation() - { - return fairyBreadValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyInput); - } - } -} diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/NullInputsExplicitValidationBenchmarks.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/NullInputsExplicitValidationBenchmarks.cs deleted file mode 100644 index 4f056ae..0000000 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/NullInputsExplicitValidationBenchmarks.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Threading.Tasks; -using BenchmarkDotNet.Attributes; -using FairyBread; -using FluentChoco; -using FluentValidation; -using HotChocolate.Execution; -using Microsoft.Extensions.DependencyInjection; - -namespace AppAny.HotChocolate.FluentValidation.Benchmarks -{ - [MemoryDiagnoser] - public class NullInputsExplicitValidationBenchmarks - { - private IRequestExecutor withoutValidation = default!; - private IRequestExecutor withExplicitValidation = default!; - private IRequestExecutor fluentChocoValidation = default!; - private IRequestExecutor fairyBreadValidation = default!; - - [GlobalSetup] - public async Task GlobalSetup() - { - withoutValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddMutationType(new TestMutationType(field => - field.Argument("input", arg => arg.Type())))); - - withExplicitValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddFluentValidation() - .AddMutationType(new TestMutationType(field => field - .Argument("input", - arg => arg.Type().UseFluentValidation(opt => opt.UseValidator>())))) - .Services.AddSingleton, TestInputValidator>()); - - fluentChocoValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.UseFluentValidation() - .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type()))) - .Services.AddSingleton, TestInputValidator>()); - - fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor( - builder => builder.AddFairyBread(opt => opt.AssembliesToScanForValidators = new[] { typeof(Program).Assembly }) - .AddMutationType(new TestMutationType(field => - field.Argument("input", arg => arg.Type().UseValidation()))) - .Services.AddSingleton()); - } - - [Benchmark] - public Task RunWithoutValidation() - { - return withoutValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithNullInput); - } - - [Benchmark(Baseline = true)] - public Task RunWithValidation() - { - return withExplicitValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithNullInput); - } - - // [Benchmark(Description = "Broken since 11.0.8")] - public Task RunWithFluentChocoValidation() - { - return fluentChocoValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithNullInput); - } - - [Benchmark] - public Task RunWithFairyBreadValidation() - { - return fairyBreadValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithNullInput); - } - } -} diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Program.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Program.cs index 1bdd4b2..7891f3d 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Program.cs +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/Program.cs @@ -4,13 +4,9 @@ namespace AppAny.HotChocolate.FluentValidation.Benchmarks { internal class Program { - private static void Main(string[] args) + private static void Main() { - BenchmarkSwitcher - .FromAssembly(typeof(Program).Assembly) - .Run(args - //, DefaultConfig.Instance.AddDiagnoser(new EtwProfiler()) - ); + BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).RunAllJoined(); } } } diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/README.md b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/README.md index b489221..19926fb 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/README.md +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/README.md @@ -15,74 +15,26 @@ Intel Core i7-9700K CPU 3.60GHz (Coffee Lake), 1 CPU, 8 logical and 8 physical c DefaultJob : .NET Core 5.0.2 (CoreCLR 5.0.220.61120, CoreFX 5.0.220.61120), X64 RyuJIT ``` -## ValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |----------:|----------:|----------:|------:|--------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 8.193 μs | 0.0568 μs | 0.0531 μs | 0.30 | 0.01 | 1.2512 | 0.0153 | - | 7.66 KB | -| RunWithValidation | 27.554 μs | 0.5321 μs | 0.5464 μs | 1.00 | 0.00 | 1.7395 | 0.0305 | - | 10.72 KB | -| RunWithFairyBreadValidation | 24.991 μs | 0.2246 μs | 0.2101 μs | 0.91 | 0.02 | 1.8311 | 0.0305 | - | 11.23 KB | - -## ExplicitValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |----------:|----------:|----------:|------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 7.879 μs | 0.0936 μs | 0.0876 μs | 0.33 | 1.2512 | 0.0153 | - | 7.66 KB | -| RunWithValidation | 24.049 μs | 0.1411 μs | 0.1320 μs | 1.00 | 1.7090 | 0.0305 | - | 10.53 KB | -| RunWithFairyBreadValidation | 24.614 μs | 0.3174 μs | 0.2813 μs | 1.02 | 1.8311 | 0.0305 | - | 11.23 KB | - -## InputValidatorBenchmarks - -| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------------------------- |---------:|--------:|--------:|------:|-------:|-------:|------:|----------:| -| Validation | 876.5 ns | 3.24 ns | 2.88 ns | 1.00 | 0.3157 | 0.0010 | - | 1.94 KB | -| InputValidatorValidation | 968.3 ns | 1.22 ns | 1.08 ns | 1.10 | 0.3529 | - | - | 2.17 KB | - -## EmptyInputsValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |---------:|----------:|----------:|------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 7.592 μs | 0.0515 μs | 0.0481 μs | 0.97 | 1.2512 | 0.0229 | - | 7.64 KB | -| RunWithValidation | 7.853 μs | 0.0529 μs | 0.0469 μs | 1.00 | 1.2512 | 0.0153 | - | 7.64 KB | -| RunWithFairyBreadValidation | 8.551 μs | 0.1089 μs | 0.1019 μs | 1.09 | 1.2665 | 0.0153 | - | 7.8 KB | - -## EmptyInputsExplicitValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |---------:|----------:|----------:|------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 7.865 μs | 0.0535 μs | 0.0475 μs | 1.00 | 1.2512 | 0.0153 | - | 7.64 KB | -| RunWithValidation | 7.863 μs | 0.0420 μs | 0.0393 μs | 1.00 | 1.2512 | 0.0153 | - | 7.64 KB | -| RunWithFairyBreadValidation | 8.831 μs | 0.0397 μs | 0.0371 μs | 1.12 | 1.2665 | 0.0153 | - | 7.8 KB | - -## NullInputsValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |---------:|----------:|----------:|------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 7.735 μs | 0.0474 μs | 0.0420 μs | 0.94 | 1.2512 | 0.0153 | - | 7.65 KB | -| RunWithValidation | 8.208 μs | 0.0355 μs | 0.0314 μs | 1.00 | 1.2512 | 0.0153 | - | 7.65 KB | -| RunWithFairyBreadValidation | 8.867 μs | 0.0889 μs | 0.0831 μs | 1.08 | 1.2665 | 0.0153 | - | 7.8 KB | - -## NullInputsExplicitValidationBenchmarks - -| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | -|---------------------------- |---------:|----------:|----------:|------:|--------:|-------:|-------:|------:|----------:| -| RunWithoutValidation | 7.857 μs | 0.0565 μs | 0.0529 μs | 0.93 | 0.01 | 1.2512 | 0.0153 | - | 7.65 KB | -| RunWithValidation | 8.459 μs | 0.0569 μs | 0.0532 μs | 1.00 | 0.00 | 1.2512 | 0.0153 | - | 7.65 KB | -| RunWithFairyBreadValidation | 8.640 μs | 0.1048 μs | 0.0980 μs | 1.02 | 0.02 | 1.2665 | 0.0153 | - | 7.8 KB | - -## ErrorMappersBenchmarks - -| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | -|--------------------------------------------- |---------:|---------:|---------:|------:|--------:|-------:|-------:|------:|----------:| -| RunWithDefaultErrorMapper | 27.26 μs | 0.473 μs | 0.525 μs | 1.00 | 0.00 | 1.7395 | 0.0305 | - | 10.72 KB | -| RunWithDefaultErrorMapperWithDetails | 29.18 μs | 0.263 μs | 0.246 μs | 1.07 | 0.02 | 1.8311 | 0.0305 | - | 11.17 KB | -| RunWithDefaultErrorMapperWithExtendedDetails | 29.56 μs | 0.278 μs | 0.260 μs | 1.08 | 0.03 | 1.9226 | 0.0305 | - | 11.69 KB | - -## MultipleArgumentsBenchmarks - -| Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | -|------------------------- |----------:|----------:|----------:|-------:|-------:|------:|----------:| -| RunWithoutSingleArgument | 7.690 μs | 0.0269 μs | 0.0225 μs | 1.2512 | 0.0153 | - | 7.66 KB | -| RunWithSingleArgument | 26.370 μs | 0.2195 μs | 0.1946 μs | 1.7395 | 0.0305 | - | 10.73 KB | -| RunWithoutFiveArguments | 7.859 μs | 0.0487 μs | 0.0456 μs | 1.3275 | 0.0153 | - | 8.15 KB | -| RunWithFiveArguments | 27.706 μs | 0.1452 μs | 0.1133 μs | 1.8311 | 0.0305 | - | 11.22 KB | +| Type | Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | +|-------------------------------- |--------------------------------------------- |------------:|----------:|----------:|------:|--------:|-------:|-------:|------:|----------:| +| SingletonValidationBenchmarks | RunWithoutValidation | 8,479.6 ns | 61.50 ns | 54.52 ns | 0.30 | 0.01 | 1.2512 | 0.0153 | - | 7.66 KB | +| SingletonValidationBenchmarks | RunWithValidation | 25,260.1 ns | 341.10 ns | 319.07 ns | 0.88 | 0.02 | 1.7090 | 0.0305 | - | 10.53 KB | +| SingletonValidationBenchmarks | RunWithFairyBreadValidation | 27,657.7 ns | 450.65 ns | 421.54 ns | 0.97 | 0.03 | 1.8616 | 0.0305 | - | 11.5 KB | +| ScopedValidationBenchmarks | RunWithoutValidation | 8,317.4 ns | 52.49 ns | 46.53 ns | 0.29 | 0.00 | 1.2512 | 0.0153 | - | 7.66 KB | +| ScopedValidationBenchmarks | RunWithValidation | 38,690.3 ns | 666.77 ns | 623.69 ns | 1.35 | 0.03 | 2.0752 | - | - | 12.76 KB | +| ScopedValidationBenchmarks | RunWithFairyBreadValidation | 43,161.2 ns | 285.90 ns | 267.44 ns | 1.51 | 0.03 | 2.6245 | 0.0610 | - | 16.23 KB | +| EmptyInputsValidationBenchmarks | RunWithoutValidation | 7,970.4 ns | 48.10 ns | 44.99 ns | 0.28 | 0.01 | 1.2512 | 0.0153 | - | 7.64 KB | +| EmptyInputsValidationBenchmarks | RunWithValidation | 8,395.0 ns | 63.72 ns | 53.21 ns | 0.29 | 0.01 | 1.2512 | 0.0153 | - | 7.64 KB | +| EmptyInputsValidationBenchmarks | RunWithFairyBreadValidation | 9,480.9 ns | 89.16 ns | 79.03 ns | 0.33 | 0.01 | 1.2970 | 0.0153 | - | 7.93 KB | +| NullInputsValidationBenchmarks | RunWithoutValidation | 8,288.5 ns | 99.49 ns | 93.06 ns | 0.29 | 0.00 | 1.2512 | 0.0153 | - | 7.65 KB | +| NullInputsValidationBenchmarks | RunWithValidation | 8,841.5 ns | 57.33 ns | 53.63 ns | 0.31 | 0.01 | 1.2512 | 0.0153 | - | 7.65 KB | +| NullInputsValidationBenchmarks | RunWithFairyBreadValidation | 9,611.5 ns | 56.74 ns | 44.30 ns | 0.34 | 0.00 | 1.2970 | 0.0153 | - | 7.94 KB | +| InputValidatorBenchmarks | Validation | 894.1 ns | 5.06 ns | 4.74 ns | 0.03 | 0.00 | 0.3157 | 0.0010 | - | 1.94 KB | +| InputValidatorBenchmarks | InputValidatorValidation | 1,025.9 ns | 11.01 ns | 10.30 ns | 0.04 | 0.00 | 0.3529 | - | - | 2.17 KB | +| ErrorMappersBenchmarks | RunWithDefaultErrorMapper | 28,636.1 ns | 542.63 ns | 507.58 ns | 1.00 | 0.00 | 1.7395 | 0.0305 | - | 10.72 KB | +| ErrorMappersBenchmarks | RunWithDefaultErrorMapperWithDetails | 29,424.7 ns | 393.17 ns | 367.78 ns | 1.03 | 0.02 | 1.8311 | 0.0305 | - | 11.16 KB | +| ErrorMappersBenchmarks | RunWithDefaultErrorMapperWithExtendedDetails | 31,723.2 ns | 386.73 ns | 361.75 ns | 1.11 | 0.02 | 1.8921 | - | - | 11.69 KB | +| MultipleArgumentsBenchmarks | RunWithoutSingleArgument | 8,399.1 ns | 59.77 ns | 52.99 ns | 0.29 | 0.01 | 1.2512 | 0.0153 | - | 7.66 KB | +| MultipleArgumentsBenchmarks | RunWithSingleArgument | 28,573.9 ns | 253.39 ns | 211.59 ns | 1.00 | 0.02 | 1.7395 | 0.0305 | - | 10.73 KB | +| MultipleArgumentsBenchmarks | RunWithoutFiveArguments | 8,305.3 ns | 76.11 ns | 71.20 ns | 0.29 | 0.01 | 1.3275 | 0.0153 | - | 8.15 KB | +| MultipleArgumentsBenchmarks | RunWithFiveArguments | 29,423.5 ns | 251.90 ns | 210.35 ns | 1.03 | 0.02 | 1.8311 | 0.0305 | - | 11.22 KB | diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ExplicitValidationBenchmarks.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ScopedValidationBenchmarks.cs similarity index 68% rename from tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ExplicitValidationBenchmarks.cs rename to tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ScopedValidationBenchmarks.cs index c57e2a1..3e8daf4 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ExplicitValidationBenchmarks.cs +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ScopedValidationBenchmarks.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -using FairyBread; using FluentChoco; using FluentValidation; using HotChocolate.Execution; @@ -9,10 +8,10 @@ namespace AppAny.HotChocolate.FluentValidation.Benchmarks { [MemoryDiagnoser] - public class ExplicitValidationBenchmarks + public class ScopedValidationBenchmarks { private IRequestExecutor withoutValidation = default!; - private IRequestExecutor withExplicitValidation = default!; + private IRequestExecutor withValidation = default!; private IRequestExecutor fluentChocoValidation = default!; private IRequestExecutor fairyBreadValidation = default!; @@ -23,23 +22,21 @@ public async Task GlobalSetup() builder => builder.AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type())))); - withExplicitValidation = await BenchmarkSetup.CreateRequestExecutor( + withValidation = await BenchmarkSetup.CreateRequestExecutor( builder => builder.AddFluentValidation() - .AddMutationType(new TestMutationType(field => field - .Argument("input", - arg => arg.Type().UseFluentValidation(opt => opt.UseValidator>())))) - .Services.AddSingleton, TestInputValidator>()); + .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg + .Type().UseFluentValidation(opt => opt.UseValidator())))) + .Services.AddScoped()); fluentChocoValidation = await BenchmarkSetup.CreateRequestExecutor( builder => builder.UseFluentValidation() .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type()))) - .Services.AddSingleton, TestInputValidator>()); + .Services.AddScoped, TestInputValidator>()); fairyBreadValidation = await BenchmarkSetup.CreateRequestExecutor( builder => builder.AddFairyBread(opt => opt.AssembliesToScanForValidators = new[] { typeof(Program).Assembly }) - .AddMutationType(new TestMutationType(field => - field.Argument("input", arg => arg.Type().UseValidation()))) - .Services.AddSingleton()); + .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type()))) + .Services.AddScoped()); } [Benchmark] @@ -51,7 +48,7 @@ public Task RunWithoutValidation() [Benchmark(Baseline = true)] public Task RunWithValidation() { - return withExplicitValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyName); + return withValidation.ExecuteAsync(BenchmarkSetup.Mutations.WithEmptyName); } // [Benchmark(Description = "Broken since 11.0.8")] diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ValidationBenchmarks.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/SingletonValidationBenchmarks.cs similarity index 88% rename from tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ValidationBenchmarks.cs rename to tests/AppAny.HotChocolate.FluentValidation.Benchmarks/SingletonValidationBenchmarks.cs index 10c0052..8d7c746 100644 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/ValidationBenchmarks.cs +++ b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/SingletonValidationBenchmarks.cs @@ -8,7 +8,7 @@ namespace AppAny.HotChocolate.FluentValidation.Benchmarks { [MemoryDiagnoser] - public class ValidationBenchmarks + public class SingletonValidationBenchmarks { private IRequestExecutor withoutValidation = default!; private IRequestExecutor withValidation = default!; @@ -24,9 +24,9 @@ public async Task GlobalSetup() withValidation = await BenchmarkSetup.CreateRequestExecutor( builder => builder.AddFluentValidation() - .AddMutationType(new TestMutationType(field => field - .Argument("input", arg => arg.Type().UseFluentValidation()))) - .Services.AddSingleton, TestInputValidator>()); + .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg + .Type().UseFluentValidation(opt => opt.UseValidator())))) + .Services.AddSingleton()); fluentChocoValidation = await BenchmarkSetup.CreateRequestExecutor( builder => builder.UseFluentValidation() diff --git a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/WithEfwProfiler.cs b/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/WithEfwProfiler.cs deleted file mode 100644 index b00513c..0000000 --- a/tests/AppAny.HotChocolate.FluentValidation.Benchmarks/WithEfwProfiler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using BenchmarkDotNet.Diagnostics.Windows.Configs; - -namespace AppAny.HotChocolate.FluentValidation.Benchmarks -{ - [EtwProfiler] - public class WithEfwProfiler : ValidationBenchmarks - { - } -}