protected InterfaceFieldDescriptor Field(NameString name)
        {
            var fieldDescriptor = new InterfaceFieldDescriptor(
                name.EnsureNotEmpty(nameof(name)));

            Fields.Add(fieldDescriptor);
            return(fieldDescriptor);
        }
Exemple #2
0
        private static InterfaceFieldDescription ExecuteConfigure(
            Action <IInterfaceFieldDescriptor> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var descriptor = new InterfaceFieldDescriptor();

            configure(descriptor);
            return(descriptor.CreateDescription());
        }
Exemple #3
0
        protected InterfaceFieldDescriptor Field(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(
                          "The field name cannot be null or empty.",
                          nameof(name));
            }

            if (!ValidationHelper.IsFieldNameValid(name))
            {
                throw new ArgumentException(
                          "The specified name is not a valid GraphQL field name.",
                          nameof(name));
            }

            var fieldDescriptor = new InterfaceFieldDescriptor(name);

            Fields.Add(fieldDescriptor);
            return(fieldDescriptor);
        }
Exemple #4
0
        public void Type_Syntax_Type_Null()
        {
            void Error() => InterfaceFieldDescriptor.New(Context, "foo").Type((string)null);

            Assert.Throws <ArgumentNullException>(Error);
        }