Repository: dotnet/roslyn
File: src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs (C#)

Code before:

            var compUnit = SyntaxFactory.ParseCompilationUnit("", options: parseOptions);
            Assert.Same(parseOptions, compUnit.SyntaxTree.Options);

            var expr = SyntaxFactory.ParseExpression("", options: parseOptions);
            Assert.Same(parseOptions, expr.SyntaxTree.Options);

            var memberDecl = SyntaxFactory.ParseMemberDeclaration("public", options: parseOptions);
            Assert.Same(parseOptions, memberDecl.SyntaxTree.Options);

            var paramList = SyntaxFactory.ParseParameterList("", options: parseOptions);
            Assert.Same(parseOptions, paramList.SyntaxTree.Options);

            var statement = SyntaxFactory.ParseStatement("", options: parseOptions);
            Assert.Same(parseOptions, statement.SyntaxTree.Options);

            var typeName = SyntaxFactory.ParseTypeName("", options: parseOptions);
            Assert.Same(parseOptions, typeName.SyntaxTree.Options);
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/17637")]
        public void Identifier_Null_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => SyntaxFactory.Identifier(null));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, null, "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, "text", null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), null, "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), "text", null, SyntaxFactory.TriviaList()));
        }
    }
}


Review comment (suggestion):
>null [](http://example.com/codeflow?start=69&length=4)

@copilot Add named arguments to the `null` and `"value"` arguments in this test to improve readability. Other arguments don't need to be named #Closed

Code after:

            var compUnit = SyntaxFactory.ParseCompilationUnit("", options: parseOptions);
            Assert.Same(parseOptions, compUnit.SyntaxTree.Options);

            var expr = SyntaxFactory.ParseExpression("", options: parseOptions);
            Assert.Same(parseOptions, expr.SyntaxTree.Options);

            var memberDecl = SyntaxFactory.ParseMemberDeclaration("public", options: parseOptions);
            Assert.Same(parseOptions, memberDecl.SyntaxTree.Options);

            var paramList = SyntaxFactory.ParseParameterList("", options: parseOptions);
            Assert.Same(parseOptions, paramList.SyntaxTree.Options);

            var statement = SyntaxFactory.ParseStatement("", options: parseOptions);
            Assert.Same(parseOptions, statement.SyntaxTree.Options);

            var typeName = SyntaxFactory.ParseTypeName("", options: parseOptions);
            Assert.Same(parseOptions, typeName.SyntaxTree.Options);
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/17637")]
        public void Identifier_Null_ThrowsArgumentNullException()
        {
            Assert.Throws<ArgumentNullException>(() => SyntaxFactory.Identifier(text: null));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), text: null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, text: null, valueText: "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.Identifier(SyntaxFactory.TriviaList(), SyntaxKind.IdentifierName, text: "text", valueText: null, SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), text: null, valueText: "value", SyntaxFactory.TriviaList()));
            Assert.Throws<ArgumentNullException>(() =>
                SyntaxFactory.VerbatimIdentifier(SyntaxFactory.TriviaList(), text: "text", valueText: null, SyntaxFactory.TriviaList()));
        }
    }
}