-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from graphql-dotnet/dependency-injection
Dependency Injection Fixes
- Loading branch information
Showing
13 changed files
with
264 additions
and
17 deletions.
There are no files selected for viewing
Submodule graphql-dotnet
updated
6 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
test/GraphQL.Conventions.Tests/Adapters/Engine/AbstractTypeConstructionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using GraphQL.Conventions.Adapters.Engine; | ||
using GraphQL.Conventions.Tests.Templates; | ||
using GraphQL.Conventions.Tests.Templates.Extensions; | ||
using GraphQL.Conventions.Types; | ||
using Xunit; | ||
|
||
namespace GraphQL.Conventions.Tests.Adapters.Engine | ||
{ | ||
public class AbstractTypeConstructionTests : TestBase | ||
{ | ||
[Fact] | ||
public void Can_Construct_And_Describe_Schema_From_Abstract_Types() | ||
{ | ||
var engine = new GraphQLEngine(); | ||
engine.BuildSchema(typeof(SchemaDefinition<Query>)); | ||
var schema = engine.Describe(); | ||
schema.ShouldEqualWhenReformatted(@" | ||
type Query { | ||
commonField: Date! | ||
someOtherField: String | ||
} | ||
"); | ||
} | ||
|
||
[Fact] | ||
public async void Can_Execute_Query_On_Schema_From_Abstract_Types() | ||
{ | ||
var engine = new GraphQLEngine(); | ||
engine.BuildSchema(typeof(SchemaDefinition<Query>)); | ||
var result = await engine | ||
.NewExecutor() | ||
.WithQueryString("{ commonField someOtherField }") | ||
.EnableValidation() | ||
.Execute(); | ||
|
||
result.ShouldHaveNoErrors(); | ||
result.Data.ShouldHaveFieldWithValue("commonField", default(DateTime)); | ||
result.Data.ShouldHaveFieldWithValue("someOtherField", string.Empty); | ||
} | ||
|
||
abstract class EntityQuery<T> | ||
{ | ||
public T CommonField => default(T); | ||
} | ||
|
||
class Query : EntityQuery<DateTime> | ||
{ | ||
public string SomeOtherField => string.Empty; | ||
} | ||
} | ||
} |
Oops, something went wrong.