public void PrintSchema_DoesntPrintSchemaOfCommonNames() { this.schema = new GraphQLSchema(); var query = new TestObjectType("Query", this.schema); query.Field("foo", () => default(string)); this.schema.Query(query); var mutation = new TestMutationType("Mutation", this.schema); mutation.Field("foo", () => default(int)); this.schema.Mutation(mutation); var subscription = new TestSubscriptionType("Subscription", this.schema); subscription.Field("foo", () => default(ID)); this.schema.Subscription(subscription); var result = SchemaUtils.PrintSchema(this.schema); this.AreEqual(@" type Mutation { foo: Int! } type Query { foo: String } type Subscription { foo: ID! }", result); }
public void PrintSchema_PrintsMultipleInterfaces() { new TestInterfaceType <IFoo>("Foo", this.schema) .Field("str", e => default(string)); new TestInterfaceType <IBaaz>("Baaz", this.schema) .Field("int", e => default(int?)); var bar = new TestObjectType <BarIFooIBaaz>("Bar", this.schema); bar.Field("str", () => default(string)); bar.Field("int", () => default(int?)); this.root.Field("bar", () => default(BarIFooIBaaz)); var result = SchemaUtils.PrintSchema(this.schema); this.AreEqual(@" schema { query: Root } interface Baaz { int: Int } type Bar implements Foo, Baaz { str: String int: Int } interface Foo { str: String } type Root { bar: Bar } ", result); }
public void PrintSchema_PrintsOperationDefinitions() { this.schema = new GraphQLSchema(); var query = new TestObjectType("QueryRoot", this.schema); query.Field("foo", () => default(string)); this.schema.Query(query); var mutation = new TestMutationType("MutationRoot", this.schema); mutation.Field("foo", () => default(int)); this.schema.Mutation(mutation); var subscription = new TestSubscriptionType("SubscriptionRoot", this.schema); subscription.Field("foo", () => default(ID)); this.schema.Subscription(subscription); var result = SchemaUtils.PrintSchema(this.schema); this.AreEqual(@" schema { query: QueryRoot mutation: MutationRoot subscription: SubscriptionRoot } type MutationRoot { foo: Int! } type QueryRoot { foo: String } type SubscriptionRoot { foo: ID! }", result); }