-
-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26b3433
commit 916b771
Showing
3 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...xecution.Tests/DependencyInjection/RequestExecutorBuilderExtensions_SchemaOptionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using HotChocolate.Configuration; | ||
using HotChocolate.Types.Descriptors; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace HotChocolate.Execution.DependencyInjection; | ||
|
||
public class RequestExecutorBuilderExtensionsSchemaOptionsTests | ||
{ | ||
[Fact] | ||
public async Task SetOptions_ValidatePipelineOrder_False() | ||
{ | ||
var interceptor = new OptionsInterceptor(); | ||
|
||
await new ServiceCollection() | ||
.AddGraphQLServer() | ||
.AddType<Query>() | ||
.SetOptions(new SchemaOptions { ValidatePipelineOrder = false }) | ||
.TryAddTypeInterceptor(interceptor) | ||
.BuildRequestExecutorAsync(); | ||
|
||
Assert.False(interceptor.Options.ValidatePipelineOrder); | ||
} | ||
|
||
private sealed class OptionsInterceptor : TypeInterceptor | ||
{ | ||
public IReadOnlySchemaOptions Options { get; private set; } = default!; | ||
|
||
public override void OnBeforeCreateSchema( | ||
IDescriptorContext context, | ||
ISchemaBuilder schemaBuilder) | ||
{ | ||
Options = context.Options; | ||
} | ||
} | ||
|
||
public class Query | ||
{ | ||
public string Abc() => "abc"; | ||
} | ||
} |