public void Field_Ignore_PropertyIsExcluded()
        {
            // arrange
            var descriptor = new InputObjectTypeDescriptor <SimpleInput>();
            IInputObjectTypeDescriptor <SimpleInput> descriptorItf = descriptor;

            // act
            descriptorItf.Field(t => t.Id).Ignore();

            // assert
            InputObjectTypeDescription description =
                descriptor.CreateDescription();

            Assert.Collection(description.Fields,
                              t => Assert.Equal("name", t.Name));
        }
Example #2
0
        private void Initialize(Action <IInputObjectTypeDescriptor> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            InputObjectTypeDescriptor descriptor = CreateDescriptor();

            configure(descriptor);

            InputObjectTypeDescription description = descriptor.CreateDescription();

            NativeType  = description.NativeType;
            SyntaxNode  = description.SyntaxNode;
            Name        = description.Name;
            Description = description.Description;
            Fields      = new FieldCollection <InputField>(
                description.Fields.Select(t => new InputField(t)));
        }
        private void Initialize(Action <IInputObjectTypeDescriptor> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            InputObjectTypeDescriptor descriptor = CreateDescriptor();

            configure(descriptor);

            InputObjectTypeDescription description =
                descriptor.CreateDescription();

            ClrType    = description.ClrType ?? typeof(object);
            SyntaxNode = description.SyntaxNode;
            Fields     = new FieldCollection <InputField>(
                description.Fields.Select(t => new InputField(t)));

            Initialize(description.Name, description.Description,
                       new DirectiveCollection(this,
                                               DirectiveLocation.InputObject,
                                               description.Directives));
        }