public void ParseValue_Foo() { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType(d => d .Name("Query") .Field("foo") .Type <AnyType>() .Argument("input", a => a.Type <AnyType>()) .Resolver(ctx => ctx.Argument <object>("input"))) .Create(); AnyType type = schema.GetType <AnyType>("Any"); // act IValueNode literal = type.ParseValue(new Foo()); // assert Assert.IsType <ObjectValueNode>(literal); }
public void ParseValue_ScalarValues(object value, Type expectedType) { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType(d => d .Name("Query") .Field("foo") .Type <AnyType>() .Argument("input", a => a.Type <AnyType>()) .Resolver(ctx => ctx.Argument <object>("input"))) .Create(); AnyType type = schema.GetType <AnyType>("Any"); // act IValueNode literal = type.ParseValue(value); // assert Assert.IsType(expectedType, literal); }