public void AddDirectiveWithArgument()
        {
            // arrange
            var descriptor = EnumTypeDescriptor.New(Context);

            // act
            IEnumTypeDescriptor desc = descriptor;

            desc.Directive("Bar",
                           new ArgumentNode("a", new StringValueNode("b")));

            // assert
            EnumTypeDefinition description = descriptor.CreateDefinition();

            Assert.Collection(description.Directives,
                              t =>
            {
                Assert.Equal("Bar", t.ParsedDirective.Name.Value);
                Assert.Collection(t.ParsedDirective.Arguments,
                                  x =>
                {
                    Assert.Equal("a", x.Name.Value);
                    Assert.IsType <StringValueNode>(x.Value);
                    Assert.Equal("b", ((StringValueNode)x.Value).Value);
                });
            });
        }
        public void AddDirectiveWithDirectiveNode()
        {
            // arrange
            var descriptor = EnumTypeDescriptor.New(Context);

            // act
            IEnumTypeDescriptor desc = descriptor;

            desc.Directive(new DirectiveNode("Bar"));

            // assert
            EnumTypeDefinition description = descriptor.CreateDefinition();

            Assert.Collection(description.Directives,
                              t => Assert.Equal("Bar", t.ParsedDirective.Name.Value));
        }
Beispiel #3
0
        public void AddDirective()
        {
            // arrange
            var descriptor = new EnumTypeDescriptor("Foo");

            // act
            IEnumTypeDescriptor desc = descriptor;

            desc.Directive("Bar");

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

            Assert.Collection(description.Directives,
                              t => Assert.Equal("Bar", t.ParsedDirective.Name.Value));
        }