public void SetUp() { this.schema = new GraphQLSchema(); var rootType = new RootQueryType(); var nestedType = new NestedQueryType(); nestedType.Field("howdy", () => "xzyt"); var anotherSestedType = new AnotherNestedQueryType(); anotherSestedType.Field("stuff", () => "a"); nestedType.Field("anotherNested", () => anotherSestedType); rootType.Field("nested", () => nestedType); var typeWithAccessor = new CustomObject(); typeWithAccessor.Field("Hello", e => e.Hello); typeWithAccessor.Field("Test", e => e.Test); rootType.Field("acessorBasedProp", () => new TestType() { Hello = "world", Test = "stuff" }); this.schema.AddKnownType(rootType); this.schema.AddKnownType(anotherSestedType); this.schema.AddKnownType(nestedType); this.schema.AddKnownType(typeWithAccessor); this.schema.Query(rootType); }
public void SetUp() { this.schema = new GraphQLSchema(); var rootType = new RootQueryType(); var nestedType = new NestedQueryType(); nestedType.Field("howdy", () => "xzyt"); var anotherSestedType = new AnotherNestedQueryType(); anotherSestedType.Field("stuff", () => "a"); nestedType.Field("anotherNested", () => anotherSestedType); rootType.Field("nested", () => nestedType); var typeWithAccessor = new CustomObject(); typeWithAccessor.Field("Hello", e => e.Hello); typeWithAccessor.Field("Test", e => e.Test); var anotherTypeWithAccessor = new AnotherCustomObject(); anotherTypeWithAccessor.Field("Hello", e => e.Hello); anotherTypeWithAccessor.Field("World", e => e.World); var customInterface = new CustomInterface(); customInterface.Field("hello", e => e.Hello); rootType.Field("acessorBasedProp", () => new TestType() { Hello = "world", Test = "stuff" }); rootType.Field("testTypes", () => new ITestInterface[] { new TestType { Hello = "world", Test = "stuff" }, new AnotherTestType { Hello = "world", World = "hello" } }); this.schema.AddKnownType(new TestEnumType()); this.schema.AddKnownType(rootType); this.schema.AddKnownType(anotherSestedType); this.schema.AddKnownType(nestedType); this.schema.AddKnownType(typeWithAccessor); this.schema.AddKnownType(anotherTypeWithAccessor); this.schema.AddKnownType(customInterface); this.schema.Query(rootType); }