public void ParseLiteral()
        {
            // arrange
            Schema          schema      = Create();
            InputObjectType object1Type = schema.GetType <InputObjectType>("Object1");
            ObjectValueNode literal     = CreateObjectLiteral();

            // act
            object obj = object1Type.ParseLiteral(literal);

            // assert
            Assert.IsType <SerializationInputObject1>(obj);
            Assert.Equal(Snapshot.Current(), Snapshot.New(obj));
        }
        public void ParseLiteral()
        {
            // arrange
            Schema          schema          = Create();
            InputObjectType inputObjectType = schema.GetType <InputObjectType>("Object1");
            ObjectValueNode literal         = CreateObjectLiteral();

            // act
            object obj = inputObjectType.ParseLiteral(literal);

            // assert
            Assert.IsType <SerializationInputObject1>(obj);
            obj.MatchSnapshot();
        }
        public void ParseLiteral_ValueIsStringValueNode_ArgumentException()
        {
            // 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
            Action action = () => type.ParseLiteral(new StringValueNode("foo"));

            // assert
            Assert.Throws <SerializationException>(action);
        }
        public void ParseLiteral_ValueIsNullValueNode()
        {
            // 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 result = type.ParseLiteral(NullValueNode.Default);

            // assert
            Assert.Null(result);
        }