diff --git a/Directory.Packages.props b/Directory.Packages.props index ec0e81740..d60142889 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,6 @@ - diff --git a/examples/SimpleBlog/FakeBlogData.cs b/examples/SimpleBlog/FakeBlogData.cs index ae08d29e2..5ae99b7de 100644 --- a/examples/SimpleBlog/FakeBlogData.cs +++ b/examples/SimpleBlog/FakeBlogData.cs @@ -13,7 +13,9 @@ public static class FakeBlogData new Post { Id = 2, Author = "Jane", Title = "Follow up post", Content = "This blog is really fun!" }, new Post { - Id = 3, Author = "Gene", Title = "Guest post", + Id = 3, + Author = "Gene", + Title = "Guest post", Content = "Jane has let me write a guest post for her blog." } }; diff --git a/examples/SimpleBlog/Models/Mutation.cs b/examples/SimpleBlog/Models/Mutation.cs index a5827935b..37627ab56 100644 --- a/examples/SimpleBlog/Models/Mutation.cs +++ b/examples/SimpleBlog/Models/Mutation.cs @@ -11,13 +11,7 @@ public class Mutation public bool AddPost(string author, string title, string post) { var newId = FakeBlogData.Posts.Max(_ => _.Id) + 1; - var postModel = new Post - { - Id = newId, - Author = author, - Title = title, - Content = post - }; + var postModel = new Post { Id = newId, Author = author, Title = title, Content = post }; FakeBlogData.Posts.Add(postModel); return true; } @@ -27,13 +21,7 @@ public bool AddPost(string author, string title, string post) public bool Comment(int postId, string author, string comment) { var newId = FakeBlogData.Comments.Max(_ => _.Id) + 1; - var commentModel = new Comment - { - Id = newId, - PostId = postId, - Author = author, - Content = comment - }; + var commentModel = new Comment { Id = newId, PostId = postId, Author = author, Content = comment }; FakeBlogData.Comments.Add(commentModel); return true; } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9163d7389..362bf71b0 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,33 +1,33 @@ - + - - GraphZen - GraphZen - GraphZen LLC - Copyright (c) 2017-2026 GraphZen LLC. All Rights Reserved. - https://github.com/GraphZen/graphzen-dotnet - https://github.com/GraphZen/graphzen-dotnet - Git - LICENSE - true - true - snupkg - true - true - True - README.md - GraphZen - + + GraphZen + GraphZen + GraphZen LLC + Copyright (c) 2017-2026 GraphZen LLC. All Rights Reserved. + https://github.com/GraphZen/graphzen-dotnet + https://github.com/GraphZen/graphzen-dotnet + Git + LICENSE + true + true + snupkg + true + true + True + README.md + GraphZen + - - - + + + - - - - + + + + - \ No newline at end of file + diff --git a/src/GraphZen.AspNetCore.Playground/Playground/Internal/Files/playground.html b/src/GraphZen.AspNetCore.Playground/Playground/Internal/Files/playground.html index 663d9a485..74b9048e0 100644 --- a/src/GraphZen.AspNetCore.Playground/Playground/Internal/Files/playground.html +++ b/src/GraphZen.AspNetCore.Playground/Playground/Internal/Files/playground.html @@ -62,4 +62,4 @@ }); - \ No newline at end of file + diff --git a/src/GraphZen.AspNetCore.Playground/Playground/Internal/PlaygroundHtmlWriter.cs b/src/GraphZen.AspNetCore.Playground/Playground/Internal/PlaygroundHtmlWriter.cs index cd1b53f75..594a03107 100644 --- a/src/GraphZen.AspNetCore.Playground/Playground/Internal/PlaygroundHtmlWriter.cs +++ b/src/GraphZen.AspNetCore.Playground/Playground/Internal/PlaygroundHtmlWriter.cs @@ -21,10 +21,7 @@ public class PlaygroundHtmlWriter private static JsonSerializerOptions SerializerOptions { get; } = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = - { - new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) - }, + Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, WriteIndented = true }; diff --git a/src/GraphZen.AspNetCore.Server/GraphZenApplicationBuilderExtensions.cs b/src/GraphZen.AspNetCore.Server/GraphZenApplicationBuilderExtensions.cs index c43c04354..deae0fc6e 100644 --- a/src/GraphZen.AspNetCore.Server/GraphZenApplicationBuilderExtensions.cs +++ b/src/GraphZen.AspNetCore.Server/GraphZenApplicationBuilderExtensions.cs @@ -7,13 +7,13 @@ using GraphZen.Internal; using GraphZen.LanguageModel; using GraphZen.LanguageModel.Internal; -using GraphZen.Logging; using GraphZen.QueryEngine; using GraphZen.QueryEngine.Validation; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; // ReSharper disable once CheckNamespace namespace Microsoft.AspNetCore.Builder; @@ -23,7 +23,6 @@ public static class GraphZenApplicationBuilderExtensions private const int DefaultMemoryThreshold = 1024 * 30; private static string? _sTempDirectory; - private static ILog Logger { get; } = LogProvider.GetCurrentClassLogger(); public static string TempDirectory { @@ -55,6 +54,8 @@ public static IEndpointConventionBuilder MapGraphQL(this IEndpointRouteBuilder e { return endpoints.MapPost(path, async httpContext => { + var logger = httpContext.RequestServices.GetRequiredService() + .CreateLogger(typeof(GraphZenApplicationBuilderExtensions)); var request = httpContext.Request; var readStream = request.Body; if (!request.Body.CanSeek) @@ -109,20 +110,18 @@ public static IEndpointConventionBuilder MapGraphQL(this IEndpointRouteBuilder e result = await new Executor().ExecuteAsync(graphQLContext.Schema, document, rootValue, - graphQLContext, req.Variables, req.OperationName, new ExecutionOptions - { - ThrowOnError = false - }); + graphQLContext, req.Variables, req.OperationName, + new ExecutionOptions { ThrowOnError = false }); } } catch (GraphQLException gqlException) { - Logger.Error(gqlException, gqlException.Message); + logger.LogError(gqlException, "{Message}", gqlException.Message); result = new ExecutionResult(null, new[] { gqlException.GraphQLError }); } catch (Exception e) { - Logger.Error(e, e.Message); + logger.LogError(e, "{Message}", e.Message); var coreOptions = graphQLContext.Options.GetExtension(); var error = coreOptions.RevealInternalServerErrors ? new GraphQLServerError(e.Message, innerException: e) diff --git a/src/GraphZen.AspNetCore.Server/GraphZenServiceCollectionExtensions.cs b/src/GraphZen.AspNetCore.Server/GraphZenServiceCollectionExtensions.cs index e065b43f9..42b13c8a6 100644 --- a/src/GraphZen.AspNetCore.Server/GraphZenServiceCollectionExtensions.cs +++ b/src/GraphZen.AspNetCore.Server/GraphZenServiceCollectionExtensions.cs @@ -4,7 +4,6 @@ using System.Reflection; using GraphZen; using GraphZen.Infrastructure; -using GraphZen.Logging; using GraphZen.QueryEngine.Validation; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -13,8 +12,6 @@ namespace Microsoft.Extensions.DependencyInjection; public static class GraphZenServiceCollectionExtensions { - private static ILog Logger { get; } = LogProvider.GetCurrentClassLogger(); - public static void AddGraphQLContext( this IServiceCollection serviceCollection, Action? optionsAction = null) @@ -37,7 +34,6 @@ public static void AddGraphQLContext( : (Action?)null; var contextType = typeof(TContext); - Logger.Debug($"Adding GraphQL context {contextType}"); if (optionsAction != null) { var declaredConstructors = contextType.GetTypeInfo().DeclaredConstructors.ToList(); @@ -48,33 +44,26 @@ public static void AddGraphQLContext( } } - Logger.Debug($"Registering {nameof(GraphQLContextOptions)}"); serviceCollection.TryAdd(new ServiceDescriptor(typeof(GraphQLContextOptions), p => GraphQLContextOptionsFactory(p, optionsActionImpl), ServiceLifetime.Scoped)); - Logger.Debug($"Registering {nameof(GraphQLContextOptions)}"); serviceCollection.Add(new ServiceDescriptor(typeof(GraphQLContextOptions), p => p.GetRequiredService>(), ServiceLifetime.Scoped)); - Logger.Debug($"Registering {typeof(TContext)}"); serviceCollection.TryAdd(new ServiceDescriptor(typeof(TContext), typeof(TContext), ServiceLifetime.Scoped)); - Logger.Debug($"Registering {nameof(GraphQLContext)}"); serviceCollection.TryAdd(new ServiceDescriptor(typeof(GraphQLContext), p => p.GetRequiredService(), ServiceLifetime.Scoped)); - Logger.Debug($"Registering {nameof(IQueryValidator)}"); serviceCollection.TryAddScoped(_ => new QueryValidator()); - Logger.Debug("Building temporary service provider"); var tempServiceProvider = serviceCollection.BuildServiceProvider(); - Logger.Debug("Building temporary service provider"); var context = tempServiceProvider.GetRequiredService(); var queryClrType = context.Schema.QueryType?.ClrType; if (queryClrType != null) diff --git a/src/GraphZen.AspNetCore.Server/PlaygroundApplicationBuilderExtensions.cs b/src/GraphZen.AspNetCore.Server/PlaygroundApplicationBuilderExtensions.cs index 4d33c4deb..94e535d04 100644 --- a/src/GraphZen.AspNetCore.Server/PlaygroundApplicationBuilderExtensions.cs +++ b/src/GraphZen.AspNetCore.Server/PlaygroundApplicationBuilderExtensions.cs @@ -13,10 +13,7 @@ public static class PlaygroundApplicationBuilderExtensions [UsedImplicitly] public static void UseGraphQLPlayground(this IApplicationBuilder app) { - var shared = new SharedOptions - { - RequestPath = "" - }; + var shared = new SharedOptions { RequestPath = "" }; var defaultFileOptions = new DefaultFilesOptions(shared); // ReSharper disable once PossibleNullReferenceException defaultFileOptions.DefaultFileNames.Clear(); diff --git a/src/GraphZen.Client/Infrastructure/GraphQLRequestExtensions.cs b/src/GraphZen.Client/Infrastructure/GraphQLRequestExtensions.cs index 5a426d1f9..61294389c 100644 --- a/src/GraphZen.Client/Infrastructure/GraphQLRequestExtensions.cs +++ b/src/GraphZen.Client/Infrastructure/GraphQLRequestExtensions.cs @@ -19,11 +19,7 @@ public static HttpRequestMessage ToHttpRequest(this GraphQLRequest request) var requestJson = JsonSerializer.Serialize(request); var requestJsonContent = new StringContent(requestJson, Encoding.UTF8, "application/json"); - var message = new HttpRequestMessage - { - Method = HttpMethod.Post, - Content = requestJsonContent - }; + var message = new HttpRequestMessage { Method = HttpMethod.Post, Content = requestJsonContent }; return message; } } diff --git a/src/GraphZen.DevCli/CodeGen/CodeGenTasks.cs b/src/GraphZen.DevCli/CodeGen/CodeGenTasks.cs index f79a9d3b2..ededa0e70 100644 --- a/src/GraphZen.DevCli/CodeGen/CodeGenTasks.cs +++ b/src/GraphZen.DevCli/CodeGen/CodeGenTasks.cs @@ -48,9 +48,7 @@ namespace GraphZen.TypeSystem { var fieldAccessors = new List<(string containerType, string valueType)> { - ("InterfaceType", "Field"), - ("ObjectType", "Field"), - ("InputObjectType", "InputField") + ("InterfaceType", "Field"), ("ObjectType", "Field"), ("InputObjectType", "InputField") }; foreach (var (containerType, valueType) in fieldAccessors) @@ -66,8 +64,7 @@ namespace GraphZen.TypeSystem { var argumentDefinitionAccessors = new List<(string containerType, string valueType)> { - ("FieldDefinition", "ArgumentDefinition"), - ("DirectiveDefinition", "ArgumentDefinition") + ("FieldDefinition", "ArgumentDefinition"), ("DirectiveDefinition", "ArgumentDefinition") }; foreach (var (containerType, valueType) in argumentDefinitionAccessors) @@ -78,8 +75,7 @@ namespace GraphZen.TypeSystem { var argumentAccessors = new List<(string containerType, string valueType)> { - ("Field", "Argument"), - ("IArguments", "Argument") + ("Field", "Argument"), ("IArguments", "Argument") }; foreach (var (containerType, valueType) in argumentAccessors) diff --git a/src/GraphZen.Infrastructure/GraphZen.Infrastructure.csproj b/src/GraphZen.Infrastructure/GraphZen.Infrastructure.csproj index e8f45d080..04cc419ee 100644 --- a/src/GraphZen.Infrastructure/GraphZen.Infrastructure.csproj +++ b/src/GraphZen.Infrastructure/GraphZen.Infrastructure.csproj @@ -1,19 +1,11 @@ - + Infrastructure code supporting the GraphZen SDK. Not intended for direct installation or use. - LIBLOG_EXCLUDE_CODE_COVERAGE;$(DefineConstants) - - - all - runtime; build; native; contentfiles; analyzers - - - - \ No newline at end of file + diff --git a/src/GraphZen.Infrastructure/Infrastructure/Json.cs b/src/GraphZen.Infrastructure/Infrastructure/Json.cs index ff572ee79..b691eed77 100644 --- a/src/GraphZen.Infrastructure/Infrastructure/Json.cs +++ b/src/GraphZen.Infrastructure/Infrastructure/Json.cs @@ -28,10 +28,7 @@ public static class Json [DebuggerStepThrough] public static string SerializeObject(object value) { - var options = new JsonSerializerOptions(SerializerOptions) - { - WriteIndented = true - }; + var options = new JsonSerializerOptions(SerializerOptions) { WriteIndented = true }; return JsonSerializer.Serialize(value, options); } } diff --git a/src/GraphZen.LanguageModel/LanguageModel/GraphQLSyntaxVisitor.Generated.cs b/src/GraphZen.LanguageModel/LanguageModel/GraphQLSyntaxVisitor.Generated.cs index ba29cbfc4..23ce705b1 100644 --- a/src/GraphZen.LanguageModel/LanguageModel/GraphQLSyntaxVisitor.Generated.cs +++ b/src/GraphZen.LanguageModel/LanguageModel/GraphQLSyntaxVisitor.Generated.cs @@ -549,4 +549,4 @@ public virtual TResult LeaveOperationTypeDefinition(OperationTypeDefinitionSynta /// Called when the visitor leaves a node. public virtual TResult LeaveVariable(VariableSyntax node) => OnLeave(node); -} \ No newline at end of file +} diff --git a/src/GraphZen.LanguageModel/LanguageModel/Internal/Printer.cs b/src/GraphZen.LanguageModel/LanguageModel/Internal/Printer.cs index 0f53eb8d3..6a79e614f 100644 --- a/src/GraphZen.LanguageModel/LanguageModel/Internal/Printer.cs +++ b/src/GraphZen.LanguageModel/LanguageModel/Internal/Printer.cs @@ -519,7 +519,8 @@ public void Join(IReadOnlyList nodes, Action? seperatorAction = null private void Join(IReadOnlyList nodes, string? seperator = null) { - Join(nodes, seperator != null ? () => { Append(seperator); } + Join(nodes, seperator != null + ? () => { Append(seperator); } : null); } diff --git a/src/GraphZen.LanguageModel/LanguageModel/Syntax/SyntaxNode.Generated.cs b/src/GraphZen.LanguageModel/LanguageModel/Syntax/SyntaxNode.Generated.cs index 325505f69..c75502ca1 100644 --- a/src/GraphZen.LanguageModel/LanguageModel/Syntax/SyntaxNode.Generated.cs +++ b/src/GraphZen.LanguageModel/LanguageModel/Syntax/SyntaxNode.Generated.cs @@ -1380,4 +1380,4 @@ public override TResult VisitEnter(GraphQLSyntaxVisitor visito /// Called when a leaves a node. public override TResult VisitLeave(GraphQLSyntaxVisitor visitor) => visitor.LeaveVariable(this); -} \ No newline at end of file +} diff --git a/src/GraphZen.LanguageModel/LanguageModel/Validation/DocumentValidationRules.cs b/src/GraphZen.LanguageModel/LanguageModel/Validation/DocumentValidationRules.cs index 37ffe7b4b..a02aa0f77 100644 --- a/src/GraphZen.LanguageModel/LanguageModel/Validation/DocumentValidationRules.cs +++ b/src/GraphZen.LanguageModel/LanguageModel/Validation/DocumentValidationRules.cs @@ -76,18 +76,11 @@ public static class DocumentValidationRules SpecifiedSdlRules.Concat( new[] { - SchemaMustHaveRootObjectTypes, - FieldArgsMustBeProperlyNamed, - UnionTypesMustBeValid, - InputObjectsMustHaveFields, - EnumTypesMustBeWellDefined, - ObjectFieldsMustHaveOutputTypes, - ObjectsCanOnlyImplementUniqueInterfaces, - InterfaceExtensionsShouldBeValid, - InterfaceFieldsMustHaveOutputTypes, - FieldArgumentsMustHaveInputTypes, - ObjectsMustAdhereToInterfaceTheyImplement, - ObjectsMustHaveFields, + SchemaMustHaveRootObjectTypes, FieldArgsMustBeProperlyNamed, UnionTypesMustBeValid, + InputObjectsMustHaveFields, EnumTypesMustBeWellDefined, ObjectFieldsMustHaveOutputTypes, + ObjectsCanOnlyImplementUniqueInterfaces, InterfaceExtensionsShouldBeValid, + InterfaceFieldsMustHaveOutputTypes, FieldArgumentsMustHaveInputTypes, + ObjectsMustAdhereToInterfaceTheyImplement, ObjectsMustHaveFields, InputObjectFieldsMustHaveInputTypes }).ToList(); } diff --git a/src/GraphZen.LanguageModel/LanguageModel/Validation/Rules/ObjectsMustHaveFields.cs b/src/GraphZen.LanguageModel/LanguageModel/Validation/Rules/ObjectsMustHaveFields.cs index f778b8c5d..ad95f791e 100644 --- a/src/GraphZen.LanguageModel/LanguageModel/Validation/Rules/ObjectsMustHaveFields.cs +++ b/src/GraphZen.LanguageModel/LanguageModel/Validation/Rules/ObjectsMustHaveFields.cs @@ -44,10 +44,7 @@ public override VisitAction LeaveDocument(DocumentSyntax node) return n.Fields; }).Any()) { - var nodes = new List - { - objectTypeNode.Name - }; + var nodes = new List { objectTypeNode.Name }; // ReSharper disable once PossibleNullReferenceException nodes.AddRange(extensionNodes.Select(_ => _.Name)); ReportError($"Type {objectTypeName} must define one or more fields.", nodes); diff --git a/src/GraphZen.QueryEngine/QueryEngine/Validation/QueryValidationRules.cs b/src/GraphZen.QueryEngine/QueryEngine/Validation/QueryValidationRules.cs index 4671cf889..53eca5b4b 100644 --- a/src/GraphZen.QueryEngine/QueryEngine/Validation/QueryValidationRules.cs +++ b/src/GraphZen.QueryEngine/QueryEngine/Validation/QueryValidationRules.cs @@ -114,31 +114,11 @@ public static class QueryValidationRules public static IReadOnlyList SpecifiedQueryRules { get; } = new[] { - ExecutableDefinitions, - UniqueOperationNames, - LoneAnonymousOperation, - SingleFieldSubscriptions, - KnownTypeNames, - FragmentsOnCompositeTypes, - VariablesAreInputTypes, - ScalarLeafs, - FieldsOnCorrectType, - UniqueFragmentNames, - KnownFragmentNames, - NoUnusedFragments, - PossibleFragmentSpreads, - NoFragmentCycles, - UniqueVariableNames, - NoUndefinedVariables, - NoUnusedVariables, - KnownDirectives, - UniqueDirectivesPerLocation, - KnownArgumentNames, - UniqueArgumentNames, - ValuesOfCorrectType, - ProvidedRequiredArguments, - VariablesInAllowedPosition, - OverlappingFieldsCanBeMerged, - UniqueInputFieldNames + ExecutableDefinitions, UniqueOperationNames, LoneAnonymousOperation, SingleFieldSubscriptions, + KnownTypeNames, FragmentsOnCompositeTypes, VariablesAreInputTypes, ScalarLeafs, FieldsOnCorrectType, + UniqueFragmentNames, KnownFragmentNames, NoUnusedFragments, PossibleFragmentSpreads, NoFragmentCycles, + UniqueVariableNames, NoUndefinedVariables, NoUnusedVariables, KnownDirectives, UniqueDirectivesPerLocation, + KnownArgumentNames, UniqueArgumentNames, ValuesOfCorrectType, ProvidedRequiredArguments, + VariablesInAllowedPosition, OverlappingFieldsCanBeMerged, UniqueInputFieldNames }; } diff --git a/src/GraphZen.TypeSystem/GraphQLContext.cs b/src/GraphZen.TypeSystem/GraphQLContext.cs index 74fe22e29..b22a78aba 100644 --- a/src/GraphZen.TypeSystem/GraphQLContext.cs +++ b/src/GraphZen.TypeSystem/GraphQLContext.cs @@ -2,14 +2,12 @@ // Licensed under the GraphZen Community License. See the LICENSE file in the project root for license information. using System.Reflection; -using GraphZen.Logging; using GraphZen.TypeSystem; namespace GraphZen; public class GraphQLContext { - private static readonly ILog Logger = LogProvider.For(); private GraphQLContextOptions _options; private bool _optionsInitialized; @@ -47,7 +45,6 @@ public GraphQLContextOptions Options OnConfiguring(optionsBuilder); _options = optionsBuilder.Options; _optionsInitialized = true; - Logger.Debug("howdy from GraphZen"); } return _options; diff --git a/src/GraphZen.TypeSystem/TypeSystem/Introspection.cs b/src/GraphZen.TypeSystem/TypeSystem/Introspection.cs index 4a35d5e56..9ac90d09b 100644 --- a/src/GraphZen.TypeSystem/TypeSystem/Introspection.cs +++ b/src/GraphZen.TypeSystem/TypeSystem/Introspection.cs @@ -112,10 +112,7 @@ type is InputObjectType inputObject public static Field TypeMetaFieldDef { get; } = new("__type", "Request the type information of a single type.", null, Schema.GetObject("__Type"), - new[] - { - new Argument("name", null, NonNullType.Of(SpecScalars.String), null, null, false) - }, + new[] { new Argument("name", null, NonNullType.Of(SpecScalars.String), null, null, false) }, (source, args, context, info) => info.Schema.GetType(args.name), null); diff --git a/src/GraphZen.TypeSystem/TypeSystem/Schema.cs b/src/GraphZen.TypeSystem/TypeSystem/Schema.cs index 2cbbaf5f2..4468a46b2 100644 --- a/src/GraphZen.TypeSystem/TypeSystem/Schema.cs +++ b/src/GraphZen.TypeSystem/TypeSystem/Schema.cs @@ -116,10 +116,7 @@ public Schema(SchemaDefinition schemaDefinition, IEnumerable? types = } else { - _implementations[iface.Name] = new List - { - objectType - }; + _implementations[iface.Name] = new List { objectType }; } } } diff --git a/src/GraphZen.TypeSystem/TypeSystem/SpecDirectives.cs b/src/GraphZen.TypeSystem/TypeSystem/SpecDirectives.cs index d81d45f37..40bf39cb3 100644 --- a/src/GraphZen.TypeSystem/TypeSystem/SpecDirectives.cs +++ b/src/GraphZen.TypeSystem/TypeSystem/SpecDirectives.cs @@ -9,11 +9,7 @@ public static class SpecDirectives public static Directive Deprecated { get; } = new("deprecated", "Marks an element of a GraphQL schema as no longer supported.", - new[] - { - DirectiveLocation.EnumValue, - DirectiveLocation.FieldDefinition - }, + new[] { DirectiveLocation.EnumValue, DirectiveLocation.FieldDefinition }, new[] { new Argument("reason", "Explains why this element was deprecated, usually also including a " + @@ -46,10 +42,6 @@ public static class SpecDirectives }, null!); - public static IReadOnlyList All { get; } = new List - { - Deprecated, - Include, - Skip - }.AsReadOnly(); + public static IReadOnlyList All { get; } = + new List { Deprecated, Include, Skip }.AsReadOnly(); } diff --git a/src/GraphZen.TypeSystem/TypeSystem/TypeKindHelpers.cs b/src/GraphZen.TypeSystem/TypeSystem/TypeKindHelpers.cs index a30092607..3d290be26 100644 --- a/src/GraphZen.TypeSystem/TypeSystem/TypeKindHelpers.cs +++ b/src/GraphZen.TypeSystem/TypeSystem/TypeKindHelpers.cs @@ -13,37 +13,28 @@ public static class TypeKindHelpers { typeof(ScalarType), TypeKind.Scalar }, { typeof(IScalarType), TypeKind.Scalar }, { typeof(IScalarTypeDefinition), TypeKind.Scalar }, - - { typeof(UnionTypeDefinition), TypeKind.Union }, { typeof(UnionType), TypeKind.Union }, { typeof(IUnionType), TypeKind.Union }, { typeof(IUnionTypeDefinition), TypeKind.Union }, - { typeof(ObjectTypeDefinition), TypeKind.Object }, { typeof(ObjectType), TypeKind.Object }, { typeof(IObjectType), TypeKind.Object }, { typeof(IObjectTypeDefinition), TypeKind.Object }, - { typeof(InputObjectTypeDefinition), TypeKind.InputObject }, { typeof(InputObjectType), TypeKind.InputObject }, { typeof(IInputObjectType), TypeKind.InputObject }, { typeof(IInputObjectTypeDefinition), TypeKind.InputObject }, - - { typeof(EnumTypeDefinition), TypeKind.Enum }, { typeof(EnumType), TypeKind.Enum }, { typeof(IEnumType), TypeKind.Enum }, { typeof(IEnumTypeDefinition), TypeKind.Enum }, - { typeof(InterfaceTypeDefinition), TypeKind.Interface }, { typeof(InterfaceType), TypeKind.Interface }, { typeof(IInterfaceType), TypeKind.Interface }, { typeof(IInterfaceTypeDefinition), TypeKind.Interface }, - { typeof(ListType), TypeKind.List }, { typeof(IListType), TypeKind.List }, - { typeof(INonNullType), TypeKind.NonNull }, { typeof(NonNullType), TypeKind.NonNull } }.ToImmutableDictionary(); diff --git a/src/Linked/TypeSystem/TypeSystemAccessors.Generated.cs b/src/Linked/TypeSystem/TypeSystemAccessors.Generated.cs index 5497084e4..0c73a22dc 100644 --- a/src/Linked/TypeSystem/TypeSystemAccessors.Generated.cs +++ b/src/Linked/TypeSystem/TypeSystemAccessors.Generated.cs @@ -2,7 +2,6 @@ // Licensed under the GraphZen Community License. See the LICENSE file in the project root for license information. - // ReSharper disable PartialTypeWithSinglePart // ReSharper disable UnusedMember.Global @@ -265,4 +264,4 @@ public static Argument GetArgument(this IArguments source, string name) public static bool TryGetArgument(this IArguments source, string name, [NotNullWhen(true)] out Argument? argument) => source.Arguments.TryGetValue(Check.NotNull(name, nameof(name)), out argument); -} \ No newline at end of file +} diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 8daa1942e..9f5d1ad58 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,26 +1,26 @@ - + - - False - + + False + - - - + + + - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - \ No newline at end of file + diff --git a/test/GraphZen.Client.IntegrationTests/GraphQLRequestIntegrationTests.cs b/test/GraphZen.Client.IntegrationTests/GraphQLRequestIntegrationTests.cs index d8781c498..0aed00b3b 100644 --- a/test/GraphZen.Client.IntegrationTests/GraphQLRequestIntegrationTests.cs +++ b/test/GraphZen.Client.IntegrationTests/GraphQLRequestIntegrationTests.cs @@ -26,10 +26,7 @@ public GraphQLRequestIntegrationTests() [Fact] public async Task it_can_be_used_to_execute_graphql_request() { - var graphqlRequest = new GraphQLRequest - { - Query = @"{ message }" - }; + var graphqlRequest = new GraphQLRequest { Query = @"{ message }" }; var expected = new { message = "Hello world" }; var response = await _gql.SendAsync(graphqlRequest); diff --git a/test/GraphZen.Client.Tests/Internal/GraphQLSerializerTests.cs b/test/GraphZen.Client.Tests/Internal/GraphQLSerializerTests.cs index bb2807f15..bf28bd2b2 100644 --- a/test/GraphZen.Client.Tests/Internal/GraphQLSerializerTests.cs +++ b/test/GraphZen.Client.Tests/Internal/GraphQLSerializerTests.cs @@ -61,10 +61,6 @@ public void parse_typed_data_should_return_typed_data() { var result = GraphQLJsonSerializer.ParseData("{\"data\":{\"number\": 1, \"message\":\"hello\"}}"); - JsonAssert.EquivalentToJsonFromObject(result, new TypedQueryResult - { - Message = "hello", - Number = 1 - }); + JsonAssert.EquivalentToJsonFromObject(result, new TypedQueryResult { Message = "hello", Number = 1 }); } } diff --git a/test/GraphZen.Tests/Error/GraphQLErrorTests.cs b/test/GraphZen.Tests/Error/GraphQLErrorTests.cs index 4fb338599..f6c2deeda 100644 --- a/test/GraphZen.Tests/Error/GraphQLErrorTests.cs +++ b/test/GraphZen.Tests/Error/GraphQLErrorTests.cs @@ -58,11 +58,7 @@ public void ItSerializesToIncludeMessageAndLocations() var node = ((OperationDefinitionSyntax)ast.Definitions[0]).SelectionSet.Selections.First(); var e = new GraphQLServerError("msg", new SyntaxNode[] { node }); JsonAssert.EquivalentToJsonFromObject(e, - new - { - message = "msg", - locations = new object[] { new { line = 1, column = 3 } } - }); + new { message = "msg", locations = new object[] { new { line = 1, column = 3 } } }); } [Fact] @@ -70,10 +66,7 @@ public void ItSerializesToIncludePath() { var e = new GraphQLServerError("msg", null, null, null, new object[] { "path", 3, "to", "field" }); Assert.Equal(new object[] { "path", 3, "to", "field" }, e.Path); - JsonAssert.EquivalentToJsonFromObject(e, new - { - message = "msg", - path = new object[] { "path", 3, "to", "field" } - }); + JsonAssert.EquivalentToJsonFromObject(e, + new { message = "msg", path = new object[] { "path", 3, "to", "field" } }); } } diff --git a/test/GraphZen.Tests/FixIndentTests.cs b/test/GraphZen.Tests/FixIndentTests.cs index 7cdd8c31e..0da137abf 100644 --- a/test/GraphZen.Tests/FixIndentTests.cs +++ b/test/GraphZen.Tests/FixIndentTests.cs @@ -24,15 +24,7 @@ type User { var expected = new[] { - "type Query {", - " me: User", - "}", - "", - "type User {", - " id: ID", - " name: String", - "}", - "" + "type Query {", " me: User", "}", "", "type User {", " id: ID", " name: String", "}", "" }.ToMultiLineString(); Assert.Equal(expected, result); @@ -47,10 +39,7 @@ public void RemovesOnlyFirstLevelOfIndentation() quuux quuuux".Dedent(); - var expected = new[] - { - "qux", " quux", " quuux", " quuuux" - }.ToMultiLineString(); + var expected = new[] { "qux", " quux", " quuux", " quuuux" }.ToMultiLineString(); Assert.Equal(expected, result); } } diff --git a/test/GraphZen.Tests/LanguageModel/BlockStringValueTests.cs b/test/GraphZen.Tests/LanguageModel/BlockStringValueTests.cs index 8837fd752..1387f3967 100644 --- a/test/GraphZen.Tests/LanguageModel/BlockStringValueTests.cs +++ b/test/GraphZen.Tests/LanguageModel/BlockStringValueTests.cs @@ -13,25 +13,14 @@ public void DoesNotALterTrailingSpaces() { var rawValue = new[] { - " ", - " Hello, ", - " World! ", - " ", - " Yours, ", - " GraphQL. ", - " " + " ", " Hello, ", " World! ", " ", " Yours, ", + " GraphQL. ", " " }.ToMultiLineString(); var result = LanguageHelpers.BlockStringValue(rawValue); - var expected = new[] - { - "Hello, ", - " World! ", - " ", - "Yours, ", - " GraphQL. " - }.ToMultiLineString(); + var expected = new[] { "Hello, ", " World! ", " ", "Yours, ", " GraphQL. " } + .ToMultiLineString(); Assert.Equal(expected, result); } @@ -41,24 +30,13 @@ public void RemovesBlankLeadingAndTrailingLines() { var rawValue = new[] { - " ", - " ", - "", - " Hello,", - " World!", - "", - " Yours,", - " GraphQL.", - " ", + " ", " ", "", " Hello,", " World!", "", " Yours,", " GraphQL.", " ", " " }.ToMultiLineString(); var result = LanguageHelpers.BlockStringValue(rawValue); - var expected = new[] - { - "Hello,", " World!", "", "Yours,", " GraphQL." - }.ToMultiLineString(); + var expected = new[] { "Hello,", " World!", "", "Yours,", " GraphQL." }.ToMultiLineString(); Assert.Equal(expected, result); } @@ -66,26 +44,12 @@ public void RemovesBlankLeadingAndTrailingLines() [Fact] public void RemovesEmptyLeadingAndTrailingLines() { - var rawValue = new[] - { - "", - "", - "", - " Hello,", - " World!", - "", - " Yours,", - " GraphQL.", - "", - "" - }.ToMultiLineString(); + var rawValue = new[] { "", "", "", " Hello,", " World!", "", " Yours,", " GraphQL.", "", "" } + .ToMultiLineString(); var result = LanguageHelpers.BlockStringValue(rawValue); - var expected = new[] - { - "Hello,", " World!", "", "Yours,", " GraphQL." - }.ToMultiLineString(); + var expected = new[] { "Hello,", " World!", "", "Yours,", " GraphQL." }.ToMultiLineString(); Assert.Equal(expected, result); } @@ -93,22 +57,12 @@ public void RemovesEmptyLeadingAndTrailingLines() [Fact] public void RemovesUniformIndentationFromAString() { - var rawValue = new[] - { - "", - " Hello,", - " World!", - "", - " Yours,", - " GraphQL." - }.ToMultiLineString(); + var rawValue = + new[] { "", " Hello,", " World!", "", " Yours,", " GraphQL." }.ToMultiLineString(); var result = LanguageHelpers.BlockStringValue(rawValue); - var expected = new[] - { - "Hello,", " World!", "", "Yours,", " GraphQL." - }.ToMultiLineString(); + var expected = new[] { "Hello,", " World!", "", "Yours,", " GraphQL." }.ToMultiLineString(); Assert.Equal(expected, result); } @@ -116,21 +70,11 @@ public void RemovesUniformIndentationFromAString() [Fact] public void RetainsIndentationFromFirstLine() { - var rawValue = new[] - { - " Hello,", - " World!", - "", - " Yours,", - " GraphQL." - }.ToMultiLineString(); + var rawValue = new[] { " Hello,", " World!", "", " Yours,", " GraphQL." }.ToMultiLineString(); var result = LanguageHelpers.BlockStringValue(rawValue); - var expected = new[] - { - " Hello,", " World!", "", "Yours,", " GraphQL." - }.ToMultiLineString(); + var expected = new[] { " Hello,", " World!", "", "Yours,", " GraphQL." }.ToMultiLineString(); Assert.Equal(expected, result); } diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/DirectiveParserTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/DirectiveParserTests.cs index b11c03032..89fb99d85 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/DirectiveParserTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/DirectiveParserTests.cs @@ -16,10 +16,7 @@ public void NameOnly() { var tokens = _tokenizer.Tokenize("@skip"); var testResult = Grammar.Directives(tokens); - var expectedValue = new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("skip")) - }; + var expectedValue = new[] { SyntaxFactory.Directive(SyntaxFactory.Name("skip")) }; Assert.Equal(expectedValue, testResult.Value); } @@ -32,10 +29,7 @@ public void NameWithArguments() new[] { new DirectiveSyntax(SyntaxFactory.Name("skip"), - new[] - { - SyntaxFactory.Argument(SyntaxFactory.Name("count"), SyntaxFactory.IntValue(1)) - }) + new[] { SyntaxFactory.Argument(SyntaxFactory.Name("count"), SyntaxFactory.IntValue(1)) }) }; Assert.Equal(expectedValue, testResult.Value); } diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeDefinitionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeDefinitionParsingTests.cs index a0cb4066c..6ab62a4cd 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeDefinitionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeDefinitionParsingTests.cs @@ -43,11 +43,7 @@ enum Site { } "); var expected = Document(new EnumTypeDefinitionSyntax(Name("Site"), null, null, - new[] - { - EnumValueDefinition(EnumValue(Name("DESKTOP"))), - EnumValueDefinition(EnumValue(Name("MOBILE"))) - })); + new[] { EnumValueDefinition(EnumValue(Name("DESKTOP"))), EnumValueDefinition(EnumValue(Name("MOBILE"))) })); Assert.Equal(expected, result); Assert.Equal(expected, PrintAndParse(result)); @@ -80,8 +76,8 @@ enum DescribedEnum { SyntaxHelpers.Description("Enum description"), null, new[ ] { - EnumValueDefinition(EnumValue(Name("UNDESCRIBED"))), - new EnumValueDefinitionSyntax(EnumValue(Name("DESCRIBED")), + EnumValueDefinition(EnumValue(Name("UNDESCRIBED"))), new EnumValueDefinitionSyntax( + EnumValue(Name("DESCRIBED")), SyntaxHelpers.Description("Enum value description")) })); diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeExtensionParserTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeExtensionParserTests.cs index 3b3478e9b..cc3dcc6c0 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeExtensionParserTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/EnumTypeExtensionParserTests.cs @@ -24,10 +24,8 @@ public void ExtendEnumValue() extend enum Site { VR }"); - var expected = SyntaxFactory.Document(new EnumTypeExtensionSyntax(SyntaxFactory.Name("Site"), null, new[] - { - SyntaxFactory.EnumValueDefinition(SyntaxFactory.EnumValue(SyntaxFactory.Name("VR"))) - })); + var expected = SyntaxFactory.Document(new EnumTypeExtensionSyntax(SyntaxFactory.Name("Site"), null, + new[] { SyntaxFactory.EnumValueDefinition(SyntaxFactory.EnumValue(SyntaxFactory.Name("VR"))) })); Assert.Equal(expected, result); Assert.Equal(expected, PrintAndParse(result)); diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/FragmentParserTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/FragmentParserTests.cs index 21d9418bd..eb037a668 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/FragmentParserTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/FragmentParserTests.cs @@ -31,10 +31,7 @@ public void FragmentSpreadWithDirectives() var tokens = _sut.Tokenize(source); var test = Grammar.FragmentSpread(tokens); var expectedValue = new FragmentSpreadSyntax(SyntaxFactory.Name("address"), - new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("include")) - }); + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("include")) }); Assert.Equal(expectedValue, test.Value); } @@ -49,10 +46,8 @@ public void InlineFragmentFull() SyntaxFactory.NamedType(SyntaxFactory.Name("Bar")), new[] { - new DirectiveSyntax(SyntaxFactory.Name("include"), new[] - { - SyntaxFactory.Argument(SyntaxFactory.Name("times"), SyntaxFactory.IntValue(1)) - }) + new DirectiveSyntax(SyntaxFactory.Name("include"), + new[] { SyntaxFactory.Argument(SyntaxFactory.Name("times"), SyntaxFactory.IntValue(1)) }) }); Assert.Equal(expectedValue, test.Value); } @@ -100,10 +95,8 @@ fragment address on User @directive { var test = Grammar.FragmentDefinition(tokens); var expectedValue = new FragmentDefinitionSyntax(SyntaxFactory.Name("address"), SyntaxFactory.NamedType(SyntaxFactory.Name("User")), - SyntaxFactory.SelectionSet(SyntaxFactory.Field(SyntaxFactory.Name("line1"))), new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("directive")) - }); + SyntaxFactory.SelectionSet(SyntaxFactory.Field(SyntaxFactory.Name("line1"))), + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("directive")) }); Assert.Equal(expectedValue, test.Value); } } diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/InterfaceTypeDefinitionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/InterfaceTypeDefinitionParsingTests.cs index 3a6cac798..5becc9aad 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/InterfaceTypeDefinitionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/InterfaceTypeDefinitionParsingTests.cs @@ -17,10 +17,8 @@ interface AnnotatedInterface @onInterface { } "); var expected = SyntaxFactory.Document(new InterfaceTypeDefinitionSyntax( - SyntaxFactory.Name("AnnotatedInterface"), null, new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("onInterface")) - }, new[] + SyntaxFactory.Name("AnnotatedInterface"), null, + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("onInterface")) }, new[] { new FieldDefinitionSyntax(SyntaxFactory.Name("annotatedField"), SyntaxFactory.NamedType(SyntaxFactory.Name("Type")), null, new[] diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/ObjectTypeDefinitionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/ObjectTypeDefinitionParsingTests.cs index 8be848a46..c8da7b533 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/ObjectTypeDefinitionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/ObjectTypeDefinitionParsingTests.cs @@ -27,10 +27,8 @@ type AnnotatedObject @onObject(arg: ""value"") { { new InputValueDefinitionSyntax(SyntaxFactory.Name("arg"), SyntaxFactory.NamedType(SyntaxFactory.Name("Type")), null, - SyntaxFactory.StringValue("default"), new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("onArg")) - }) + SyntaxFactory.StringValue("default"), + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("onArg")) }) }, new[] { SyntaxFactory.Directive(SyntaxFactory.Name("onField")) }) })); Assert.Equal(expected, result); @@ -69,7 +67,8 @@ This is a description of the `argument` argument. var expected = SyntaxFactory.Document(new ObjectTypeDefinitionSyntax(SyntaxFactory.Name("Foo"), SyntaxFactory.StringValue(@"This is a description -of the `Foo` type.", true), new[] +of the `Foo` type.", true), + new[] { SyntaxFactory.NamedType(SyntaxFactory.Name("Bar")), SyntaxFactory.NamedType(SyntaxFactory.Name("Baz")) diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/OperationDefinitionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/OperationDefinitionParsingTests.cs index 813b82d67..5dc4637f3 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/OperationDefinitionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/OperationDefinitionParsingTests.cs @@ -61,10 +61,8 @@ ... @skip(unless: $foo) { }, SyntaxFactory.SelectionSet(SyntaxFactory.Field(SyntaxFactory.Name("id")), SyntaxFactory.FragmentSpread(SyntaxFactory.Name("frag"))))))), - SyntaxFactory.NamedType(SyntaxFactory.Name("User")), new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("defer")) - }), new InlineFragmentSyntax( + SyntaxFactory.NamedType(SyntaxFactory.Name("User")), + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("defer")) }), new InlineFragmentSyntax( SyntaxFactory.SelectionSet(SyntaxFactory.Field(SyntaxFactory.Name("id"))), null, new[] { new DirectiveSyntax(SyntaxFactory.Name("skip"), @@ -103,13 +101,9 @@ mutation likeStory { var result = ParseDocument(query); var expected = SyntaxFactory.Document(new OperationDefinitionSyntax(OperationType.Mutation, SyntaxFactory.SelectionSet(new FieldSyntax( - SyntaxFactory.Name("like"), null, new[] - { - SyntaxFactory.Argument(SyntaxFactory.Name("story"), SyntaxFactory.IntValue(123)) - }, new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("defer")) - }, + SyntaxFactory.Name("like"), null, + new[] { SyntaxFactory.Argument(SyntaxFactory.Name("story"), SyntaxFactory.IntValue(123)) }, + new[] { SyntaxFactory.Directive(SyntaxFactory.Name("defer")) }, SyntaxFactory.SelectionSet(new FieldSyntax(SyntaxFactory.Name("story"), SyntaxFactory.SelectionSet(SyntaxFactory.Field(SyntaxFactory.Name("id"))))))), SyntaxFactory.Name("likeStory"))); diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/QueryDocumentParserTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/QueryDocumentParserTests.cs index 32e2ba45f..b16631b9d 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/QueryDocumentParserTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/QueryDocumentParserTests.cs @@ -34,10 +34,7 @@ query testQuery($var1: String! = ""Foo"") @queryDirective { SyntaxFactory.VariableDefinition(SyntaxFactory.Variable(SyntaxFactory.Name("var1")), SyntaxFactory.NonNull(SyntaxFactory.NamedType(SyntaxFactory.Name("String"))), SyntaxFactory.StringValue("Foo")) - }, new[] - { - SyntaxFactory.Directive(SyntaxFactory.Name("queryDirective")) - })); + }, new[] { SyntaxFactory.Directive(SyntaxFactory.Name("queryDirective")) })); Assert.Equal(expectedValue, test.Value); } diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/SchemaTypeExtensionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/SchemaTypeExtensionParsingTests.cs index e9487703a..445c8d1fd 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/SchemaTypeExtensionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/SchemaTypeExtensionParsingTests.cs @@ -13,7 +13,9 @@ public void SchemaExtendedWithDirective() var result = ParseDocument("extend schema @onSchema"); var expected = SyntaxFactory.Document(new SchemaExtensionSyntax(new[] - { SyntaxFactory.Directive(SyntaxFactory.Name("onSchema")) })); + { + SyntaxFactory.Directive(SyntaxFactory.Name("onSchema")) + })); Assert.Equal(expected, result); Assert.Equal(expected, PrintAndParse(result)); } diff --git a/test/GraphZen.Tests/LanguageModel/Internal/Parser/UnionTypeExtensionParsingTests.cs b/test/GraphZen.Tests/LanguageModel/Internal/Parser/UnionTypeExtensionParsingTests.cs index 2243ef522..746d7bdda 100644 --- a/test/GraphZen.Tests/LanguageModel/Internal/Parser/UnionTypeExtensionParsingTests.cs +++ b/test/GraphZen.Tests/LanguageModel/Internal/Parser/UnionTypeExtensionParsingTests.cs @@ -21,11 +21,12 @@ public void UnionExtendedWithDirective() public void UnionWithExtendedTypes() { var result = ParseDocument("extend union Feed = Photo | Video"); - var expected = SyntaxFactory.Document(new UnionTypeExtensionSyntax(SyntaxFactory.Name("Feed"), null, new[] - { - SyntaxFactory.NamedType(SyntaxFactory.Name("Photo")), - SyntaxFactory.NamedType(SyntaxFactory.Name("Video")) - })); + var expected = SyntaxFactory.Document(new UnionTypeExtensionSyntax(SyntaxFactory.Name("Feed"), null, + new[] + { + SyntaxFactory.NamedType(SyntaxFactory.Name("Photo")), + SyntaxFactory.NamedType(SyntaxFactory.Name("Video")) + })); Assert.Equal(expected, result); Assert.Equal(expected, PrintAndParse(result)); } diff --git a/test/GraphZen.Tests/LanguageModel/ParserTestBase.cs b/test/GraphZen.Tests/LanguageModel/ParserTestBase.cs index 54a708462..566ccaea7 100644 --- a/test/GraphZen.Tests/LanguageModel/ParserTestBase.cs +++ b/test/GraphZen.Tests/LanguageModel/ParserTestBase.cs @@ -29,10 +29,7 @@ protected void AssertSyntaxError(string document, string expectedMessage, params (int line, int column)[] locations) { var ex = Assert.Throws(() => ParseDocument(document)); - JsonAssert.EquivalentToJsonFromObject(ex.GraphQLError, new - { - message = expectedMessage, - locations = locations.Select(l => new { l.line, l.column }) - }); + JsonAssert.EquivalentToJsonFromObject(ex.GraphQLError, + new { message = expectedMessage, locations = locations.Select(l => new { l.line, l.column }) }); } } diff --git a/test/GraphZen.Tests/QueryEngine/AbstractTests.cs b/test/GraphZen.Tests/QueryEngine/AbstractTests.cs index 2efa820b3..389279cb5 100644 --- a/test/GraphZen.Tests/QueryEngine/AbstractTests.cs +++ b/test/GraphZen.Tests/QueryEngine/AbstractTests.cs @@ -47,11 +47,11 @@ public Task IsTypeOfUsedToResolveRuntimeTypeForInterface() .Field("meows", "Boolean"); sb.Object("Query") - .Field("pets", "[Pet]", _ => _.Resolve(() => new object[] - { - new Dog { Name = "Odie", Woofs = true }, - new Cat { Name = "Garfield", Meows = false } - })); + .Field("pets", "[Pet]", + _ => _.Resolve(() => new object[] + { + new Dog { Name = "Odie", Woofs = true }, new Cat { Name = "Garfield", Meows = false } + })); }); var query = @" @@ -72,16 +72,7 @@ ... on Cat { { pets = new object[] { - new - { - name = "Odie", - woofs = true - }, - new - { - name = "Garfield", - meows = false - } + new { name = "Odie", woofs = true }, new { name = "Garfield", meows = false } } } }); @@ -121,12 +112,12 @@ public Task ResolveTypeOnInterfaceYielsUsefulError() .Field("meows", "Boolean"); sb.Object("Query") - .Field("pets", "[Pet]", _ => _.Resolve(() => new object[] - { - new Dog { Name = "Odie", Woofs = true }, - new Cat { Name = "Garfield", Meows = false }, - new Human { Name = "Jon" } - })); + .Field("pets", "[Pet]", + _ => _.Resolve(() => new object[] + { + new Dog { Name = "Odie", Woofs = true }, new Cat { Name = "Garfield", Meows = false }, + new Human { Name = "Jon" } + })); }); var query = @" { @@ -147,17 +138,7 @@ ... on Cat { { pets = new object[] { - new - { - name = "Odie", - woofs = true - }, - new - { - name = "Garfield", - meows = false - }, - null! + new { name = "Odie", woofs = true }, new { name = "Garfield", meows = false }, null! } }, errors = new object[] @@ -207,12 +188,12 @@ public Task ResolveTypeOnUnionYieldsUsefulError() sb.Object("Query") - .Field("pets", "[Pet]", _ => _.Resolve(() => new object[] - { - new Dog { Name = "Odie", Woofs = true }, - new Cat { Name = "Garfield", Meows = false }, - new Human { Name = "Jon" } - })); + .Field("pets", "[Pet]", + _ => _.Resolve(() => new object[] + { + new Dog { Name = "Odie", Woofs = true }, new Cat { Name = "Garfield", Meows = false }, + new Human { Name = "Jon" } + })); }); var query = @" { @@ -233,17 +214,7 @@ ... on Cat { { pets = new object[] { - new - { - name = "Odie", - woofs = true - }, - new - { - name = "Garfield", - meows = false - }, - null! + new { name = "Odie", woofs = true }, new { name = "Garfield", meows = false }, null! } }, errors = new object[] @@ -285,14 +256,7 @@ public Task ReturningInvalidValueFromResolveTypeYieldsUsefulError() { message = "Abstract type FooInterface must resolve to an Object type at runtime for field Query.foo with value \"dummy\", received \"null\". Either the FooInterface type should provide a \"resolveType\" function or each possible types should provide an \"IsTypeOf\" function.", - locations = new object[] - { - new - { - line = 1, - column = 3 - } - }, + locations = new object[] { new { line = 1, column = 3 } }, path = new object[] { "foo" } } } @@ -331,8 +295,7 @@ public Task ResolveTypeAllowsResolvingWithTypeName() .Field("pets", "[Pet]", _ => _.Resolve(() => new object[] { - new Dog { Name = "Odie", Woofs = true }, - new Cat { Name = "Garfield", Meows = false } + new Dog { Name = "Odie", Woofs = true }, new Cat { Name = "Garfield", Meows = false } })); }); @@ -355,16 +318,7 @@ ... on Cat { { pets = new object[] { - new - { - name = "Odie", - woofs = true - }, - new - { - name = "Garfield", - meows = false - } + new { name = "Odie", woofs = true }, new { name = "Garfield", meows = false } } } }); diff --git a/test/GraphZen.Tests/QueryEngine/ExecutorHarness.cs b/test/GraphZen.Tests/QueryEngine/ExecutorHarness.cs index 1d3b11973..ede1c0819 100644 --- a/test/GraphZen.Tests/QueryEngine/ExecutorHarness.cs +++ b/test/GraphZen.Tests/QueryEngine/ExecutorHarness.cs @@ -28,9 +28,6 @@ public Task ExecuteAsync(Schema schema, string doc, object? roo var vars = variables != null ? TestHelpers.ToDictionary(variables) : null; var ast = doc != null ? Parser.ParseDocument(doc) : null; return Executor.ExecuteAsync(schema, ast!, rootValue, null, vars, - operationName, new ExecutionOptions - { - ThrowOnError = throwOnError - }); + operationName, new ExecutionOptions { ThrowOnError = throwOnError }); } } diff --git a/test/GraphZen.Tests/QueryEngine/ExecutorTests.cs b/test/GraphZen.Tests/QueryEngine/ExecutorTests.cs index d620c3f54..ff49ad941 100644 --- a/test/GraphZen.Tests/QueryEngine/ExecutorTests.cs +++ b/test/GraphZen.Tests/QueryEngine/ExecutorTests.cs @@ -25,13 +25,7 @@ public Task AcceptsAnObjectWithNamedPropertiesAsArguments() sb.QueryType("Type"); }); - return ExecuteAsync(schema, doc, data).ShouldEqual(new - { - data = new - { - a = "rootValue" - } - }); + return ExecuteAsync(schema, doc, data).ShouldEqual(new { data = new { a = "rootValue" } }); } @@ -138,11 +132,9 @@ fragment c on DataType { b = "Boring", c = new object[] { "Contrived", null!, "Confusing" }, deeper = new object[] - { - new { a = "Apple", b = "Banana" }, - null!, - new { a = "Apple", b = "Banana" } - } + { + new { a = "Apple", b = "Banana" }, null!, new { a = "Apple", b = "Banana" } + } } } }; @@ -205,16 +197,7 @@ await ExecuteAsync(schema, doc).ShouldEqual(new a = "Apple", b = "Banana", c = "Cherry", - deep = new - { - b = "Banana", - c = "Cherry", - deeper = new - { - b = "Banana", - c = "Cherry" - } - } + deep = new { b = "Banana", c = "Cherry", deeper = new { b = "Banana", c = "Cherry" } } } }); } @@ -344,13 +327,7 @@ fragment Frag on Type { _.QueryType("Type"); }); - await ExecuteAsync(schema, doc, data).ShouldEqual(new - { - data = new - { - a = "b" - } - }); + await ExecuteAsync(schema, doc, data).ShouldEqual(new { data = new { a = "b" } }); } [Fact] @@ -392,10 +369,7 @@ public Task DoesNotIncludeArgumentsThatWereNotSet() return ExecuteAsync(schema, "{ field(a: true, c: false, e: 0) }").ShouldEqual(new { - data = new - { - field = "{\"a\":true,\"c\":false,\"e\":0}" - } + data = new { field = "{\"a\":true,\"c\":false,\"e\":0}" } }); } @@ -432,23 +406,14 @@ public Task FailsWhenIsTypeOfCheckIsNotMet() return ExecuteAsync(schema, "{specials { value } }", rootValue).ShouldEqual(new { - data = new - { - specials = new object[] { new { value = "foo" }, null! } - }, + data = new { specials = new object[] { new { value = "foo" }, null! } }, errors = new object[] { new { message = "Expected value of type \"SpecialType\" but got: {value: \"bar\"}.", - locations = new object[] - { - new { line = 1, column = 2 } - }, - path = new object[] - { - "specials", 1 - } + locations = new object[] { new { line = 1, column = 2 } }, + path = new object[] { "specials", 1 } } } }); @@ -464,13 +429,7 @@ public Task ExecutesIgnoringInvalidNonExecutableDefinitions() "; var schema = Schema.Create(_ => { _.Object("Query").Field("foo", "String"); }); - return ExecuteAsync(schema, query, throwOnError: true).ShouldEqual(new - { - data = new - { - foo = (object?)null - } - }); + return ExecuteAsync(schema, query, throwOnError: true).ShouldEqual(new { data = new { foo = (object?)null } }); } [Fact(Skip = "TODO")] diff --git a/test/GraphZen.Tests/QueryEngine/MutationsTests.cs b/test/GraphZen.Tests/QueryEngine/MutationsTests.cs index 088a0ace6..cd290de9c 100644 --- a/test/GraphZen.Tests/QueryEngine/MutationsTests.cs +++ b/test/GraphZen.Tests/QueryEngine/MutationsTests.cs @@ -138,19 +138,13 @@ mutation M { new { message = "Cannot change the number", - locations = new object[] - { - new { line = 9, column = 15 } - }, + locations = new object[] { new { line = 9, column = 15 } }, path = new object[] { "third" } }, new { message = "Cannot change the number", - locations = new object[] - { - new { line = 18, column = 15 } - }, + locations = new object[] { new { line = 18, column = 15 } }, path = new object[] { "sixth" } } } diff --git a/test/GraphZen.Tests/QueryEngine/UnionInterfaceTests.cs b/test/GraphZen.Tests/QueryEngine/UnionInterfaceTests.cs index e0d6a6edc..0917d0ac1 100644 --- a/test/GraphZen.Tests/QueryEngine/UnionInterfaceTests.cs +++ b/test/GraphZen.Tests/QueryEngine/UnionInterfaceTests.cs @@ -115,12 +115,11 @@ public Task ItCanIntrospectOnUnionAndIntersectionTypes() name = "Named", fields = new object[] { new { name = "name" } }, interfaces = (object?)null, - possibleTypes = new object[] - { - new { name = "Cat" }, - new { name = "Dog" }, - new { name = "Person" } - }, + possibleTypes = + new object[] + { + new { name = "Cat" }, new { name = "Dog" }, new { name = "Person" } + }, enumValues = (object?)null, inputFields = (object?)null }, @@ -129,13 +128,8 @@ public Task ItCanIntrospectOnUnionAndIntersectionTypes() kind = "UNION", name = "Pet", fields = (object?)null, - interfaces = (object?)null, - possibleTypes = new object[] - { - new { name = "Dog" }, - new { name = "Cat" } - }, + possibleTypes = new object[] { new { name = "Dog" }, new { name = "Cat" } }, enumValues = (object?)null, inputFields = (object?)null } @@ -371,14 +365,7 @@ public async Task GetsExecutionInfoInResolver() var ast = Parser.ParseDocument("{ name, friends { name } }"); await Executor.ExecuteAsync(schema, ast, john, cxt).ShouldEqual(new { - data = new - { - name = "John", - friends = new object[] - { - new { name = "Liz" } - } - } + data = new { name = "John", friends = new object[] { new { name = "Liz" } } } }); Assert.Equal(cxt, encounteredContext); diff --git a/test/GraphZen.Tests/QueryEngine/Variables/ArgumentDefaultValuesTests.cs b/test/GraphZen.Tests/QueryEngine/Variables/ArgumentDefaultValuesTests.cs index 952504fb9..5def8e37b 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/ArgumentDefaultValuesTests.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/ArgumentDefaultValuesTests.cs @@ -15,18 +15,11 @@ public Task NotWhenArugmentCannotBeCoerced() => } ").ShouldEqual(new { - data = new - { - fieldWithDefaultArgumentValue = (object?)null - }, + data = new { fieldWithDefaultArgumentValue = (object?)null }, errors = Array(new { message = "Argument \"input\" has invalid value \"WRONG_TYPE\".", - locations = Array(new - { - column = 17, - line = 3 - }), + locations = Array(new { column = 17, line = 3 }), path = Array("fieldWithDefaultArgumentValue") }) }); @@ -34,13 +27,7 @@ public Task NotWhenArugmentCannotBeCoerced() => [Fact] public Task WhenNoArgumentProvided() => ExecuteAsync("{fieldWithDefaultArgumentValue}") - .ShouldEqual(new - { - data = new - { - fieldWithDefaultArgumentValue = "\"Hello World\"" - } - }); + .ShouldEqual(new { data = new { fieldWithDefaultArgumentValue = "\"Hello World\"" } }); [Fact] public Task WhenNoRuntimeValueIsProvidedToANonNullArgument() => @@ -50,10 +37,7 @@ query optionalVariable($optional: String) { } ").ShouldEqual(new { - data = new - { - fieldWithNonNullableStringInputAndDefaultArgumentValue = "\"Hello World\"" - } + data = new { fieldWithNonNullableStringInputAndDefaultArgumentValue = "\"Hello World\"" } }); [Fact] @@ -62,13 +46,7 @@ public Task WhenOmittedVariableProvided() => query ($optional: String) { fieldWithDefaultArgumentValue(input: $optional) } - ").ShouldEqual(new - { - data = new - { - fieldWithDefaultArgumentValue = "\"Hello World\"" - } - }); + ").ShouldEqual(new { data = new { fieldWithDefaultArgumentValue = "\"Hello World\"" } }); [UsedImplicitly] private class StaticDslTests : ArgumentDefaultValuesTests diff --git a/test/GraphZen.Tests/QueryEngine/Variables/CustomEnumValuesTests.cs b/test/GraphZen.Tests/QueryEngine/Variables/CustomEnumValuesTests.cs index 19ec1960b..2803d3d61 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/CustomEnumValuesTests.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/CustomEnumValuesTests.cs @@ -33,13 +33,7 @@ public Task AllowsNonNullableInputsToHaveNullAsCustomEnumValue() => ExecuteAsync(@" { fieldWithNonNullableEnumInput(input: NULL) - }").ShouldEqual(new - { - data = new - { - fieldWithNonNullableEnumInput = "null" - } - }); + }").ShouldEqual(new { data = new { fieldWithNonNullableEnumInput = "null" } }); [UsedImplicitly] private class StaticDslTests : CustomEnumValuesTests diff --git a/test/GraphZen.Tests/QueryEngine/Variables/ListsAndNullabilityTests.cs b/test/GraphZen.Tests/QueryEngine/Variables/ListsAndNullabilityTests.cs index 612ef01f5..bbc170700 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/ListsAndNullabilityTests.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/ListsAndNullabilityTests.cs @@ -14,10 +14,7 @@ public Task AllowsListsOfNonNullsToBeNull() => listNN(input: $input) } ", new { input = (object?)null }).ShouldEqual( - new - { - data = new { listNN = "null" } - }); + new { data = new { listNN = "null" } }); [Fact] public Task AllowsListsOfNonNullsToContainValues() => @@ -26,10 +23,7 @@ public Task AllowsListsOfNonNullsToContainValues() => listNN(input: $input) } ", new { input = Array("A") }).ShouldEqual( - new - { - data = new { listNN = "[\"A\"]" } - }); + new { data = new { listNN = "[\"A\"]" } }); [Fact] public Task AllowsListsToBeNull() => @@ -37,13 +31,7 @@ public Task AllowsListsToBeNull() => query ($input: [String]) { list(input: $input) } - ", new { input = (object?)null }).ShouldEqual(new - { - data = new - { - list = "null" - } - }); + ", new { input = (object?)null }).ShouldEqual(new { data = new { list = "null" } }); [Fact] public Task AllowsListsToContainNull() => @@ -51,13 +39,7 @@ public Task AllowsListsToContainNull() => query ($input: [String]) { list(input: $input) } - ", new { input = Array("A", null, "B") }).ShouldEqual(new - { - data = new - { - list = "[\"A\",null,\"B\"]" - } - }); + ", new { input = Array("A", null, "B") }).ShouldEqual(new { data = new { list = "[\"A\",null,\"B\"]" } }); [Fact] public Task AllowsListsToContainValues() => @@ -65,13 +47,7 @@ public Task AllowsListsToContainValues() => query ($input: [String]) { list(input: $input) } - ", new { input = Array("A") }).ShouldEqual(new - { - data = new - { - list = "[\"A\"]" - } - }); + ", new { input = Array("A") }).ShouldEqual(new { data = new { list = "[\"A\"]" } }); [Fact] public Task AllowsNonNullListsOfNonNullsToContainValues() => @@ -80,13 +56,7 @@ public Task AllowsNonNullListsOfNonNullsToContainValues() => nnListNN(input: $input) } ", new { input = Array("A") }).ShouldEqual( - new - { - data = new - { - nnListNN = "[\"A\"]" - } - }); + new { data = new { nnListNN = "[\"A\"]" } }); [Fact] public Task AllowsNonNullListsToContainValues() => @@ -94,13 +64,7 @@ public Task AllowsNonNullListsToContainValues() => query ($input: [String]!) { nnList(input: $input) } - ", new { input = Array("A") }).ShouldEqual(new - { - data = new - { - nnList = "[\"A\"]" - } - }); + ", new { input = Array("A") }).ShouldEqual(new { data = new { nnList = "[\"A\"]" } }); [Fact] public Task DoesNotAllowInvalidTypesToBeUsedAsValues() => @@ -114,11 +78,7 @@ public Task DoesNotAllowInvalidTypesToBeUsedAsValues() => { message = "Variable \"$input\" expected value of type \"TestType!\" which cannot be used as an input type.", - locations = Array(new - { - line = 2, - column = 30 - }) + locations = Array(new { line = 2, column = 30 }) }) }); @@ -135,11 +95,7 @@ public Task DoesNotAllowListsOfNonNullsToContainNull() => { message = "Variable \"$input\" got invalid value `[\"A\", null, \"B\"]`; Expected non-nullable type String! not to be null at value[1].", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -155,11 +111,7 @@ public Task DoesNotAllowNonNullListsOfNonNullsToBeNull() => errors = Array(new { message = "Variable \"$input\" of non-null type \"[String!]!\" must not be null.", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -174,11 +126,7 @@ public Task DoesNotAllowNonNullListsToBeNull() => errors = Array(new { message = "Variable \"$input\" of non-null type \"[String]!\" must not be null.", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -195,11 +143,7 @@ public Task DoesNotAllowsNonNullListsOfNonNullsToContainNull() => { message = "Variable \"$input\" got invalid value `[\"A\", null, \"B\"]`; Expected non-nullable type String! not to be null at value[1].", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -215,11 +159,7 @@ public Task DoesNotAllowUnknownTypesToBeUsedAsValues() => { message = "Variable \"$input\" expected value of type \"UnknownType!\" which cannot be used as an input type.", - locations = Array(new - { - line = 2, - column = 30 - }) + locations = Array(new { line = 2, column = 30 }) }) }); @@ -229,13 +169,7 @@ public Task ItAllowsNonNullListsToContainNull() => query ($input: [String]!) { nnList(input: $input) } - ", new { input = Array("A", null, "B") }).ShouldEqual(new - { - data = new - { - nnList = "[\"A\",null,\"B\"]" - } - }); + ", new { input = Array("A", null, "B") }).ShouldEqual(new { data = new { nnList = "[\"A\",null,\"B\"]" } }); [UsedImplicitly] private class StaticDslTests : ListsAndNullabilityTests diff --git a/test/GraphZen.Tests/QueryEngine/Variables/NonNullableScalarsTests.cs b/test/GraphZen.Tests/QueryEngine/Variables/NonNullableScalarsTests.cs index 71d597317..9b0223216 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/NonNullableScalarsTests.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/NonNullableScalarsTests.cs @@ -13,10 +13,7 @@ public Task AllowsNonNullableInputsToBeOmittedGivenADefault() => query ($value: String = ""default"") { fieldWithNonNullableStringInput(input: $value) } - ").ShouldEqual(new - { - data = new { fieldWithNonNullableStringInput = "\"default\"" } - }); + ").ShouldEqual(new { data = new { fieldWithNonNullableStringInput = "\"default\"" } }); [Fact] public Task AllowsNonNullableInputsToBeSetToAValueDirectly() => @@ -24,13 +21,7 @@ public Task AllowsNonNullableInputsToBeSetToAValueDirectly() => { fieldWithNonNullableStringInput(input: ""a"") } - ").ShouldEqual(new - { - data = new - { - fieldWithNonNullableStringInput = "\"a\"" - } - }); + ").ShouldEqual(new { data = new { fieldWithNonNullableStringInput = "\"a\"" } }); [Fact] public Task AllowsNonNullableInputsToBeSetToAValueInAVariable() => @@ -38,13 +29,7 @@ public Task AllowsNonNullableInputsToBeSetToAValueInAVariable() => query ($value: String!) { fieldWithNonNullableStringInput(input: $value) } - ", new { value = "a" }).ShouldEqual(new - { - data = new - { - fieldWithNonNullableStringInput = "\"a\"" - } - }); + ", new { value = "a" }).ShouldEqual(new { data = new { fieldWithNonNullableStringInput = "\"a\"" } }); [Fact] public Task DoesNotAllowNonNullableInputsToBeOmittedInAVariable() => @@ -57,11 +42,7 @@ public Task DoesNotAllowNonNullableInputsToBeOmittedInAVariable() => errors = Array(new { message = "Variable \"$value\" of required type \"String!\" was not provided.", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -76,11 +57,7 @@ public Task DoesNotAllowNonNullableInputsToBeSetToNullInAVairable() => errors = Array(new { message = "Variable \"$value\" of non-null type \"String!\" must not be null.", - locations = Array(new - { - line = 2, - column = 22 - }) + locations = Array(new { line = 2, column = 22 }) }) }); @@ -108,18 +85,11 @@ public async Task ReportsErrorForArrayPassedIntoStringInput() public Task ReportsErrorForMissingNonNullabeInputs() => ExecuteAsync("{ fieldWithNonNullableStringInput }").ShouldEqual(new { - data = new - { - fieldWithNonNullableStringInput = (object?)null - }, + data = new { fieldWithNonNullableStringInput = (object?)null }, errors = Array(new { message = "Argument \"input\" of required type \"String!\" was not provided.", - locations = Array(new - { - line = 1, - column = 3 - }), + locations = Array(new { line = 1, column = 3 }), path = Array("fieldWithNonNullableStringInput") }) }); @@ -132,19 +102,12 @@ public Task ReportsErrorForNonProvidedVariablesForNonNullableInputs() => } ").ShouldEqual(new { - data = new - { - fieldWithNonNullableStringInput = (object?)null - }, + data = new { fieldWithNonNullableStringInput = (object?)null }, errors = Array(new { message = "Argument \"input\" of required type \"String!\" was provided the variable \"$foo\" which was not provided a runtime value.", - locations = Array(new - { - line = 3, - column = 56 - }), + locations = Array(new { line = 3, column = 56 }), path = Array("fieldWithNonNullableStringInput") }) }); diff --git a/test/GraphZen.Tests/QueryEngine/Variables/NullableScalarsTests.cs b/test/GraphZen.Tests/QueryEngine/Variables/NullableScalarsTests.cs index 83eeb1524..634a73ed6 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/NullableScalarsTests.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/NullableScalarsTests.cs @@ -13,13 +13,7 @@ public Task AllowsNullableInputsToBeOmitted() => { fieldWithNullableStringInput } - ").ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = (string?)null - } - }); + ").ShouldEqual(new { data = new { fieldWithNullableStringInput = (string?)null } }); [Fact] public Task AllowsNullableInputsToBeOmittedInAnUnlistedVariable() => @@ -27,13 +21,7 @@ public Task AllowsNullableInputsToBeOmittedInAnUnlistedVariable() => query { fieldWithNullableStringInput(input: $value) } - ").ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = (string?)null - } - }); + ").ShouldEqual(new { data = new { fieldWithNullableStringInput = (string?)null } }); [Fact] public Task AllowsNullableInputsToBeOmittedInAVariable() => @@ -41,13 +29,7 @@ public Task AllowsNullableInputsToBeOmittedInAVariable() => query ($value: String) { fieldWithNullableStringInput(input: $value) } - ").ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = (string?)null - } - }); + ").ShouldEqual(new { data = new { fieldWithNullableStringInput = (string?)null } }); [Fact] public Task AllowsNullableInputsToBeSetInAVariable() => @@ -55,13 +37,7 @@ public Task AllowsNullableInputsToBeSetInAVariable() => query ($value: String) { fieldWithNullableStringInput(input: $value) } - ", new { value = "a" }).ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "\"a\"" - } - }); + ", new { value = "a" }).ShouldEqual(new { data = new { fieldWithNullableStringInput = "\"a\"" } }); [Fact] public Task AllowsNullableInputsToBeSetToNullInAVariable() => @@ -69,13 +45,7 @@ public Task AllowsNullableInputsToBeSetToNullInAVariable() => query ($value: String) { fieldWithNullableStringInput(input: $value) } - ", new { value = (string?)null }).ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "null" - } - }); + ", new { value = (string?)null }).ShouldEqual(new { data = new { fieldWithNullableStringInput = "null" } }); [Fact] public Task AllowsNullableInputsToBeSetToValueDirectly() => @@ -83,13 +53,7 @@ public Task AllowsNullableInputsToBeSetToValueDirectly() => { fieldWithNullableStringInput(input: ""a"") } - ", new { value = "a" }).ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "\"a\"" - } - }); + ", new { value = "a" }).ShouldEqual(new { data = new { fieldWithNullableStringInput = "\"a\"" } }); [UsedImplicitly] private class StaticDslTests : NullableScalarsTests diff --git a/test/GraphZen.Tests/QueryEngine/Variables/UsingInlineStructs.cs b/test/GraphZen.Tests/QueryEngine/Variables/UsingInlineStructs.cs index 5e4c8950e..2fd942e41 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/UsingInlineStructs.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/UsingInlineStructs.cs @@ -16,10 +16,7 @@ public Task DoesNotUseIncorrectValue() } ").ShouldEqual(new { - data = new - { - fieldWithObjectInput = (object?)null - }, + data = new { fieldWithObjectInput = (object?)null }, errors = new object[] { new @@ -39,13 +36,7 @@ public Task ExecutesWithComplextInput() => fieldWithObjectInput(input: { a: ""foo"", b: [""bar""], c: ""baz""}) } ").ShouldEqual( - new - { - data = new - { - fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" - } - } + new { data = new { fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" } } ); [Fact] @@ -55,13 +46,7 @@ public Task ProperlyParsesNullValueInList() => fieldWithObjectInput(input: {b: [""A"",null,""C""], c: ""C""}) } ") - .ShouldEqual(new - { - data = new - { - fieldWithObjectInput = @"{""b"":[""A"",null,""C""],""c"":""C""}" - } - }); + .ShouldEqual(new { data = new { fieldWithObjectInput = @"{""b"":[""A"",null,""C""],""c"":""C""}" } }); [Fact] public Task ProperlyParsesNullValueToNull() => @@ -70,13 +55,7 @@ public Task ProperlyParsesNullValueToNull() => fieldWithObjectInput(input: {a: null, b: null, c: ""C"", d: null}) } ").ShouldEqual( - new - { - data = new - { - fieldWithObjectInput = @"{""a"":null,""b"":null,""c"":""C"",""d"":null}" - } - }); + new { data = new { fieldWithObjectInput = @"{""a"":null,""b"":null,""c"":""C"",""d"":null}" } }); [Fact] public Task ProperlyParsesSingleValueToList() => @@ -85,13 +64,7 @@ public Task ProperlyParsesSingleValueToList() => fieldWithObjectInput(input: {a: ""foo"", b: ""bar"", c: ""baz""}) } ").ShouldEqual( - new - { - data = new - { - fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" - } - } + new { data = new { fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" } } ); [Fact] @@ -100,13 +73,7 @@ public Task ProperlyRunsParseLiteralOnComplexScalarTypes() => { fieldWithObjectInput(input: {c: ""foo"", d: ""SerializedValue""}) }") - .ShouldEqual(new - { - data = new - { - fieldWithObjectInput = @"{""c"":""foo"",""d"":""DeserializedValue""}" - } - }); + .ShouldEqual(new { data = new { fieldWithObjectInput = @"{""c"":""foo"",""d"":""DeserializedValue""}" } }); [UsedImplicitly] private class StaticDslTests : UsingInlineStructs diff --git a/test/GraphZen.Tests/QueryEngine/Variables/UsingVariables.cs b/test/GraphZen.Tests/QueryEngine/Variables/UsingVariables.cs index 4ad6153c8..f36cd9c8e 100644 --- a/test/GraphZen.Tests/QueryEngine/Variables/UsingVariables.cs +++ b/test/GraphZen.Tests/QueryEngine/Variables/UsingVariables.cs @@ -22,11 +22,7 @@ public Task ErrorsOnAdditionOfUnkownInputField() => { message = "Variable \"$input\" got invalid value `{a: \"foo\", b: \"bar\", c: \"baz\", extra: \"dog\"}`; Field \"extra\" is not defined by type TestInputObject; Did you mean to select another field?", - locations = Array(new - { - line = 2, - column = 25 - }) + locations = Array(new { line = 2, column = 25 }) }) }); @@ -35,68 +31,39 @@ public Task ErrorsOnDeepNestedErrorsAndWithmanyErrors() => ExecuteAsync(@" query ($input: TestNestedInputObject) { fieldWithNestedObjectInput(input: $input) - }", new - { - input = new - { - na = new { a = "foo" } - } - }) + }", new { input = new { na = new { a = "foo" } } }) .ShouldEqual(new { errors = Array(new { message = "Variable \"$input\" got invalid value `{na: {a: \"foo\"}}`; Field value.nb of required type String! was not provided.", - locations = Array(new - { - line = 2, - column = 20 - }) + locations = Array(new { line = 2, column = 20 }) }, new { message = "Variable \"$input\" got invalid value `{na: {a: \"foo\"}}`; Field value.na.c of required type String! was not provided.", - locations = Array(new - { - line = 2, - column = 20 - }) + locations = Array(new { line = 2, column = 20 }) } ) }); [Fact] public Task ErrorsOnIncorrectType() => - ExecuteAsync(Doc, new - { - input = "foo bar" - }).ShouldEqual(new + ExecuteAsync(Doc, new { input = "foo bar" }).ShouldEqual(new { errors = Array(new { message = "Variable \"$input\" got invalid value `\"foo bar\"`; Expected TestInputObject to be an object.", - locations = Array(new - { - line = 2, - column = 25 - }) + locations = Array(new { line = 2, column = 25 }) }) }); [Fact] public Task ErrorsOnNullForNestedNonNull() => - ExecuteAsync(Doc, new - { - input = new - { - a = "foo", - b = "bar", - c = (string?)null - } - }).ShouldEqual(new + ExecuteAsync(Doc, new { input = new { a = "foo", b = "bar", c = (string?)null } }).ShouldEqual(new { errors = Array( new @@ -116,11 +83,7 @@ public Task ErrorsOnOmissionOfNestedNonNull() => { message = "Variable \"$input\" got invalid value `{a: \"foo\", b: \"bar\"}`; Field value.c of required type String! was not provided.", - locations = Array(new - { - line = 2, - column = 25 - }) + locations = Array(new { line = 2, column = 25 }) }) }); @@ -130,46 +93,20 @@ public Task ItDoesNotUseDefaultValueWhenProvided() => query q($input: String = ""Default value"") { fieldWithNullableStringInput(input: $input) } - ", new - { - input = "Variable value" - }) - .ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "\"Variable value\"" - } - }); + ", new { input = "Variable value" }) + .ShouldEqual(new { data = new { fieldWithNullableStringInput = "\"Variable value\"" } }); [Fact] public Task ItExecutesWithComplexInput() => ExecuteAsync(Doc, - new - { - input = new - { - a = "foo", - b = Array("bar"), - c = "baz" - } - } - ).ShouldEqual(new - { - data = new - { - fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" - } - }); + new { input = new { a = "foo", b = Array("bar"), c = "baz" } } + ).ShouldEqual(new { data = new { fieldWithObjectInput = @"{""a"":""foo"",""b"":[""bar""],""c"":""baz""}" } }); [Fact] public Task ItExecutesWithComplexScalarInput() => ExecuteAsync(Doc, new { input = new { c = "foo", d = "SerializedValue" } }).ShouldEqual(new { - data = new - { - fieldWithObjectInput = "{\"c\":\"foo\",\"d\":\"DeserializedValue\"}" - } + data = new { fieldWithObjectInput = "{\"c\":\"foo\",\"d\":\"DeserializedValue\"}" } }); [Fact] @@ -178,13 +115,7 @@ public Task ItUsesDefaultValueWhenNotProvided() => query ($input: TestInputObject = {a: ""foo"", b: [""bar""], c: ""baz""}) { fieldWithObjectInput(input: $input) }") - .ShouldEqual(new - { - data = new - { - fieldWithObjectInput = "{\"a\":\"foo\",\"b\":[\"bar\"],\"c\":\"baz\"}" - } - }); + .ShouldEqual(new { data = new { fieldWithObjectInput = "{\"a\":\"foo\",\"b\":[\"bar\"],\"c\":\"baz\"}" } }); [Fact] @@ -193,17 +124,8 @@ public Task ItUsesExplicitNullValueInsteadOfDefaultValue() => query q($input: String = ""Default value"") { fieldWithNullableStringInput(input: $input) } - ", new - { - input = (string?)null - }) - .ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "null" - } - }); + ", new { input = (string?)null }) + .ShouldEqual(new { data = new { fieldWithNullableStringInput = "null" } }); [Fact] public Task ItUsesNullDefaultValueWhenNotProvided() => @@ -212,13 +134,7 @@ query q($input: String = null) { fieldWithNullableStringInput(input: $input) } ") - .ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "null" - } - }); + .ShouldEqual(new { data = new { fieldWithNullableStringInput = "null" } }); [Fact] public Task ItUsesNullWhenVariableProvidedExplicitNullValue() => @@ -226,13 +142,7 @@ public Task ItUsesNullWhenVariableProvidedExplicitNullValue() => query q($input: String) { fieldWithNullableStringInput(input: $input) }", new { input = (string?)null }) - .ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = "null" - } - }); + .ShouldEqual(new { data = new { fieldWithNullableStringInput = "null" } }); [Fact] public Task ItUsesUndefinedWhenVariableNotProvided() => @@ -240,24 +150,12 @@ public Task ItUsesUndefinedWhenVariableNotProvided() => query q($input: String) { fieldWithNullableStringInput(input: $input) }", new { }) - .ShouldEqual(new - { - data = new - { - fieldWithNullableStringInput = (string?)null - } - }); + .ShouldEqual(new { data = new { fieldWithNullableStringInput = (string?)null } }); [Fact] public Task ProperlyParsesSingleValueToList() => ExecuteAsync(Doc, new { input = new { a = "foo", b = "bar", c = "baz" } }) - .ShouldEqual(new - { - data = new - { - fieldWithObjectInput = "{\"a\":\"foo\",\"b\":[\"bar\"],\"c\":\"baz\"}" - } - }); + .ShouldEqual(new { data = new { fieldWithObjectInput = "{\"a\":\"foo\",\"b\":[\"bar\"],\"c\":\"baz\"}" } }); [UsedImplicitly] private class StaticDslTests : UsingVariables diff --git a/test/GraphZen.Tests/StarWars/StarWarsIntrospectionTest.cs b/test/GraphZen.Tests/StarWars/StarWarsIntrospectionTest.cs index 4ad561be6..fb401f0c8 100644 --- a/test/GraphZen.Tests/StarWars/StarWarsIntrospectionTest.cs +++ b/test/GraphZen.Tests/StarWars/StarWarsIntrospectionTest.cs @@ -21,39 +21,27 @@ query IntrospectionTypeQuery { } } - ").ShouldEqual(new - { - data = new + ").ShouldEqual( + new { - __schema = new + data = new { - types = new object[] + __schema = new { - new { name = "Query" }, - new { name = "Episode" }, - new { name = "Character" }, - new { name = "String" }, - new { name = "Human" }, - new { name = "Droid" }, - new { name = "__Schema" }, - new { name = "__Type" }, - new { name = "__TypeKind" }, - new { name = "Boolean" }, - new { name = "Float" }, - new { name = "ID" }, - new { name = "Int" }, - new { name = "__Field" }, - new { name = "__InputValue" }, - new { name = "__EnumValue" }, - new { name = "__Directive" }, - new { name = "__DirectiveLocation" } + types = new object[] + { + new { name = "Query" }, new { name = "Episode" }, + new { name = "Character" }, new { name = "String" }, new { name = "Human" }, + new { name = "Droid" }, new { name = "__Schema" }, new { name = "__Type" }, + new { name = "__TypeKind" }, new { name = "Boolean" }, + new { name = "Float" }, new { name = "ID" }, new { name = "Int" }, + new { name = "__Field" }, new { name = "__InputValue" }, + new { name = "__EnumValue" }, new { name = "__Directive" }, + new { name = "__DirectiveLocation" } + } } } - } - }, new JsonDiffOptions - { - SortBeforeCompare = true - }); + }, new JsonDiffOptions { SortBeforeCompare = true }); } [Fact] @@ -68,19 +56,7 @@ query IntrospectionQueryTypeQuery { } } - ").ShouldEqual(new - { - data = new - { - __schema = new - { - queryType = new - { - name = "Query" - } - } - } - }); + ").ShouldEqual(new { data = new { __schema = new { queryType = new { name = "Query" } } } }); [Fact] public Task AllowsQueryingTheSchemaForASpecificType() => @@ -92,16 +68,7 @@ query IntrospectionDroidTypeQuery { } } - ").ShouldEqual(new - { - data = new - { - __type = new - { - name = "Droid" - } - } - }); + ").ShouldEqual(new { data = new { __type = new { name = "Droid" } } }); [Fact] public Task AllowsQueryingTheSchemaForAnObjectKind() => @@ -114,17 +81,7 @@ query IntrospectionDroidKindQuery { } } - ").ShouldEqual(new - { - data = new - { - __type = new - { - name = "Droid", - kind = "OBJECT" - } - } - }); + ").ShouldEqual(new { data = new { __type = new { name = "Droid", kind = "OBJECT" } } }); [Fact] public Task AllowsQueryingTheSchemaForAnInterfaceKind() => @@ -137,17 +94,7 @@ query IntrospectionCharacterKindQuery { } } - ").ShouldEqual(new - { - data = new - { - __type = new - { - name = "Character", - kind = "INTERFACE" - } - } - }); + ").ShouldEqual(new { data = new { __type = new { name = "Character", kind = "INTERFACE" } } }); [Fact] public Task AllowsQueryingTheSchemaForObjectFields() @@ -176,60 +123,19 @@ query IntrospectionDroidFieldsQuery { name = "Droid", fields = new object[] { - new - { - name = "id", - type = new - { - name = (string?)null, - kind = "NON_NULL" - } - }, - new - { - name = "name", - type = new - { - name = "String", - kind = "SCALAR" - } - }, - new - { - name = "friends", - type = new - { - name = (string?)null, - kind = "LIST" - } - }, - new - { - name = "appearsIn", - type = new - { - name = (string?)null, - kind = "LIST" - } - }, - + new { name = "id", type = new { name = (string?)null, kind = "NON_NULL" } }, + new { name = "name", type = new { name = "String", kind = "SCALAR" } }, + new { name = "friends", type = new { name = (string?)null, kind = "LIST" } }, + new { name = "appearsIn", type = new { name = (string?)null, kind = "LIST" } }, new { name = "secretBackstory", - type = new - { - name = "String", - kind = "SCALAR" - } + type = new { name = "String", kind = "SCALAR" } }, new { name = "primaryFunction", - type = new - { - name = "String", - kind = "SCALAR" - } + type = new { name = "String", kind = "SCALAR" } } } } @@ -271,26 +177,18 @@ query IntrospectionDroidNestedFieldsQuery { new { name = "id", - type = new - { - name = (string?)null, - kind = "NON_NULL", - ofType = new + type = + new { - name = "String", - kind = "SCALAR" + name = (string?)null, + kind = "NON_NULL", + ofType = new { name = "String", kind = "SCALAR" } } - } }, new { name = "name", - type = new - { - name = "String", - kind = "SCALAR", - ofType = (object?)null - } + type = new { name = "String", kind = "SCALAR", ofType = (object?)null } }, new { @@ -299,11 +197,7 @@ query IntrospectionDroidNestedFieldsQuery { { name = (string?)null, kind = "LIST", - ofType = new - { - name = "Character", - kind = "INTERFACE" - } + ofType = new { name = "Character", kind = "INTERFACE" } } }, new @@ -313,33 +207,18 @@ query IntrospectionDroidNestedFieldsQuery { { name = (string?)null, kind = "LIST", - ofType = new - { - name = "Episode", - kind = "ENUM" - } + ofType = new { name = "Episode", kind = "ENUM" } } }, - new { name = "secretBackstory", - type = new - { - name = "String", - kind = "SCALAR", - ofType = (object?)null - } + type = new { name = "String", kind = "SCALAR", ofType = (object?)null } }, new { name = "primaryFunction", - type = new - { - name = "String", - kind = "SCALAR", - ofType = (object?)null - } + type = new { name = "String", kind = "SCALAR", ofType = (object?)null } } } } @@ -393,12 +272,7 @@ query IntrospectionQueryTypeQuery { description = "If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.", name = "episode", - type = new - { - kind = "ENUM", - name = "Episode", - ofType = (object?)null - }, + type = new { kind = "ENUM", name = "Episode", ofType = (object?)null }, defaultValue = (object?)null } } @@ -416,11 +290,7 @@ query IntrospectionQueryTypeQuery { { kind = "NON_NULL", name = (string?)null, - ofType = new - { - kind = "SCALAR", - name = "String" - } + ofType = new { kind = "SCALAR", name = "String" } }, defaultValue = (object?)null } @@ -439,11 +309,7 @@ query IntrospectionQueryTypeQuery { { kind = "NON_NULL", name = (string?)null, - ofType = new - { - kind = "SCALAR", - name = "String" - } + ofType = new { kind = "SCALAR", name = "String" } }, defaultValue = (object?)null } @@ -453,10 +319,7 @@ query IntrospectionQueryTypeQuery { } } } - }, new JsonDiffOptions - { - SortBeforeCompare = true - }); + }, new JsonDiffOptions { SortBeforeCompare = true }); } [Fact] diff --git a/test/GraphZen.Tests/StarWars/StarWarsQueryTest.cs b/test/GraphZen.Tests/StarWars/StarWarsQueryTest.cs index 8c86079e2..ecd78dab7 100644 --- a/test/GraphZen.Tests/StarWars/StarWarsQueryTest.cs +++ b/test/GraphZen.Tests/StarWars/StarWarsQueryTest.cs @@ -10,13 +10,7 @@ public class StarWarsQueryTest : StarWarsSchemaAndData public Task CorrectlyIdentifiesR2D2AsTHeHeroOfTheStarWarsSaga() => ExecuteAsync(StarWarsSchema, "query HeroNameQuery { hero { name } }").ShouldEqual(new { - data = new - { - hero = new - { - name = "R2-D2" - } - } + data = new { hero = new { name = "R2-D2" } } }); [Fact(Skip = "Not applicable to .NET implementation")] @@ -44,8 +38,7 @@ query HeroNameAndFriendsQuery { name = "R2-D2", friends = new object[] { - new { name = "Luke Skywalker" }, - new { name = "Han Solo" }, + new { name = "Luke Skywalker" }, new { name = "Han Solo" }, new { name = "Leia Organa" } } } @@ -82,13 +75,12 @@ query NestedQuery { { name = "Luke Skywalker", appearsIn = new object[] { "NEW_HOPE", "EMPIRE", "JEDI" }, - friends = new object[] - { - new { name = "Han Solo" }, - new { name = "Leia Organa" }, - new { name = "C-3P0" }, - new { name = "R2-D2" } - } + friends = + new object[] + { + new { name = "Han Solo" }, new { name = "Leia Organa" }, + new { name = "C-3P0" }, new { name = "R2-D2" } + } }, new { @@ -96,8 +88,7 @@ query NestedQuery { appearsIn = new object[] { "NEW_HOPE", "EMPIRE", "JEDI" }, friends = new object[] { - new { name = "Luke Skywalker" }, - new { name = "Leia Organa" }, + new { name = "Luke Skywalker" }, new { name = "Leia Organa" }, new { name = "R2-D2" } } }, @@ -107,10 +98,8 @@ query NestedQuery { appearsIn = new object[] { "NEW_HOPE", "EMPIRE", "JEDI" }, friends = new object[] { - new { name = "Luke Skywalker" }, - new { name = "Han Solo" }, - new { name = "C-3P0" }, - new { name = "R2-D2" } + new { name = "Luke Skywalker" }, new { name = "Han Solo" }, + new { name = "C-3P0" }, new { name = "R2-D2" } } } } @@ -126,16 +115,7 @@ query FetchLukeQuery { human(id: ""1000"") { name } - }").ShouldEqual(new - { - data = new - { - human = new - { - name = "Luke Skywalker" - } - } - }); + }").ShouldEqual(new { data = new { human = new { name = "Luke Skywalker" } } }); [Theory] [InlineData("1000", "Luke Skywalker")] @@ -149,13 +129,7 @@ query FetchSomeIDQuery($someId: String!) { human(id: $someId) { name } - }", null, new { someId = id }).ShouldEqual(new - { - data = new - { - human - } - }); + }", null, new { someId = id }).ShouldEqual(new { data = new { human } }); } [Fact] @@ -165,13 +139,7 @@ query FetchLukeAliased { luke: human(id: ""1000"") { name } - }").ShouldEqual(new - { - data = new - { - luke = new { name = "Luke Skywalker" } - } - }); + }").ShouldEqual(new { data = new { luke = new { name = "Luke Skywalker" } } }); [Fact] public Task QueryForLukeAndLeiaOnRootWithAliases() => @@ -185,11 +153,7 @@ query FetchLukeAndLeiaAliased { } }").ShouldEqual(new { - data = new - { - luke = new { name = "Luke Skywalker" }, - leia = new { name = "Leia Organa" } - } + data = new { luke = new { name = "Luke Skywalker" }, leia = new { name = "Leia Organa" } } }); [Fact] @@ -247,17 +211,7 @@ query CheckTypeOfR2{ name } } - ").ShouldEqual(new - { - data = new - { - hero = new - { - __typename = "Droid", - name = "R2-D2" - } - } - }); + ").ShouldEqual(new { data = new { hero = new { __typename = "Droid", name = "R2-D2" } } }); [Fact] public Task UsingTypenameToVerifyLukeIsAHuman() => @@ -268,17 +222,7 @@ query CheckTypeOfLuke { name } } - ").ShouldEqual(new - { - data = new - { - hero = new - { - __typename = "Human", - name = "Luke Skywalker" - } - } - }); + ").ShouldEqual(new { data = new { hero = new { __typename = "Human", name = "Luke Skywalker" } } }); [Fact] public Task CorrectlyReportsErrorOnAccessingSecretBackstory() @@ -292,23 +236,13 @@ query HeroNameQuery { } ").ShouldEqual(new { - data = new - { - hero = new - { - name = "R2-D2", - secretBackstory = (string?)null - } - }, + data = new { hero = new { name = "R2-D2", secretBackstory = (string?)null } }, errors = new object[] { new { message = "secretBackstory is secret", - locations = new object[] - { - new { line = 5, column = 17 } - }, + locations = new object[] { new { line = 5, column = 17 } }, path = new object[] { "hero", "secretBackstory" } } } @@ -330,58 +264,39 @@ query HeroNameQuery { } ").ShouldEqual(new { - data = new - { - hero = new + data = + new { - name = "R2-D2", - friends = new object[] + hero = new { - new - { - name = "Luke Skywalker", - secretBackstory = (string?)null - }, - new - { - name = "Han Solo", - secretBackstory = (string?)null - }, - new - { - name = "Leia Organa", - secretBackstory = (string?)null - } + name = "R2-D2", + friends = + new object[] + { + new { name = "Luke Skywalker", secretBackstory = (string?)null }, + new { name = "Han Solo", secretBackstory = (string?)null }, + new { name = "Leia Organa", secretBackstory = (string?)null } + } } - } - }, + }, errors = new object[] { new { message = "secretBackstory is secret", - locations = new object[] - { - new { line = 7, column = 19 } - }, + locations = new object[] { new { line = 7, column = 19 } }, path = new object[] { "hero", "friends", 0, "secretBackstory" } }, new { message = "secretBackstory is secret", - locations = new object[] - { - new { line = 7, column = 19 } - }, + locations = new object[] { new { line = 7, column = 19 } }, path = new object[] { "hero", "friends", 1, "secretBackstory" } }, new { message = "secretBackstory is secret", - locations = new object[] - { - new { line = 7, column = 19 } - }, + locations = new object[] { new { line = 7, column = 19 } }, path = new object[] { "hero", "friends", 2, "secretBackstory" } } } @@ -400,23 +315,13 @@ query HeroNameQuery { } ").ShouldEqual(new { - data = new - { - mainHero = new - { - name = "R2-D2", - story = (string?)null - } - }, + data = new { mainHero = new { name = "R2-D2", story = (string?)null } }, errors = new object[] { new { message = "secretBackstory is secret", - locations = new object[] - { - new { line = 5, column = 17 } - }, + locations = new object[] { new { line = 5, column = 17 } }, path = new object[] { "mainHero", "story" } } } diff --git a/test/GraphZen.Tests/StarWars/StarWarsSchemaAndData.cs b/test/GraphZen.Tests/StarWars/StarWarsSchemaAndData.cs index 981c237c4..366d0d76b 100644 --- a/test/GraphZen.Tests/StarWars/StarWarsSchemaAndData.cs +++ b/test/GraphZen.Tests/StarWars/StarWarsSchemaAndData.cs @@ -179,8 +179,7 @@ public class Droid : ICharacter private static readonly IReadOnlyDictionary DroidData = new Dictionary { - { "2000", ThreePio }, - { "2001", Artoo } + { "2000", ThreePio }, { "2001", Artoo } }; protected static Task GetCharacterAsync(string id) => diff --git a/test/GraphZen.Tests/TypeSystem/IntrospectionTests/IntrospectionTests.cs b/test/GraphZen.Tests/TypeSystem/IntrospectionTests/IntrospectionTests.cs index a94c9deb4..7d36fbf60 100644 --- a/test/GraphZen.Tests/TypeSystem/IntrospectionTests/IntrospectionTests.cs +++ b/test/GraphZen.Tests/TypeSystem/IntrospectionTests/IntrospectionTests.cs @@ -43,12 +43,7 @@ await ExecuteAsync(schema, query, throwOnError: true) new JsonDiffOptions { SortBeforeCompare = true, - StringDiffOptions = - { - ShowExpected = false, - ShowActual = false, - ShowDiffs = true - } + StringDiffOptions = { ShowExpected = false, ShowActual = false, ShowDiffs = true } }); } } diff --git a/test/GraphZen.Tests/Utilities/AstFromValueTests.cs b/test/GraphZen.Tests/Utilities/AstFromValueTests.cs index 8bbf95716..a81dca7f4 100644 --- a/test/GraphZen.Tests/Utilities/AstFromValueTests.cs +++ b/test/GraphZen.Tests/Utilities/AstFromValueTests.cs @@ -170,20 +170,13 @@ public void ItConvertsInputObjects() { Assert.Equal(ObjectValue(ObjectField(Name("foo"), IntValue(3)), ObjectField(Name("bar"), EnumValue(Name("HELLO")))), - Get(Some(new - { - foo = 3, - bar = "HELLO" - }), MyInputObj)); + Get(Some(new { foo = 3, bar = "HELLO" }), MyInputObj)); } [Fact] public void ItConvertsInputObjectsWithExplicitNulls() { Assert.Equal(ObjectValue(ObjectField(Name("foo"), NullValue())), - Get(Some(new - { - foo = (string?)null - }), MyInputObj)); + Get(Some(new { foo = (string?)null }), MyInputObj)); } } diff --git a/test/GraphZen.Tests/Utilities/SdlSchemaConfiguratorTests.cs b/test/GraphZen.Tests/Utilities/SdlSchemaConfiguratorTests.cs index 982b42348..96db60f6b 100644 --- a/test/GraphZen.Tests/Utilities/SdlSchemaConfiguratorTests.cs +++ b/test/GraphZen.Tests/Utilities/SdlSchemaConfiguratorTests.cs @@ -22,13 +22,7 @@ type Query { } "); - return ExecuteAsync(schema, " { str } ", new { str = 123 }).ShouldEqual(new - { - data = new - { - str = "123" - } - }); + return ExecuteAsync(schema, " { str } ", new { str = 123 }).ShouldEqual(new { data = new { str = "123" } }); } @@ -41,18 +35,9 @@ type Query { } "); - var root = new - { - add = (Func)(args => args.x + args.y) - }; + var root = new { add = (Func)(args => args.x + args.y) }; - return ExecuteAsync(schema, "{ add(x: 34, y: 55) }", root).ShouldEqual(new - { - data = new - { - add = 89 - } - }); + return ExecuteAsync(schema, "{ add(x: 34, y: 55) }", root).ShouldEqual(new { data = new { add = 89 } }); } private static void ShouldRoundTrip(string sdl, StringDiffOptions? options = null) @@ -390,34 +375,12 @@ ... on Banana { { fruits = new object[] { - new - { - color = "green", - __typename = "Apple" - }, - new - { - length = 5, - __typename = "Banana" - } + new { color = "green", __typename = "Apple" }, new { length = 5, __typename = "Banana" } } }; await ExecuteAsync(schema, query, root).ShouldEqual(new { - data = new - { - fruits = new object[] - { - new - { - color = "green" - }, - new - { - length = 5 - } - } - } + data = new { fruits = new object[] { new { color = "green" }, new { length = 5 } } } }); } @@ -462,18 +425,8 @@ ... on Droid { { characters = new object[] { - new - { - name = "Han Solo", - totalCredits = 10, - __typename = "Human" - }, - new - { - name = "R2-D2", - primaryFunction = "Astromech", - __typename = "Droid" - } + new { name = "Han Solo", totalCredits = 10, __typename = "Human" }, + new { name = "R2-D2", primaryFunction = "Astromech", __typename = "Droid" } } }; @@ -483,16 +436,8 @@ await ExecuteAsync(schema, query, root).ShouldEqual(new { characters = new object[] { - new - { - name = "Han Solo", - totalCredits = 10 - }, - new - { - name = "R2-D2", - primaryFunction = "Astromech" - } + new { name = "Han Solo", totalCredits = 10 }, + new { name = "R2-D2", primaryFunction = "Astromech" } } } }); @@ -690,15 +635,7 @@ directive @test(arg: TestScalar) on FIELD var restoredSchemaAST = SyntaxFactory.Document( new ISyntaxConvertable[] { - schema, - query, - testInput, - testEnum, - testUnion, - testInterface, - testType, - testScalar, - testDirective! + schema, query, testInput, testEnum, testUnion, testInterface, testType, testScalar, testDirective! }.ToSyntaxNodes().ToArray() ); Assert.Equal(schemaAST.ToSyntaxString(), restoredSchemaAST.ToSyntaxString()); diff --git a/test/GraphZen.Tests/Validation/Rules/SdlValidationHelpers.cs b/test/GraphZen.Tests/Validation/Rules/SdlValidationHelpers.cs index ddee19d46..62a311eb9 100644 --- a/test/GraphZen.Tests/Validation/Rules/SdlValidationHelpers.cs +++ b/test/GraphZen.Tests/Validation/Rules/SdlValidationHelpers.cs @@ -5,8 +5,7 @@ namespace GraphZen.Tests.Validation.Rules; public static class SdlValidationHelpers { - public static readonly IReadOnlyList OutputTypes = new[] - { "scalar", "enum", "union", "interface", "type" }; + public static readonly IReadOnlyList OutputTypes = new[] { "scalar", "enum", "union", "interface", "type" }; public static readonly IReadOnlyList InputTypes = new[] { "scalar", "enum", "input" }; public static readonly IReadOnlyList NonInputTypes = new[] { "type", "union", "interface" }; diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Enums/Description/Enum_ViaClrEnum_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Enums/Description/Enum_ViaClrEnum_Description.cs index 75355feea..ee3e8bc89 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Enums/Description/Enum_ViaClrEnum_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Enums/Description/Enum_ViaClrEnum_Description.cs @@ -17,11 +17,7 @@ public enum ExampleEnum public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(ExampleEnum), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(ExampleEnum), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/InputObjects/Description/InputObject_ViaClrClass_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/InputObjects/Description/InputObject_ViaClrClass_Description.cs index b2cda3a58..e8d59ffb9 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/InputObjects/Description/InputObject_ViaClrClass_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/InputObjects/Description/InputObject_ViaClrClass_Description.cs @@ -13,11 +13,7 @@ public class InputObject_ViaClrClass_Description : InputObject_Description, ILea public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(ExampleInputObject), - DataAnnotationValue = DataAnnotationDescription - }; + new() { ParentName = nameof(ExampleInputObject), DataAnnotationValue = DataAnnotationDescription }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Description/Interface_ViaClrClass_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Description/Interface_ViaClrClass_Description.cs index 34efa5528..713fd2156 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Description/Interface_ViaClrClass_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Description/Interface_ViaClrClass_Description.cs @@ -12,11 +12,7 @@ public class Interface_ViaClrClass_Description : Interface_Description, ILeafCon public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(IExampleInterface), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(IExampleInterface), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Fields/Arguments/Description/Interface_Field_Argument_ViaClrMethod_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Fields/Arguments/Description/Interface_Field_Argument_ViaClrMethod_Description.cs index cdd826fd1..65be464f6 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Fields/Arguments/Description/Interface_Field_Argument_ViaClrMethod_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Interfaces/Fields/Arguments/Description/Interface_Field_Argument_ViaClrMethod_Description.cs @@ -13,11 +13,7 @@ public class Interface_Field_Argument_ViaClrMethod_Description : Interface_Field public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = "argName", - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = "argName", DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Description/Object_ViaClrClass_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Description/Object_ViaClrClass_Description.cs index 92f31a07d..4731f1b6b 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Description/Object_ViaClrClass_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Description/Object_ViaClrClass_Description.cs @@ -12,11 +12,7 @@ public class Object_ViaClrClass_Description : Object_Description, ILeafConventio public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(ExampleObject), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(ExampleObject), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Fields/Arguments/Description/Object_Field_Argument_ViaClrMethod_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Fields/Arguments/Description/Object_Field_Argument_ViaClrMethod_Description.cs index 01d086451..711f48fd4 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Fields/Arguments/Description/Object_Field_Argument_ViaClrMethod_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Objects/Fields/Arguments/Description/Object_Field_Argument_ViaClrMethod_Description.cs @@ -13,11 +13,7 @@ public class Object_Field_Argument_ViaClrMethod_Description : Object_Field_Argum public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = "argName", - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = "argName", DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Scalars/Description/Scalar_ViaClrClass_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Scalars/Description/Scalar_ViaClrClass_Description.cs index a5c8767f8..2c2f1ac9c 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Scalars/Description/Scalar_ViaClrClass_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Scalars/Description/Scalar_ViaClrClass_Description.cs @@ -12,11 +12,7 @@ public class Scalar_ViaClrClass_Description : Scalar_Description, ILeafConventio public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(ExampleScalar), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(ExampleScalar), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrClass_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrClass_Description.cs index 4ad1675db..2837b07b3 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrClass_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrClass_Description.cs @@ -12,11 +12,7 @@ public class Union_ViaClrClass_Description : Union_Description, ILeafConventionC public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(ExampleUnion), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(ExampleUnion), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrMarkerInterface_Description.cs b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrMarkerInterface_Description.cs index 62e67a842..cfb188c37 100644 --- a/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrMarkerInterface_Description.cs +++ b/test/GraphZen.TypeSystem.Tests/Configuration/Schema/Unions/Description/Union_ViaClrMarkerInterface_Description.cs @@ -12,11 +12,7 @@ public class Union_ViaClrMarkerInterface_Description : Union_Description, ILeafC public const string DataAnnotationDescriptionValue = nameof(DataAnnotationDescriptionValue); public LeafConventionContext GetContext() => - new() - { - ParentName = nameof(IExampleUnion), - DataAnnotationValue = DataAnnotationDescriptionValue - }; + new() { ParentName = nameof(IExampleUnion), DataAnnotationValue = DataAnnotationDescriptionValue }; public void ConfigureContextConventionally(SchemaBuilder sb) { diff --git a/test/GraphZen.TypeSystem.Tests/SchemaToSyntaxTests.cs b/test/GraphZen.TypeSystem.Tests/SchemaToSyntaxTests.cs index 4c147d834..696e82fb0 100644 --- a/test/GraphZen.TypeSystem.Tests/SchemaToSyntaxTests.cs +++ b/test/GraphZen.TypeSystem.Tests/SchemaToSyntaxTests.cs @@ -66,10 +66,7 @@ public void object_type_to_sytnax_node() var expected = new ObjectTypeDefinitionSyntax( Name("Object"), Description("object description") - , new[] - { - NamedType(Name("Interface")) - }, null, new[] + , new[] { NamedType(Name("Interface")) }, null, new[] { new FieldDefinitionSyntax(Name("field"), NamedType(Name("String")), @@ -95,10 +92,7 @@ public void interface_type_to_syntax_node() var objectType = Schema.GetType("Interface"); var expected = new InterfaceTypeDefinitionSyntax( Name("Interface"), - StringValue("interface description", true), new[] - { - Directive(Name("onInterface")) - }, new[] + StringValue("interface description", true), new[] { Directive(Name("onInterface")) }, new[] { new FieldDefinitionSyntax(Name("field"), NamedType(Name("String")), diff --git a/test/GraphZen.TypeSystem.Tests/TaxonomyTests.cs b/test/GraphZen.TypeSystem.Tests/TaxonomyTests.cs index bf87eeb45..fe5f76d46 100644 --- a/test/GraphZen.TypeSystem.Tests/TaxonomyTests.cs +++ b/test/GraphZen.TypeSystem.Tests/TaxonomyTests.cs @@ -14,20 +14,10 @@ public void graphql_type_references(Type type) var types = ClrTypeUtils.GetImplementedTypes(type).DumpTypes(); var expected = new[] { - typeof(EnumType), - typeof(EnumTypeDefinition), - typeof(InputObjectType), - typeof(InputObjectTypeDefinition), - typeof(InterfaceType), - typeof(InterfaceTypeDefinition), - typeof(ListType), - typeof(NonNullType), - typeof(ObjectType), - typeof(ObjectTypeDefinition), - typeof(ScalarType), - typeof(ScalarTypeDefinition), - typeof(TypeReference), - typeof(UnionType), + typeof(EnumType), typeof(EnumTypeDefinition), typeof(InputObjectType), + typeof(InputObjectTypeDefinition), typeof(InterfaceType), typeof(InterfaceTypeDefinition), + typeof(ListType), typeof(NonNullType), typeof(ObjectType), typeof(ObjectTypeDefinition), + typeof(ScalarType), typeof(ScalarTypeDefinition), typeof(TypeReference), typeof(UnionType), typeof(UnionTypeDefinition) }; @@ -41,18 +31,10 @@ public void graphql_type_definitions(Type type) var types = ClrTypeUtils.GetImplementedTypes(type).DumpTypes(); var expected = new[] { - typeof(EnumType), - typeof(EnumTypeDefinition), - typeof(InputObjectType), - typeof(InputObjectTypeDefinition), - typeof(InterfaceType), - typeof(InterfaceTypeDefinition), - typeof(ObjectType), - typeof(ObjectTypeDefinition), - typeof(ScalarType), - typeof(ScalarTypeDefinition), - typeof(UnionType), - typeof(UnionTypeDefinition) + typeof(EnumType), typeof(EnumTypeDefinition), typeof(InputObjectType), + typeof(InputObjectTypeDefinition), typeof(InterfaceType), typeof(InterfaceTypeDefinition), + typeof(ObjectType), typeof(ObjectTypeDefinition), typeof(ScalarType), typeof(ScalarTypeDefinition), + typeof(UnionType), typeof(UnionTypeDefinition) }; Assert.Equal(expected, types); @@ -65,14 +47,8 @@ public void graphql_types(Type type) var types = ClrTypeUtils.GetImplementedTypes(type).DumpTypes(); var expected = new[] { - typeof(EnumType), - typeof(InputObjectType), - typeof(InterfaceType), - typeof(ListType), - typeof(NonNullType), - typeof(ObjectType), - typeof(ScalarType), - typeof(UnionType) + typeof(EnumType), typeof(InputObjectType), typeof(InterfaceType), typeof(ListType), typeof(NonNullType), + typeof(ObjectType), typeof(ScalarType), typeof(UnionType) }; Assert.Equal(expected, types); @@ -87,12 +63,8 @@ public void graphql_named_types(Type type) var expected = new[] { - typeof(EnumType), - typeof(InputObjectType), - typeof(InterfaceType), - typeof(ObjectType), - typeof(ScalarType), - typeof(UnionType) + typeof(EnumType), typeof(InputObjectType), typeof(InterfaceType), typeof(ObjectType), + typeof(ScalarType), typeof(UnionType) }; Assert.Equal(expected, types); @@ -106,18 +78,10 @@ public void named_type_definitions(Type type) var expected = new[] { - typeof(EnumType), - typeof(EnumTypeDefinition), - typeof(InputObjectType), - typeof(InputObjectTypeDefinition), - typeof(InterfaceType), - typeof(InterfaceTypeDefinition), - typeof(ObjectType), - typeof(ObjectTypeDefinition), - typeof(ScalarType), - typeof(ScalarTypeDefinition), - typeof(UnionType), - typeof(UnionTypeDefinition) + typeof(EnumType), typeof(EnumTypeDefinition), typeof(InputObjectType), + typeof(InputObjectTypeDefinition), typeof(InterfaceType), typeof(InterfaceTypeDefinition), + typeof(ObjectType), typeof(ObjectTypeDefinition), typeof(ScalarType), typeof(ScalarTypeDefinition), + typeof(UnionType), typeof(UnionTypeDefinition) }; Assert.Equal(expected, types); @@ -134,15 +98,8 @@ public void ClrTypes(Type type) var expected = new[] { - typeof(EnumType), - typeof(EnumValue), - typeof(Field), - typeof(InputObjectType), - typeof(InputValue), - typeof(InterfaceType), - typeof(ObjectType), - typeof(ScalarType), - typeof(UnionType) + typeof(EnumType), typeof(EnumValue), typeof(Field), typeof(InputObjectType), typeof(InputValue), + typeof(InterfaceType), typeof(ObjectType), typeof(ScalarType), typeof(UnionType) }; Assert.Equal(expected, types); @@ -157,15 +114,8 @@ public void TypeDescriptions(Type type) var expected = new[] { - typeof(EnumType), - typeof(EnumValue), - typeof(Field), - typeof(InputObjectType), - typeof(InputValue), - typeof(InterfaceType), - typeof(ObjectType), - typeof(ScalarType), - typeof(UnionType) + typeof(EnumType), typeof(EnumValue), typeof(Field), typeof(InputObjectType), typeof(InputValue), + typeof(InterfaceType), typeof(ObjectType), typeof(ScalarType), typeof(UnionType) }; Assert.Equal(expected, types); @@ -178,10 +128,7 @@ public void AbstractTypeDefinitions() var expected = new[] { - typeof(InterfaceType), - typeof(InterfaceTypeDefinition), - typeof(UnionType), - typeof(UnionTypeDefinition) + typeof(InterfaceType), typeof(InterfaceTypeDefinition), typeof(UnionType), typeof(UnionTypeDefinition) }; Assert.Equal(expected, types); @@ -192,11 +139,7 @@ public void AbstractTypes() { var types = ClrTypeUtils.GetImplementedTypes(typeof(IAbstractType)); - var expected = new[] - { - typeof(InterfaceType), - typeof(UnionType) - }; + var expected = new[] { typeof(InterfaceType), typeof(UnionType) }; Assert.Equal(expected, types); } @@ -209,17 +152,9 @@ public void Annotated() var expected = new[] { - typeof(AnnotatableMemberDefinition), - typeof(EnumType), - typeof(EnumValue), - typeof(Field), - typeof(InputObjectType), - typeof(InputValue), - typeof(InterfaceType), - typeof(ObjectType), - typeof(ScalarType), - typeof(Schema), - typeof(UnionType) + typeof(AnnotatableMemberDefinition), typeof(EnumType), typeof(EnumValue), typeof(Field), + typeof(InputObjectType), typeof(InputValue), typeof(InterfaceType), typeof(ObjectType), + typeof(ScalarType), typeof(Schema), typeof(UnionType) }; Assert.Equal(expected, types); @@ -232,12 +167,8 @@ public void CompositeTypeDefinitions() var expected = new[] { - typeof(InterfaceType), - typeof(InterfaceTypeDefinition), - typeof(ObjectType), - typeof(ObjectTypeDefinition), - typeof(UnionType), - typeof(UnionTypeDefinition) + typeof(InterfaceType), typeof(InterfaceTypeDefinition), typeof(ObjectType), + typeof(ObjectTypeDefinition), typeof(UnionType), typeof(UnionTypeDefinition) }; Assert.Equal(expected, types); @@ -249,12 +180,7 @@ public void CompositeTypes() { var types = ClrTypeUtils.GetImplementedTypes(typeof(ICompositeType)); - var expected = new[] - { - typeof(InterfaceType), - typeof(ObjectType), - typeof(UnionType) - }; + var expected = new[] { typeof(InterfaceType), typeof(ObjectType), typeof(UnionType) }; Assert.Equal(expected, types); } @@ -267,10 +193,7 @@ public void LeafTypeDefinitions() var expected = new[] { - typeof(EnumType), - typeof(EnumTypeDefinition), - typeof(ScalarType), - typeof(ScalarTypeDefinition) + typeof(EnumType), typeof(EnumTypeDefinition), typeof(ScalarType), typeof(ScalarTypeDefinition) }; Assert.Equal(expected, types); @@ -281,11 +204,7 @@ public void LeafTypes() { var types = ClrTypeUtils.GetImplementedTypes(typeof(ILeafType)); - var expected = new[] - { - typeof(EnumType), - typeof(ScalarType) - }; + var expected = new[] { typeof(EnumType), typeof(ScalarType) }; Assert.Equal(expected, types); } @@ -298,13 +217,8 @@ public void NullableTypes() var expected = new[] { - typeof(EnumType), - typeof(InputObjectType), - typeof(InterfaceType), - typeof(ListType), - typeof(ObjectType), - typeof(ScalarType), - typeof(UnionType) + typeof(EnumType), typeof(InputObjectType), typeof(InterfaceType), typeof(ListType), typeof(ObjectType), + typeof(ScalarType), typeof(UnionType) }; Assert.Equal(expected, types);