コード例 #1
0
        public void WithType_TypeIsNull_ArgumentException()
        {
            // arrange
            var variableDefinition = new VariableDefinitionNode(
                new Location(1, 2, 3, 5),
                new VariableNode(new NameNode("foo")),
                new NamedTypeNode(new NameNode("bar")),
                new StringValueNode("baz"),
                new List <DirectiveNode>
            {
                new DirectiveNode("qux")
            });

            // act
            Action action = () =>
                            variableDefinition.WithType(null);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #2
0
        public void WithType()
        {
            // arrange
            var variableDefinition = new VariableDefinitionNode(
                new Location(1, 2, 3, 5),
                new VariableNode(new NameNode("foo")),
                new NamedTypeNode(new NameNode("bar")),
                new StringValueNode("baz"),
                new List <DirectiveNode>
            {
                new DirectiveNode("qux")
            });

            // act
            variableDefinition =
                variableDefinition.WithType(
                    new NamedTypeNode(new NameNode("quux")));

            // assert
            variableDefinition.MatchSnapshot();
        }