public void Deserialize_ClrTypeIsObject_ValueIsDictionary()
        {
            // arrange
            ISchema schema = SchemaBuilder.New()
                             .AddQueryType(c => c
                                           .Name("Query")
                                           .Field("foo")
                                           .Type <StringType>()
                                           .Resolver("bar"))
                             .AddType(new InputObjectType(d => d
                                                          .Name("Bar")
                                                          .Field("name")
                                                          .Type <StringType>()))
                             .Create();

            InputObjectType type =
                schema.GetType <InputObjectType>("Bar");

            // act
            bool result = type.TryDeserialize(
                new Dictionary <string, object>
            {
                { "name", "foo" }
            },
                out object value);

            // assert
            Assert.IsType <Dictionary <string, object> >(value);
        }
        public void Deserialize_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
            var result = type.TryDeserialize(
                new Dictionary <string, object>
            {
                { "name", "foo" }
            },
                out object value);

            // assert
            Assert.True(result);
            Assert.Equal("foo", Assert.IsType <SimpleInput>(value).Name);
        }
        public void Deserialize_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
            bool result = type.TryDeserialize(null, out object value);

            // assert
            Assert.Null(value);
        }