public void SetUp() { this.schemaObserver = Substitute.For <ISchemaObserver>(); this.schemaObserver.GetSchemaTypeFor(typeof(TestStruct)).Returns(new TestScructObject()); this.schemaObserver.GetSchemaTypeFor(typeof(FurColor)).Returns(new FurColorEnum()); this.translator = new TypeTranslator(this.schemaObserver); }
public TypeTranslator(ISchemaObserver schemaObserver) { this.bindings = new Dictionary <Type, GraphQLScalarType>(); this.schemaObserver = schemaObserver; this.RegisterBindings(); this.RegisterScalarsToSchemeObserver(); }
public GraphQLSchema() { this.schemaObserver = new SchemaObserver(); this.TypeTranslator = new TypeTranslator(this.schemaObserver); this.introspector = new Introspector(this.TypeTranslator); this.IntrospectedSchema = new IntrospectedSchemaType(this.schemaObserver, this.introspector, this); this.RegisterIntrospectionTypes(); }
public void SetUp() { this.typeTranslator = Substitute.For <ITypeTranslator>(); this.schemaObserver = Substitute.For <ISchemaObserver>(); this.typeTranslator.GetInputType(typeof(int?)).Returns(new GraphQLInt()); this.typeTranslator.GetType(typeof(int?)).Returns(new GraphQLInt()); this.complicatedObjectTypeObserver = new ObjectTypeTranslator(new ComplicatedObjectType(), this.typeTranslator, this.schemaObserver); this.complicatedArgsObserver = new ObjectTypeTranslator(new ComplicatedArgs(), this.typeTranslator, this.schemaObserver); }
public IntrospectedSchemaType( ISchemaObserver schemaObserver, IIntrospector introspector, IGraphQLSchema schema) : base( "__Schema", "A GraphQL Schema defines the capabilities of a GraphQL server. It " + "exposes all available types and directives on the server, as well as " + "the entry points for query, mutation, and subscription operations.") { this.introspector = introspector; this.schemaObserver = schemaObserver; this.schema = schema; this.Field("types", () => this.Introspect()); this.Field("queryType", () => introspector.Introspect(this.schema.QueryType)); this.Field("mutationType", () => introspector.Introspect(this.schema.MutationType)); }
public ObjectTypeTranslator(GraphQLNullableType objectType, ITypeTranslator typeTranslator, ISchemaObserver schemaObserver) { this.objectType = objectType; this.typeTranslator = typeTranslator; this.schemaObserver = schemaObserver; }