Beispiel #1
0
        protected DirectiveArgumentDescriptor Argument(NameString name)
        {
            var descriptor = new DirectiveArgumentDescriptor(
                name.EnsureNotEmpty(nameof(name)));

            _arguments.Add(descriptor);
            return(descriptor);
        }
        protected DirectiveArgumentDescriptor Argument(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(
                          "The directive argument name cannot be null or empty.",
                          nameof(name));
            }

            if (!ValidationHelper.IsArgumentNameValid(name))
            {
                throw new ArgumentException(
                          "The specified name is not a valid " +
                          "GraphQL directive argument name.",
                          nameof(name));
            }

            var descriptor = new DirectiveArgumentDescriptor(name);

            _arguments.Add(descriptor);
            return(descriptor);
        }
Beispiel #3
0
 protected DirectiveArgumentDescriptor Argument(
     DirectiveArgumentDescriptor descriptor)
 {
     _arguments.Add(descriptor);
     return(descriptor);
 }
        public void Type_Syntax_Type_Null()
        {
            void Error() => DirectiveArgumentDescriptor.New(Context, "foo").Type((string)null);

            Assert.Throws <ArgumentNullException>(Error);
        }