예제 #1
0
        public async Task GlobalSetup()
        {
            withoutSingleArgument = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddMutationType(new TestMutationType(field => field
                                                                        .Argument("input", arg => arg.Type <TestInputType>()))));

            withSingleArgument = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation()
                .AddMutationType(new TestMutationType(field => field
                                                      .Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());

            withoutFiveArguments = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddMutationType(new TestMutationType(field => field
                                                                        .Argument("input", arg => arg.Type <TestInputType>())
                                                                        .Argument("input2", arg => arg.Type <TestInputType>())
                                                                        .Argument("input3", arg => arg.Type <TestInputType>())
                                                                        .Argument("input4", arg => arg.Type <TestInputType>())
                                                                        .Argument("input5", arg => arg.Type <TestInputType>()))));

            withFiveArguments = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation()
                .AddMutationType(new TestMutationType(field => field
                                                      .Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())
                                                      .Argument("input2", arg => arg.Type <TestInputType>().UseFluentValidation())
                                                      .Argument("input3", arg => arg.Type <TestInputType>().UseFluentValidation())
                                                      .Argument("input4", arg => arg.Type <TestInputType>().UseFluentValidation())
                                                      .Argument("input5", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());
        }
        public async Task GlobalSetup()
        {
            withDefaultErrorMapper = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation()
                .AddMutationType(new TestMutationType(field =>
                                                      field.Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());

            withDefaultErrorMapperWithDetails = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation(opt => opt.UseDefaultErrorMapperWithDetails())
                .AddMutationType(new TestMutationType(field =>
                                                      field.Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());

            withDefaultErrorMapperWithExtendedDetails = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation(opt => opt.UseDefaultErrorMapperWithExtendedDetails())
                .AddMutationType(new TestMutationType(field =>
                                                      field.Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());
        }
        public async Task GlobalSetup()
        {
            withoutValidation = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddMutationType(new TestMutationType(field =>
                                                                        field.Argument("input", arg => arg.Type <TestInputType>()))));

            withValidation = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.AddFluentValidation()
                .AddMutationType(new TestMutationType(field => field
                                                      .Argument("input", arg => arg.Type <TestInputType>().UseFluentValidation())))
                .Services.AddSingleton <IValidator <TestInput>, TestInputValidator>());

            fluentChocoValidation = await BenchmarkSetup.CreateRequestExecutor(
                builder => builder.UseFluentValidation()
                .AddMutationType(new TestMutationType(field => field.Argument("input", arg => arg.Type <TestInputType>())))
                .Services.AddSingleton <IValidator <TestInput>, 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 <TestInputType>())))
                .Services.AddSingleton <TestInputValidator>());
        }