From 02e7c877a185c04521639c0aa165035649cff935 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Sun, 3 Mar 2019 08:38:18 +0100 Subject: [PATCH] Release Preparations (#611) --- CHANGELOG.md | 4 + README.md | 2 +- ROADMAP.md | 10 +- .../AST/DirectiveDefinitionNodeTests.cs | 165 ++++++++++- .../AST/SelectionSetNodeTests.cs | 276 ++++++++++++++++++ ...ctiveDefinitionNodeTests.AsRepeatable.snap | 19 ++ ...DirectiveDefinitionNodeTests.AsUnique.snap | 19 ++ ...tiveDefinitionNodeTests.WithArguments.snap | 45 +++ ...veDefinitionNodeTests.WithDescription.snap | 19 ++ ...tiveDefinitionNodeTests.WithLocations.snap | 25 ++ ...DirectiveDefinitionNodeTests.WithName.snap | 19 ++ .../SelectionSetNodeTests.AddSelection.snap | 58 ++++ .../SelectionSetNodeTests.AddSelections.snap | 58 ++++ ...ectionSetNodeTests.CreateSelectionSet.snap | 45 +++ ...SelectionSetNodeTests.RemoveSelection.snap | 45 +++ ...electionSetNodeTests.RemoveSelections.snap | 45 +++ .../SelectionSetNodeTests.WithLocation.snap | 45 +++ .../SelectionSetNodeTests.WithSelections.snap | 45 +++ .../AspNetCore.Voyager.csproj | 9 +- .../{ => Client}/RemoteQueryClientTests.cs | 0 ...atchMultipleQueriesAndRewriteErrors_A.snap | 2 +- ...atchMultipleQueriesAndRewriteErrors_B.snap | 2 +- ...patchMultipleQueriesWithGlobalError_A.snap | 2 +- ...patchMultipleQueriesWithGlobalError_B.snap | 2 +- .../DispatchMultipleQueries_MergedQuery.snap | 0 .../DispatchMultipleQueries_Result_A.snap | 2 +- .../DispatchMultipleQueries_Result_B.snap | 2 +- ....DispatchMultipleQueriesWithVariables.snap | 2 +- ...eQueryClientTests.DispatchSingleQuery.snap | 0 .../ArgumentScopedVariableResolverTests.cs | 3 +- .../ContextDataScopedVariableResolverTests.cs | 199 +++++++++++++ .../FieldScopedVariableResolverTests.cs | 4 +- .../RemoteExecutorAccessorTests.cs | 2 +- .../RemoteQueryBuilderTests.cs | 2 +- .../RemoteQueryMiddlewareTests.cs | 2 +- ...dContextDataScopedVariableResolverTests.cs | 200 +++++++++++++ .../SelectionPathParserTests.cs | 2 +- ...oteQueryBuilderTests.BuildRemoteQuery.snap | 0 ...wareTests.ExecuteQueryOnRemoteSchema.snap} | 0 .../{ => Merge}/SchemaInfoTests.cs | 0 .../Merge/TypeInfoExtensionsTests.cs | 117 ++++++++ .../DelegateToRemoteSchemaMiddlewareTests.cs | 0 ...lewareTests.CustomDirectiveIsPassedOn.snap | 0 ...wareTests.ExecuteStitchedQueryBuilder.snap | 0 ...StitchedQueryBuilderVariableArguments.snap | 0 ...teStitchedQueryBuilderWithLocalSchema.snap | 0 ...teStitchedQueryBuilderWithRenamedType.snap | 0 ...ExecuteStitchedQueryWithComputedField.snap | 0 ...s.ExecuteStitchingQueryDeepObjectPath.snap | 0 ...s.ExecuteStitchingQueryDeepScalarPath.snap | 0 ...s.ExecuteStitchingQueryWithArguments.snap} | 2 +- ...eStitchingQueryWithFragmentDefinition.snap | 0 ...ecuteStitchingQueryWithInlineFragment.snap | 0 ...eTests.ExecuteStitchingQueryWithUnion.snap | 0 ...ts.ExecuteStitchingQueryWithVariables.snap | 0 ...oteSchemaMiddlewareTests.ReplaceField.snap | 0 ...chemaMiddlewareTests.StitchedMutation.snap | 0 ...tchedMutationWithRenamedFieldArgument.snap | 0 ...StitchedMutationWithRenamedInputField.snap | 0 ...ationWithRenamedInputFieldInVariables.snap | 0 ...nWithRenamedInputFieldInVariablesList.snap | 0 ...chedMutationWithRenamedInputFieldList.snap | 0 ....StitchedMutationWithRenamedInputType.snap | 0 .../ExtractFieldQuerySyntaxRewriterTests.cs | 0 .../FieldDependencyResolverTests.cs | 0 .../HttpResponseDeserializerTests.cs | 0 .../MergeQueryRewriterTests.cs | 0 .../__snapshots__/AliasesMapIsCorrect_A.snap | 2 +- .../__snapshots__/AliasesMapIsCorrect_B.snap | 2 +- .../DeserializeQueryResult_bool.snap | 2 +- .../DeserializeQueryResult_flot.snap | 2 +- .../DeserializeQueryResult_int.snap | 2 +- .../DeserializeQueryResult_string.snap | 2 +- ...tching.graphql_StitchingQuery.graphql.snap | 0 ...l_StitchingQueryWithArguments.graphql.snap | 0 ...titchingQueryWithFragmentDefs.graphql.snap | 0 ...tchingQueryWithInlineFragment.graphql.snap | 0 ...aphql_StitchingQueryWithUnion.graphql.snap | 0 ...l_StitchingQueryWithVariables.graphql.snap | 0 ...l_StitchingQueryComputedField.graphql.snap | 0 ...ests.ExtractField_WithCustomRewriters.snap | 0 ...ncyResolverTests.GetFieldDependencies.snap | 2 +- ...ests.DeserializeQueryResultOnlyErrors.snap | 2 +- ...ests.DeserializeQueryResultWithErrors.snap | 2 +- ....DeserializeQueryResultWithExtensions.snap | 2 +- ...ewriterTests.QueryWithGlobalVariables.snap | 0 ...writerTests.QueryWithPrivateVariables.snap | 0 ...eryRewriterTests.SimpleShortHandQuery.snap | 0 .../Stitching/Merge/DirectiveInfo.cs | 30 -- .../Stitching/Merge/IDirectiveInfo.cs | 11 - tools/Build.sln | 28 ++ 91 files changed, 1511 insertions(+), 78 deletions(-) create mode 100644 src/Core/Language.Tests/AST/SelectionSetNodeTests.cs create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsRepeatable.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsUnique.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithArguments.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithDescription.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithLocations.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithName.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelection.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelections.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.CreateSelectionSet.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelection.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelections.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithLocation.snap create mode 100644 src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithSelections.snap rename src/Stitching/Stitching.Tests/{ => Client}/RemoteQueryClientTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap (97%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap (99%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap (97%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap (99%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueries_MergedQuery.snap (100%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueries_Result_A.snap (97%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/DispatchMultipleQueries_Result_B.snap (97%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap (99%) rename src/Stitching/Stitching.Tests/{ => Client}/__snapshots__/RemoteQueryClientTests.DispatchSingleQuery.snap (100%) rename src/Stitching/Stitching.Tests/{ => Delegation}/ArgumentScopedVariableResolverTests.cs (98%) create mode 100644 src/Stitching/Stitching.Tests/Delegation/ContextDataScopedVariableResolverTests.cs rename src/Stitching/Stitching.Tests/{ => Delegation}/FieldScopedVariableResolverTests.cs (98%) rename src/Stitching/Stitching.Tests/{ => Delegation}/RemoteExecutorAccessorTests.cs (97%) rename src/Stitching/Stitching.Tests/{ => Delegation}/RemoteQueryBuilderTests.cs (97%) rename src/Stitching/Stitching.Tests/{ => Delegation}/RemoteQueryMiddlewareTests.cs (98%) create mode 100644 src/Stitching/Stitching.Tests/Delegation/ScopedContextDataScopedVariableResolverTests.cs rename src/Stitching/Stitching.Tests/{ => Delegation}/SelectionPathParserTests.cs (98%) rename src/Stitching/Stitching.Tests/{ => Delegation}/__snapshots__/RemoteQueryBuilderTests.BuildRemoteQuery.snap (100%) rename src/Stitching/Stitching.Tests/{__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap => Delegation/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap} (100%) rename src/Stitching/Stitching.Tests/{ => Merge}/SchemaInfoTests.cs (100%) create mode 100644 src/Stitching/Stitching.Tests/Merge/TypeInfoExtensionsTests.cs rename src/Stitching/Stitching.Tests/{ => Middleware}/DelegateToRemoteSchemaMiddlewareTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.CustomDirectiveIsPassedOn.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilder.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderVariableArguments.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithLocalSchema.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithRenamedType.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryWithComputedField.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepObjectPath.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepScalarPath.snap (100%) rename src/Stitching/Stitching.Tests/{__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap => Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap} (99%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithFragmentDefinition.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithInlineFragment.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithUnion.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithVariables.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ReplaceField.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutation.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedFieldArgument.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputField.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariables.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariablesList.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldList.snap (100%) rename src/Stitching/Stitching.Tests/{ => Middleware}/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputType.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/ExtractFieldQuerySyntaxRewriterTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/FieldDependencyResolverTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/HttpResponseDeserializerTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/MergeQueryRewriterTests.cs (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/AliasesMapIsCorrect_A.snap (93%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/AliasesMapIsCorrect_B.snap (93%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/DeserializeQueryResult_bool.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/DeserializeQueryResult_flot.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/DeserializeQueryResult_int.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/DeserializeQueryResult_string.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQuery.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithArguments.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithFragmentDefs.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithInlineFragment.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithUnion.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithVariables.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_StitchingComputed.graphql_StitchingQueryComputedField.graphql.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_WithCustomRewriters.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap (96%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap (99%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/MergeQueryRewriterTests.QueryWithGlobalVariables.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/MergeQueryRewriterTests.QueryWithPrivateVariables.snap (100%) rename src/Stitching/Stitching.Tests/{ => Utilities}/__snapshots__/MergeQueryRewriterTests.SimpleShortHandQuery.snap (100%) delete mode 100644 src/Stitching/Stitching/Merge/DirectiveInfo.cs delete mode 100644 src/Stitching/Stitching/Merge/IDirectiveInfo.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index bd8550999a9..52de5824938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +## [0.8.0] - 2019-03-03 + +### Added + - The stitching layer now batches requests to the remote schemas. - Introspection schema serializer. - Introduced auto-stitching capabilities with the new `StitchingBuilder`. diff --git a/README.md b/README.md index f66ebba3183..6c548c9cf56 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![HotChocolate](https://cdn.rawgit.com/ChilliCream/hotchocolate-logo/acacc5b353f4a21bc03591d9910232c3c748d552/img/hotchocolate-banner-light.svg) -[![GitHub release](https://img.shields.io/github/release/chillicream/HotChocolate.svg)](https://github.com/ChilliCream/hotchocolate/releases) [![NuGet Package](https://img.shields.io/nuget/v/hotchocolate.svg)](https://www.nuget.org/packages/HotChocolate/) [![License](https://img.shields.io/github/license/ChilliCream/hotchocolate.svg)](https://github.com/ChilliCream/hotchocolate/releases) [![AppVeyor](https://ci.appveyor.com/api/projects/status/uf8xnbyo32bh7ge1/branch/master?svg=true)](https://ci.appveyor.com/project/rstaib/zeus) [![Travis](https://travis-ci.org/ChilliCream/hotchocolate.svg?branch=master)](https://travis-ci.org/ChilliCream/hotchocolate) [![Tests](https://img.shields.io/appveyor/tests/rstaib/zeus/master.svg)](https://ci.appveyor.com/project/rstaib/zeus) [![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=HotChocolate&metric=coverage)](https://sonarcloud.io/dashboard?id=HotChocolate) [![Quality](https://sonarcloud.io/api/project_badges/measure?project=HotChocolate&metric=alert_status)](https://sonarcloud.io/dashboard?id=HotChocolate) [![BCH compliance](https://bettercodehub.com/edge/badge/ChilliCream/hotchocolate?branch=master)](https://bettercodehub.com/) +[![GitHub release](https://img.shields.io/github/release/chillicream/HotChocolate.svg)](https://github.com/ChilliCream/hotchocolate/releases) [![NuGet Package](https://img.shields.io/nuget/v/hotchocolate.svg)](https://www.nuget.org/packages/HotChocolate/) [![License](https://img.shields.io/github/license/ChilliCream/hotchocolate.svg)](https://github.com/ChilliCream/hotchocolate/releases) [![AppVeyor](https://ci.appveyor.com/api/projects/status/uf8xnbyo32bh7ge1/branch/master?svg=true)](https://ci.appveyor.com/project/rstaib/zeus) [![Tests](https://img.shields.io/appveyor/tests/rstaib/zeus/master.svg)](https://ci.appveyor.com/project/rstaib/zeus) [![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=HotChocolate&metric=coverage)](https://sonarcloud.io/dashboard?id=HotChocolate) [![Quality](https://sonarcloud.io/api/project_badges/measure?project=HotChocolate&metric=alert_status)](https://sonarcloud.io/dashboard?id=HotChocolate) [![BCH compliance](https://bettercodehub.com/edge/badge/ChilliCream/hotchocolate?branch=master)](https://bettercodehub.com/) --- diff --git a/ROADMAP.md b/ROADMAP.md index 499c79d80b0..44856bdbf66 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -33,8 +33,8 @@ This document shall give and outlook of what we have planned for the next releas - [x] FragmentDefinition - [x] FragmentSpread - [x] InlineFragment - - [ ] Schema (in development - 0.8.0) - - [ ] Scalar (in development - 0.8.0) + - [ ] Schema (in development - 0.9.0) + - [ ] Scalar (in development - 0.9.0) - [x] Object - [x] FieldDefinition - [ ] ArgumentDefinition @@ -87,8 +87,8 @@ We are currently working on the following features that are proposed for the nex - [x] [Limit directive uniqueness to explicitly marked directives](https://github.com/facebook/graphql/pull/472) - [x] ["Directive order is significant" section](https://github.com/facebook/graphql/pull/470) -- [ ] [Add rules for how circular references in Input Objects are handled](https://github.com/facebook/graphql/pull/445) (in development - 0.8.0) -- [ ] [Add description to Schema](https://github.com/facebook/graphql/pull/466) (in development - 0.8.0) +- [ ] [Add rules for how circular references in Input Objects are handled](https://github.com/facebook/graphql/pull/445) (in development - 0.9.0) +- [ ] [Add description to Schema](https://github.com/facebook/graphql/pull/466) (in development - 0.9.0) ## Experimental Features @@ -108,7 +108,7 @@ We are currently working on the following features that are proposed for the nex ## Additional Directives - [x] Schema Stitching -- [ ] HTTP Directives (in development - 0.8.0) +- [ ] HTTP Directives (in development - 0.9.0) - [x] Custom Schema Directives - [x] Custom Query Directives diff --git a/src/Core/Language.Tests/AST/DirectiveDefinitionNodeTests.cs b/src/Core/Language.Tests/AST/DirectiveDefinitionNodeTests.cs index f1b321c987e..4a72fe7441d 100644 --- a/src/Core/Language.Tests/AST/DirectiveDefinitionNodeTests.cs +++ b/src/Core/Language.Tests/AST/DirectiveDefinitionNodeTests.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using Snapshooter.Xunit; using Xunit; namespace HotChocolate.Language @@ -32,6 +34,7 @@ public void CreateDirectiveDefinitionWithLocation(bool isRepeatable) Assert.Equal(name, directiveDefinition.Name); Assert.Equal(description, directiveDefinition.Description); Assert.Equal(isRepeatable, directiveDefinition.IsRepeatable); + Assert.NotEqual(isRepeatable, directiveDefinition.IsUnique); Assert.Equal(arguments, directiveDefinition.Arguments); Assert.Equal(locations, directiveDefinition.Locations); } @@ -58,6 +61,166 @@ public void CreateDirectiveDefinition() Assert.Equal(description, directiveDefinition.Description); Assert.Equal(arguments, directiveDefinition.Arguments); Assert.Equal(locations, directiveDefinition.Locations); + Assert.True(directiveDefinition.IsRepeatable); + Assert.False(directiveDefinition.IsUnique); + } + + [Fact] + public void WithName() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .WithName(new NameNode("bar")); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void WithDescription() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .WithDescription(new StringValueNode("qux")); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void WithArguments() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .WithArguments(new List + { + new InputValueDefinitionNode + ( + null, + new NameNode("arg"), + null, + new NamedTypeNode(new NameNode("type")), + NullValueNode.Default, + Array.Empty() + ) + }); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void WithLocations() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .WithLocations(new List { new NameNode("BAR") }); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void WithLocation() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .WithLocation(AstTestHelper.CreateDummyLocation()); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void AsUnique() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, true, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .AsUnique(); + + // assert + directiveDefinition.MatchSnapshot(); + } + + [Fact] + public void AsRepeatable() + { + // arrange + var name = new NameNode("foo"); + var description = new StringValueNode("bar"); + var arguments = new List(); + var locations = new List(); + + var directiveDefinition = new DirectiveDefinitionNode( + null, name, description, false, + arguments, locations); + + // act + directiveDefinition = directiveDefinition + .AsRepeatable(); + + // assert + directiveDefinition.MatchSnapshot(); } } } diff --git a/src/Core/Language.Tests/AST/SelectionSetNodeTests.cs b/src/Core/Language.Tests/AST/SelectionSetNodeTests.cs new file mode 100644 index 00000000000..9330f06717b --- /dev/null +++ b/src/Core/Language.Tests/AST/SelectionSetNodeTests.cs @@ -0,0 +1,276 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Snapshooter.Xunit; +using Xunit; + +namespace HotChocolate.Language +{ + public class SelectionSetNodeTests + { + [Fact] + public void CreateSelectionSet() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + // act + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void WithLocation() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + null, + selections + ); + + // act + selectionSet = selectionSet.WithLocation(location); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void AddSelection() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // act + selectionSet = selectionSet.AddSelection( + new FieldNode + ( + null, + new NameNode("baz"), + null, + Array.Empty(), + Array.Empty(), + null + )); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void AddSelections() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // act + selectionSet = selectionSet.AddSelections( + new FieldNode + ( + null, + new NameNode("baz"), + null, + Array.Empty(), + Array.Empty(), + null + )); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void RemoveSelection() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ), + new FieldNode + ( + null, + new NameNode("baz"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // act + selectionSet = selectionSet.RemoveSelection( + selectionSet.Selections.First()); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void RemoveSelections() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ), + new FieldNode + ( + null, + new NameNode("baz"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // act + selectionSet = selectionSet.RemoveSelections( + selectionSet.Selections.First()); + + // assert + selectionSet.MatchSnapshot(); + } + + [Fact] + public void WithSelections() + { + // arrange + Location location = AstTestHelper.CreateDummyLocation(); + var selections = new List + { + new FieldNode + ( + null, + new NameNode("bar"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }; + + var selectionSet = new SelectionSetNode + ( + location, + selections + ); + + // act + selectionSet = selectionSet.WithSelections( + new List + { + new FieldNode + ( + null, + new NameNode("baz"), + null, + Array.Empty(), + Array.Empty(), + null + ) + }); + + // assert + selectionSet.MatchSnapshot(); + } + } +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsRepeatable.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsRepeatable.snap new file mode 100644 index 00000000000..bc12bff1954 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsRepeatable.snap @@ -0,0 +1,19 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "foo" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "bar", + "Block": false + }, + "IsRepeatable": true, + "IsUnique": false, + "Arguments": [], + "Locations": [] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsUnique.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsUnique.snap new file mode 100644 index 00000000000..f81b5f23ca8 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.AsUnique.snap @@ -0,0 +1,19 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "foo" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "bar", + "Block": false + }, + "IsRepeatable": false, + "IsUnique": true, + "Arguments": [], + "Locations": [] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithArguments.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithArguments.snap new file mode 100644 index 00000000000..7f779806967 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithArguments.snap @@ -0,0 +1,45 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "foo" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "bar", + "Block": false + }, + "IsRepeatable": true, + "IsUnique": false, + "Arguments": [ + { + "Kind": "InputValueDefinition", + "Description": null, + "Type": { + "Kind": "NamedType", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "type" + } + }, + "DefaultValue": { + "Kind": "NullValue", + "Location": null, + "Value": null + }, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "arg" + }, + "Directives": [] + } + ], + "Locations": [] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithDescription.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithDescription.snap new file mode 100644 index 00000000000..af10d5c60c1 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithDescription.snap @@ -0,0 +1,19 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "foo" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "qux", + "Block": false + }, + "IsRepeatable": true, + "IsUnique": false, + "Arguments": [], + "Locations": [] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithLocations.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithLocations.snap new file mode 100644 index 00000000000..e47cc19ee2e --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithLocations.snap @@ -0,0 +1,25 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "foo" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "bar", + "Block": false + }, + "IsRepeatable": true, + "IsUnique": false, + "Arguments": [], + "Locations": [ + { + "Kind": "Name", + "Location": null, + "Value": "BAR" + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithName.snap b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithName.snap new file mode 100644 index 00000000000..2cb6c6e5921 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/DirectiveDefinitionNodeTests.WithName.snap @@ -0,0 +1,19 @@ +{ + "Kind": "DirectiveDefinition", + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "bar" + }, + "Description": { + "Kind": "StringValue", + "Location": null, + "Value": "bar", + "Block": false + }, + "IsRepeatable": true, + "IsUnique": false, + "Arguments": [], + "Locations": [] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelection.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelection.snap new file mode 100644 index 00000000000..59cc71b310a --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelection.snap @@ -0,0 +1,58 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "bar" + }, + "Directives": [] + }, + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelections.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelections.snap new file mode 100644 index 00000000000..d2ff30d6247 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.AddSelections.snap @@ -0,0 +1,58 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + }, + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.CreateSelectionSet.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.CreateSelectionSet.snap new file mode 100644 index 00000000000..15367332b88 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.CreateSelectionSet.snap @@ -0,0 +1,45 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "bar" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelection.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelection.snap new file mode 100644 index 00000000000..d8178381bc6 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelection.snap @@ -0,0 +1,45 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelections.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelections.snap new file mode 100644 index 00000000000..d8178381bc6 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.RemoveSelections.snap @@ -0,0 +1,45 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithLocation.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithLocation.snap new file mode 100644 index 00000000000..15367332b88 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithLocation.snap @@ -0,0 +1,45 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "bar" + }, + "Directives": [] + } + ] +} diff --git a/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithSelections.snap b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithSelections.snap new file mode 100644 index 00000000000..d8178381bc6 --- /dev/null +++ b/src/Core/Language.Tests/AST/__snapshots__/SelectionSetNodeTests.WithSelections.snap @@ -0,0 +1,45 @@ +{ + "Kind": "SelectionSet", + "Location": { + "Start": 0, + "End": 0, + "StartToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "EndToken": { + "Kind": "StartOfFile", + "Start": 0, + "End": 0, + "Line": 1, + "Column": 1, + "Value": null, + "Previous": null, + "Next": null + }, + "Source": { + "Text": "foo" + } + }, + "Selections": [ + { + "Kind": "Field", + "Alias": null, + "Arguments": [], + "SelectionSet": null, + "Location": null, + "Name": { + "Kind": "Name", + "Location": null, + "Value": "baz" + }, + "Directives": [] + } + ] +} diff --git a/src/Server/AspNetCore.Voyager/AspNetCore.Voyager.csproj b/src/Server/AspNetCore.Voyager/AspNetCore.Voyager.csproj index d84a99885a8..c76c8af41b1 100644 --- a/src/Server/AspNetCore.Voyager/AspNetCore.Voyager.csproj +++ b/src/Server/AspNetCore.Voyager/AspNetCore.Voyager.csproj @@ -1,10 +1,11 @@ - netstandard2.0 - HotChocolate.AspNetCore.Voyager - HotChocolate.AspNetCore.Voyager - HotChocolate.AspNetCore.Voyager + netstandard2.0 + HotChocolate.AspNetCore.Voyager + HotChocolate.AspNetCore.Voyager + HotChocolate.AspNetCore.Voyager + Contains a GraphQL Voyager for ASP.net core that can be used with the Hot Chocolate GraphQL server. diff --git a/src/Stitching/Stitching.Tests/RemoteQueryClientTests.cs b/src/Stitching/Stitching.Tests/Client/RemoteQueryClientTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/RemoteQueryClientTests.cs rename to src/Stitching/Stitching.Tests/Client/RemoteQueryClientTests.cs diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap similarity index 97% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap index 6387b899a89..6e7b3b6a37d 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_A.snap @@ -4,4 +4,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap index b0139ea4699..0557000927b 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesAndRewriteErrors_B.snap @@ -16,4 +16,4 @@ "Extensions": {} } ] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap similarity index 97% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap index 6387b899a89..6e7b3b6a37d 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_A.snap @@ -4,4 +4,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap index 0116e7e2fb3..68601ead795 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueriesWithGlobalError_B.snap @@ -14,4 +14,4 @@ "Extensions": {} } ] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_MergedQuery.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_MergedQuery.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_MergedQuery.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_MergedQuery.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_A.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_A.snap similarity index 97% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_A.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_A.snap index 6387b899a89..6e7b3b6a37d 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_A.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_A.snap @@ -4,4 +4,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_B.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_B.snap similarity index 97% rename from src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_B.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_B.snap index d4b6d9a6238..ccf0b04e401 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DispatchMultipleQueries_Result_B.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/DispatchMultipleQueries_Result_B.snap @@ -5,4 +5,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap index 2e346aac867..bab926c343a 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap +++ b/src/Stitching/Stitching.Tests/Client/__snapshots__/RemoteQueryClientTests.DispatchMultipleQueriesWithVariables.snap @@ -7,4 +7,4 @@ "InitialValue": null, "Properties": null, "Services": {} -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryClientTests.DispatchSingleQuery.snap b/src/Stitching/Stitching.Tests/Client/__snapshots__/RemoteQueryClientTests.DispatchSingleQuery.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryClientTests.DispatchSingleQuery.snap rename to src/Stitching/Stitching.Tests/Client/__snapshots__/RemoteQueryClientTests.DispatchSingleQuery.snap diff --git a/src/Stitching/Stitching.Tests/ArgumentScopedVariableResolverTests.cs b/src/Stitching/Stitching.Tests/Delegation/ArgumentScopedVariableResolverTests.cs similarity index 98% rename from src/Stitching/Stitching.Tests/ArgumentScopedVariableResolverTests.cs rename to src/Stitching/Stitching.Tests/Delegation/ArgumentScopedVariableResolverTests.cs index 27533b476e2..03745d454bd 100644 --- a/src/Stitching/Stitching.Tests/ArgumentScopedVariableResolverTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/ArgumentScopedVariableResolverTests.cs @@ -3,12 +3,11 @@ using HotChocolate.Execution; using HotChocolate.Language; using HotChocolate.Resolvers; -using HotChocolate.Stitching.Delegation; using HotChocolate.Types; using Moq; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class ArgumentScopedVariableResolverTests { diff --git a/src/Stitching/Stitching.Tests/Delegation/ContextDataScopedVariableResolverTests.cs b/src/Stitching/Stitching.Tests/Delegation/ContextDataScopedVariableResolverTests.cs new file mode 100644 index 00000000000..8f4e74623ae --- /dev/null +++ b/src/Stitching/Stitching.Tests/Delegation/ContextDataScopedVariableResolverTests.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; +using ChilliCream.Testing; +using HotChocolate.Execution; +using HotChocolate.Language; +using HotChocolate.Resolvers; +using HotChocolate.Stitching.Delegation; +using HotChocolate.Types; +using Moq; +using Xunit; + +namespace HotChocolate.Stitching.Delegation +{ + public class ContextDataScopedVariableResolverTests + { + [Fact] + public void CreateVariableValue() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var contextData = new Dictionary(); + contextData["a"] = "AbcDef"; + + var context = new Mock(MockBehavior.Strict); + context.SetupGet(t => t.ContextData).Returns(contextData); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("contextData"), + new NameNode("a")); + + // act + var resolver = new ContextDataScopedVariableResolver(); + VariableValue value = resolver.Resolve( + context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Null(value.DefaultValue); + Assert.Equal("contextData_a", value.Name); + Assert.Equal("abc", + Assert.IsType(value.Type).Name.Value); + Assert.Equal("AbcDef", value.Value); + } + + [Fact] + public void ContextDataEntryDoesNotExist() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var contextData = new Dictionary(); + + var context = new Mock(MockBehavior.Strict); + context.SetupGet(t => t.ContextData).Returns(contextData); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("contextData"), + new NameNode("a")); + + // act + var resolver = new ContextDataScopedVariableResolver(); + VariableValue value = resolver.Resolve( + context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Null(value.DefaultValue); + Assert.Equal("contextData_a", value.Name); + Assert.Equal("abc", + Assert.IsType(value.Type).Name.Value); + Assert.Null(value.Value); + } + + + [Fact] + public void ContextIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("contextData"), + new NameNode("b")); + + // act + var resolver = new ContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(null, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("context", + Assert.Throws(a).ParamName); + } + + [Fact] + public void ScopedVariableIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + // act + var resolver = new ContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, null, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("variable", + Assert.Throws(a).ParamName); + } + + [Fact] + public void TargetTypeIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("contextData"), + new NameNode("b")); + + // act + var resolver = new ContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, scopedVariable, + null); + + // assert + Assert.Equal("targetType", + Assert.Throws(a).ParamName); + } + + [Fact] + public void InvalidScope() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("foo"), + new NameNode("b")); + + // act + var resolver = new ContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("variable", + Assert.Throws(a).ParamName); + } + } +} diff --git a/src/Stitching/Stitching.Tests/FieldScopedVariableResolverTests.cs b/src/Stitching/Stitching.Tests/Delegation/FieldScopedVariableResolverTests.cs similarity index 98% rename from src/Stitching/Stitching.Tests/FieldScopedVariableResolverTests.cs rename to src/Stitching/Stitching.Tests/Delegation/FieldScopedVariableResolverTests.cs index af0c3a59adf..92087001f4d 100644 --- a/src/Stitching/Stitching.Tests/FieldScopedVariableResolverTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/FieldScopedVariableResolverTests.cs @@ -8,7 +8,7 @@ using Moq; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class FieldScopedVariableResolverTests { @@ -113,7 +113,7 @@ public void ContextIsNull() new NameNode("b")); // act - var resolver = new ArgumentScopedVariableResolver(); + var resolver = new FieldScopedVariableResolver(); Action a = () => resolver.Resolve(null, scopedVariable, new NamedTypeNode(new NameNode("abc"))); diff --git a/src/Stitching/Stitching.Tests/RemoteExecutorAccessorTests.cs b/src/Stitching/Stitching.Tests/Delegation/RemoteExecutorAccessorTests.cs similarity index 97% rename from src/Stitching/Stitching.Tests/RemoteExecutorAccessorTests.cs rename to src/Stitching/Stitching.Tests/Delegation/RemoteExecutorAccessorTests.cs index 1f67cc9c0e9..38e2bcf2d2e 100644 --- a/src/Stitching/Stitching.Tests/RemoteExecutorAccessorTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/RemoteExecutorAccessorTests.cs @@ -4,7 +4,7 @@ using Moq; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class RemoteExecutorAccessorTests { diff --git a/src/Stitching/Stitching.Tests/RemoteQueryBuilderTests.cs b/src/Stitching/Stitching.Tests/Delegation/RemoteQueryBuilderTests.cs similarity index 97% rename from src/Stitching/Stitching.Tests/RemoteQueryBuilderTests.cs rename to src/Stitching/Stitching.Tests/Delegation/RemoteQueryBuilderTests.cs index 53066f3fd3e..54dd45141c7 100644 --- a/src/Stitching/Stitching.Tests/RemoteQueryBuilderTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/RemoteQueryBuilderTests.cs @@ -9,7 +9,7 @@ using Snapshooter.Xunit; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class RemoteQueryBuilderTests { diff --git a/src/Stitching/Stitching.Tests/RemoteQueryMiddlewareTests.cs b/src/Stitching/Stitching.Tests/Delegation/RemoteQueryMiddlewareTests.cs similarity index 98% rename from src/Stitching/Stitching.Tests/RemoteQueryMiddlewareTests.cs rename to src/Stitching/Stitching.Tests/Delegation/RemoteQueryMiddlewareTests.cs index ea6f51190d5..3e25c7a9d59 100644 --- a/src/Stitching/Stitching.Tests/RemoteQueryMiddlewareTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/RemoteQueryMiddlewareTests.cs @@ -17,7 +17,7 @@ using Snapshooter.Xunit; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class RemoteQueryMiddlewareTests : IClassFixture diff --git a/src/Stitching/Stitching.Tests/Delegation/ScopedContextDataScopedVariableResolverTests.cs b/src/Stitching/Stitching.Tests/Delegation/ScopedContextDataScopedVariableResolverTests.cs new file mode 100644 index 00000000000..b2b16f85108 --- /dev/null +++ b/src/Stitching/Stitching.Tests/Delegation/ScopedContextDataScopedVariableResolverTests.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using ChilliCream.Testing; +using HotChocolate.Execution; +using HotChocolate.Language; +using HotChocolate.Resolvers; +using HotChocolate.Stitching.Delegation; +using HotChocolate.Types; +using Moq; +using Xunit; + +namespace HotChocolate.Stitching.Delegation +{ + public class ScopedContextDataScopedVariableResolverTests + { + [Fact] + public void CreateVariableValue() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var contextData = ImmutableDictionary.Empty + .Add("a", "AbcDef"); + + var context = new Mock(MockBehavior.Strict); + context.SetupGet(t => t.ScopedContextData).Returns(contextData); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("scopedContextData"), + new NameNode("a")); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + VariableValue value = resolver.Resolve( + context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Null(value.DefaultValue); + Assert.Equal("scopedContextData_a", value.Name); + Assert.Equal("abc", + Assert.IsType(value.Type).Name.Value); + Assert.Equal("AbcDef", value.Value); + } + + [Fact] + public void ContextDataEntryDoesNotExist() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var contextData = ImmutableDictionary.Empty; + + var context = new Mock(MockBehavior.Strict); + context.SetupGet(t => t.ScopedContextData).Returns(contextData); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("scopedContextData"), + new NameNode("a")); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + VariableValue value = resolver.Resolve( + context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Null(value.DefaultValue); + Assert.Equal("scopedContextData_a", value.Name); + Assert.Equal("abc", + Assert.IsType(value.Type).Name.Value); + Assert.Null(value.Value); + } + + + [Fact] + public void ContextIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("scopedContextData"), + new NameNode("b")); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(null, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("context", + Assert.Throws(a).ParamName); + } + + [Fact] + public void ScopedVariableIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, null, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("variable", + Assert.Throws(a).ParamName); + } + + [Fact] + public void TargetTypeIsNull() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("scopedContextData"), + new NameNode("b")); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, scopedVariable, + null); + + // assert + Assert.Equal("targetType", + Assert.Throws(a).ParamName); + } + + [Fact] + public void InvalidScope() + { + // arrange + var schema = Schema.Create( + "type Query { foo(a: String = \"bar\") : String }", + c => + { + c.UseNullResolver(); + c.Options.StrictValidation = false; + }); + + var context = new Mock(); + + var scopedVariable = new ScopedVariableNode( + null, + new NameNode("foo"), + new NameNode("b")); + + // act + var resolver = new ScopedContextDataScopedVariableResolver(); + Action a = () => resolver.Resolve(context.Object, scopedVariable, + new NamedTypeNode(new NameNode("abc"))); + + // assert + Assert.Equal("variable", + Assert.Throws(a).ParamName); + } + } +} diff --git a/src/Stitching/Stitching.Tests/SelectionPathParserTests.cs b/src/Stitching/Stitching.Tests/Delegation/SelectionPathParserTests.cs similarity index 98% rename from src/Stitching/Stitching.Tests/SelectionPathParserTests.cs rename to src/Stitching/Stitching.Tests/Delegation/SelectionPathParserTests.cs index 70b1f9ccb2e..72f2180d590 100644 --- a/src/Stitching/Stitching.Tests/SelectionPathParserTests.cs +++ b/src/Stitching/Stitching.Tests/Delegation/SelectionPathParserTests.cs @@ -5,7 +5,7 @@ using HotChocolate.Stitching.Delegation; using Xunit; -namespace HotChocolate.Stitching +namespace HotChocolate.Stitching.Delegation { public class SelectionPathParserTests { diff --git a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryBuilderTests.BuildRemoteQuery.snap b/src/Stitching/Stitching.Tests/Delegation/__snapshots__/RemoteQueryBuilderTests.BuildRemoteQuery.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryBuilderTests.BuildRemoteQuery.snap rename to src/Stitching/Stitching.Tests/Delegation/__snapshots__/RemoteQueryBuilderTests.BuildRemoteQuery.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap b/src/Stitching/Stitching.Tests/Delegation/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap rename to src/Stitching/Stitching.Tests/Delegation/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap diff --git a/src/Stitching/Stitching.Tests/SchemaInfoTests.cs b/src/Stitching/Stitching.Tests/Merge/SchemaInfoTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/SchemaInfoTests.cs rename to src/Stitching/Stitching.Tests/Merge/SchemaInfoTests.cs diff --git a/src/Stitching/Stitching.Tests/Merge/TypeInfoExtensionsTests.cs b/src/Stitching/Stitching.Tests/Merge/TypeInfoExtensionsTests.cs new file mode 100644 index 00000000000..913a329ee61 --- /dev/null +++ b/src/Stitching/Stitching.Tests/Merge/TypeInfoExtensionsTests.cs @@ -0,0 +1,117 @@ +using System.Linq; +using HotChocolate.Language; +using Xunit; + +namespace HotChocolate.Stitching.Merge +{ + public class TypeInfoExtensionsTests + { + [Fact] + public void IsQueryType_True() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Query { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().First(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsQueryType(); + + // assert + Assert.True(isQuery); + } + + [Fact] + public void IsQueryType_False() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Query { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().Last(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsQueryType(); + + // assert + Assert.False(isQuery); + } + + [Fact] + public void IsMutationType_True() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Mutation { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().First(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsMutationType(); + + // assert + Assert.True(isQuery); + } + + [Fact] + public void IsMutationType_False() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Mutation { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().Last(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsMutationType(); + + // assert + Assert.False(isQuery); + } + + [Fact] + public void IsSubscriptionType_True() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Subscription { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().First(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsSubscriptionType(); + + // assert + Assert.True(isQuery); + } + + [Fact] + public void IsSubscriptionType_False() + { + // arrange + DocumentNode schema = Parser.Default.Parse( + "type Subscription { a: String } type Abc { a: String }"); + var schemaInfo = new SchemaInfo("foo", schema); + ObjectTypeDefinitionNode queryType = schema.Definitions + .OfType().Last(); + var type = new ObjectTypeInfo(queryType, schemaInfo); + + // act + bool isQuery = type.IsSubscriptionType(); + + // assert + Assert.False(isQuery); + } + } +} diff --git a/src/Stitching/Stitching.Tests/DelegateToRemoteSchemaMiddlewareTests.cs b/src/Stitching/Stitching.Tests/Middleware/DelegateToRemoteSchemaMiddlewareTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/DelegateToRemoteSchemaMiddlewareTests.cs rename to src/Stitching/Stitching.Tests/Middleware/DelegateToRemoteSchemaMiddlewareTests.cs diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.CustomDirectiveIsPassedOn.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.CustomDirectiveIsPassedOn.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.CustomDirectiveIsPassedOn.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.CustomDirectiveIsPassedOn.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilder.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilder.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilder.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilder.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderVariableArguments.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderVariableArguments.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderVariableArguments.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderVariableArguments.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithLocalSchema.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithLocalSchema.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithLocalSchema.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithLocalSchema.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithRenamedType.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithRenamedType.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithRenamedType.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryBuilderWithRenamedType.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryWithComputedField.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryWithComputedField.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryWithComputedField.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchedQueryWithComputedField.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepObjectPath.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepObjectPath.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepObjectPath.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepObjectPath.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepScalarPath.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepScalarPath.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepScalarPath.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryDeepScalarPath.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap index b289d750456..e43abe7be30 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/RemoteQueryMiddlewareTests.ExecuteQueryOnRemoteSchema.snap +++ b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithArguments.snap @@ -14,4 +14,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithFragmentDefinition.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithFragmentDefinition.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithFragmentDefinition.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithFragmentDefinition.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithInlineFragment.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithInlineFragment.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithInlineFragment.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithInlineFragment.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithUnion.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithUnion.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithUnion.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithUnion.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithVariables.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithVariables.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithVariables.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ExecuteStitchingQueryWithVariables.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ReplaceField.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ReplaceField.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ReplaceField.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.ReplaceField.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutation.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutation.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutation.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutation.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedFieldArgument.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedFieldArgument.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedFieldArgument.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedFieldArgument.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputField.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputField.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputField.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputField.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariables.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariables.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariables.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariables.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariablesList.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariablesList.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariablesList.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldInVariablesList.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldList.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldList.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldList.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputFieldList.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputType.snap b/src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputType.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputType.snap rename to src/Stitching/Stitching.Tests/Middleware/__snapshots__/DelegateToRemoteSchemaMiddlewareTests.StitchedMutationWithRenamedInputType.snap diff --git a/src/Stitching/Stitching.Tests/ExtractFieldQuerySyntaxRewriterTests.cs b/src/Stitching/Stitching.Tests/Utilities/ExtractFieldQuerySyntaxRewriterTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/ExtractFieldQuerySyntaxRewriterTests.cs rename to src/Stitching/Stitching.Tests/Utilities/ExtractFieldQuerySyntaxRewriterTests.cs diff --git a/src/Stitching/Stitching.Tests/FieldDependencyResolverTests.cs b/src/Stitching/Stitching.Tests/Utilities/FieldDependencyResolverTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/FieldDependencyResolverTests.cs rename to src/Stitching/Stitching.Tests/Utilities/FieldDependencyResolverTests.cs diff --git a/src/Stitching/Stitching.Tests/HttpResponseDeserializerTests.cs b/src/Stitching/Stitching.Tests/Utilities/HttpResponseDeserializerTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/HttpResponseDeserializerTests.cs rename to src/Stitching/Stitching.Tests/Utilities/HttpResponseDeserializerTests.cs diff --git a/src/Stitching/Stitching.Tests/MergeQueryRewriterTests.cs b/src/Stitching/Stitching.Tests/Utilities/MergeQueryRewriterTests.cs similarity index 100% rename from src/Stitching/Stitching.Tests/MergeQueryRewriterTests.cs rename to src/Stitching/Stitching.Tests/Utilities/MergeQueryRewriterTests.cs diff --git a/src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_A.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_A.snap similarity index 93% rename from src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_A.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_A.snap index c3b31f7b625..174b4e078fd 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_A.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_A.snap @@ -1,3 +1,3 @@ { "_a_customer": "customer" -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_B.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_B.snap similarity index 93% rename from src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_B.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_B.snap index d0821d32d83..11fead6f8a2 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/AliasesMapIsCorrect_B.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/AliasesMapIsCorrect_B.snap @@ -1,3 +1,3 @@ { "_b_customer": "customer" -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_bool.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_bool.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_bool.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_bool.snap index d7c2270f9cf..7d18155ae44 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_bool.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_bool.snap @@ -18,4 +18,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_flot.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_flot.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_flot.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_flot.snap index e67568572a9..40548b46f45 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_flot.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_flot.snap @@ -18,4 +18,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_int.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_int.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_int.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_int.snap index 23f5d595c26..05b8865f516 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_int.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_int.snap @@ -18,4 +18,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_string.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_string.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_string.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_string.snap index 320ac5c749c..b198836a6eb 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/DeserializeQueryResult_string.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/DeserializeQueryResult_string.snap @@ -18,4 +18,4 @@ }, "Extensions": {}, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQuery.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQuery.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQuery.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQuery.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithArguments.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithArguments.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithArguments.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithArguments.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithFragmentDefs.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithFragmentDefs.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithFragmentDefs.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithFragmentDefs.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithInlineFragment.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithInlineFragment.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithInlineFragment.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithInlineFragment.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithUnion.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithUnion.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithUnion.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithUnion.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithVariables.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithVariables.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithVariables.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_Stitching.graphql_StitchingQueryWithVariables.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_StitchingComputed.graphql_StitchingQueryComputedField.graphql.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_StitchingComputed.graphql_StitchingQueryComputedField.graphql.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_StitchingComputed.graphql_StitchingQueryComputedField.graphql.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_StitchingComputed.graphql_StitchingQueryComputedField.graphql.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_WithCustomRewriters.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_WithCustomRewriters.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_WithCustomRewriters.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/ExtractFieldQuerySyntaxRewriterTests.ExtractField_WithCustomRewriters.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap similarity index 96% rename from src/Stitching/Stitching.Tests/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap index 7ae53e9bf55..d736e4122ca 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/FieldDependencyResolverTests.GetFieldDependencies.snap @@ -3,4 +3,4 @@ "TypeName": "Customer", "FieldName": "id" } -] \ No newline at end of file +] diff --git a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap index 8789287bc4a..2870ad292fe 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultOnlyErrors.snap @@ -31,4 +31,4 @@ "message": "quux" } ] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap index 6846ad21eda..874c6f32de5 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithErrors.snap @@ -47,4 +47,4 @@ "message": "quux" } ] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap similarity index 99% rename from src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap index 98bbaf56782..0d5ae4edd01 100644 --- a/src/Stitching/Stitching.Tests/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap +++ b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/HttpResponseDeserializerTests.DeserializeQueryResultWithExtensions.snap @@ -34,4 +34,4 @@ } }, "Errors": [] -} \ No newline at end of file +} diff --git a/src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.QueryWithGlobalVariables.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.QueryWithGlobalVariables.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.QueryWithGlobalVariables.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.QueryWithGlobalVariables.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.QueryWithPrivateVariables.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.QueryWithPrivateVariables.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.QueryWithPrivateVariables.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.QueryWithPrivateVariables.snap diff --git a/src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.SimpleShortHandQuery.snap b/src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.SimpleShortHandQuery.snap similarity index 100% rename from src/Stitching/Stitching.Tests/__snapshots__/MergeQueryRewriterTests.SimpleShortHandQuery.snap rename to src/Stitching/Stitching.Tests/Utilities/__snapshots__/MergeQueryRewriterTests.SimpleShortHandQuery.snap diff --git a/src/Stitching/Stitching/Merge/DirectiveInfo.cs b/src/Stitching/Stitching/Merge/DirectiveInfo.cs deleted file mode 100644 index 9c2bfafe9c6..00000000000 --- a/src/Stitching/Stitching/Merge/DirectiveInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using HotChocolate.Language; - -namespace HotChocolate.Stitching.Merge -{ - public class DirectiveInfo - : IDirectiveInfo - { - private DirectiveInfo( - DirectiveDefinitionNode definition, - ISchemaInfo schema) - { - Definition = definition - ?? throw new ArgumentNullException(nameof(definition)); - Schema = schema - ?? throw new ArgumentNullException(nameof(schema)); - - } - public DirectiveDefinitionNode Definition { get; } - - public ISchemaInfo Schema { get; } - - public static DirectiveInfo Create( - DirectiveDefinitionNode directiveDefinition, - ISchemaInfo schema) - { - return new DirectiveInfo(directiveDefinition, schema); - } - } -} diff --git a/src/Stitching/Stitching/Merge/IDirectiveInfo.cs b/src/Stitching/Stitching/Merge/IDirectiveInfo.cs deleted file mode 100644 index 6ad0672b9bc..00000000000 --- a/src/Stitching/Stitching/Merge/IDirectiveInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using HotChocolate.Language; - -namespace HotChocolate.Stitching.Merge -{ - public interface IDirectiveInfo - { - DirectiveDefinitionNode Definition { get; } - - ISchemaInfo Schema { get; } - } -} diff --git a/tools/Build.sln b/tools/Build.sln index f7c48ff353f..87be6d7380f 100644 --- a/tools/Build.sln +++ b/tools/Build.sln @@ -61,6 +61,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stitching.Tests", "..\src\S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Diagnostics.Tests", "..\src\Core\Core.Diagnostics.Tests\Core.Diagnostics.Tests.csproj", "{D79015AC-75CF-4DB2-B4F6-5323466FA51E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetClassic.Voyager", "..\src\Server\AspNetClassic.Voyager\AspNetClassic.Voyager.csproj", "{4372D7D0-4B87-4864-B92F-ED73C1D9FF63}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore.Voyager", "..\src\Server\AspNetCore.Voyager\AspNetCore.Voyager.csproj", "{46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -422,5 +426,29 @@ Global {D79015AC-75CF-4DB2-B4F6-5323466FA51E}.Release|x64.Build.0 = Release|Any CPU {D79015AC-75CF-4DB2-B4F6-5323466FA51E}.Release|x86.ActiveCfg = Release|Any CPU {D79015AC-75CF-4DB2-B4F6-5323466FA51E}.Release|x86.Build.0 = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|x64.ActiveCfg = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|x64.Build.0 = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|x86.ActiveCfg = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Debug|x86.Build.0 = Debug|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|Any CPU.Build.0 = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|x64.ActiveCfg = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|x64.Build.0 = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|x86.ActiveCfg = Release|Any CPU + {4372D7D0-4B87-4864-B92F-ED73C1D9FF63}.Release|x86.Build.0 = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|x64.ActiveCfg = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|x64.Build.0 = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|x86.ActiveCfg = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Debug|x86.Build.0 = Debug|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|Any CPU.Build.0 = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|x64.ActiveCfg = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|x64.Build.0 = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|x86.ActiveCfg = Release|Any CPU + {46B64A6D-0B1C-4F37-9188-3FCE6F991BD3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal