예제 #1
0
        public void WithLocation()
        {
            // arrange
            Location location   = AstTestHelper.CreateDummyLocation();
            var      selections = new List <ISelectionNode>
            {
                new FieldNode
                (
                    null,
                    new NameNode("bar"),
                    null,
                    Array.Empty <DirectiveNode>(),
                    Array.Empty <ArgumentNode>(),
                    null
                )
            };

            var selectionSet = new SelectionSetNode
                               (
                null,
                selections
                               );

            // act
            selectionSet = selectionSet.WithLocation(location);

            // assert
            selectionSet.MatchSnapshot();
        }
예제 #2
0
        public void Create_Name_LocationNull_ArgumentNullException()
        {
            // arrange
            Location location = AstTestHelper.CreateDummyLocation();

            // act
            Action action = () => new VariableNode(location, null);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
예제 #3
0
        public void WithLocation_Location_NewObjectHasNewLocation()
        {
            // arrange
            var      foo      = new NameNode("foo");
            var      node     = new VariableNode(foo);
            Location location = AstTestHelper.CreateDummyLocation();

            // act
            node = node.WithLocation(location);

            // assert
            Assert.Equal(location, node.Location);
        }
예제 #4
0
        public void Create_Name_LocationFoo_LocationAndNameIsPassed()
        {
            // arrange
            var      name     = new NameNode("foo");
            Location location = AstTestHelper.CreateDummyLocation();

            // act
            var node = new VariableNode(location, name);

            // assert
            Assert.Equal(location, node.Location);
            Assert.Equal(name, node.Name);
        }
        public void WithLocation()
        {
            // arrange
            var name        = new NameNode("foo");
            var description = new StringValueNode("bar");
            var arguments   = new List <InputValueDefinitionNode>();
            var locations   = new List <NameNode>();

            var directiveDefinition = new DirectiveDefinitionNode(
                null, name, description, true,
                arguments, locations);

            // act
            directiveDefinition = directiveDefinition
                                  .WithLocation(AstTestHelper.CreateDummyLocation());

            // assert
            directiveDefinition.MatchSnapshot();
        }