diff --git a/test/GraphQL.Conventions.Tests/Execution/SchemaExecutionTests.cs b/test/GraphQL.Conventions.Tests/Execution/SchemaExecutionTests.cs index a590908..ffb8f48 100644 --- a/test/GraphQL.Conventions.Tests/Execution/SchemaExecutionTests.cs +++ b/test/GraphQL.Conventions.Tests/Execution/SchemaExecutionTests.cs @@ -1,4 +1,6 @@ +using System.Collections.Generic; using System.Threading.Tasks; +using GraphQL.Conventions; using GraphQL.NewtonsoftJson; using Tests.Templates; using Tests.Templates.Extensions; @@ -29,5 +31,72 @@ private class QueryTypeWithDecimal { public decimal Test => 10; } + + [Test] + public async Task Test_NonNull_Validation() + { + string query = @" + query { + test { + children { + field(problematic: [""1"", ""2""]) + } + } + } + "; + + var engine = GraphQLEngine.New(); + + engine.WithQuery(); + + var executor = engine + .NewExecutor() + .WithQueryString(query); + + var result1 = await executor.ExecuteAsync(); + System.Diagnostics.Debug.WriteLine(new GraphQLSerializer(indent: true).Serialize(result1)); + + + var schema = Schema(); + schema.ShouldHaveQueries(1); + schema.ShouldHaveMutations(0); + schema.Query.ShouldHaveFieldWithName("test"); + + var result2 = await schema.ExecuteAsync((e) => e.Query = query); + System.Diagnostics.Debug.WriteLine(result2); + ResultHelpers.AssertNoErrorsInResult(result2); + } + + public class NonNullTests + { + public QueryType Query { get; } + + public class QueryType + { + public NonNull test() + { + return new DataType() + { + children = new List> { + new DataType(), + new DataType() + } + }; + } + + public class DataType + { + public NonNull>> children { get; set; } + + public List> field(NonNull> problematic) + { + return new List> { + new NonNull("ab"), + new NonNull("cd") + }; + } + } + } + } } }