public void Serialize_ValueIsDictionary() { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType(c => c .Name("Query") .Field("foo") .Type <StringType>() .Resolver("bar")) .AddType(new InputObjectType <SimpleInput>(d => d .Ignore(t => t.Id))) .Create(); InputObjectType type = schema.GetType <InputObjectType>("SimpleInput"); // act object serialized = type.Serialize( new Dictionary <string, object> { { "name", "foo" } }); // assert serialized.MatchSnapshot(); }
public void Serialize_ValueIsNull() { // arrange ISchema schema = SchemaBuilder.New() .AddQueryType(c => c .Name("Query") .Field("foo") .Type <StringType>() .Resolver("bar")) .AddType(new InputObjectType <SimpleInput>(d => d .Ignore(t => t.Id))) .Create(); InputObjectType type = schema.GetType <InputObjectType>("SimpleInput"); // act object serialized = type.Serialize(null); // assert Assert.Null(serialized); }