示例#1
0
        public async Task CanSendGetCommentHelpRequest()
        {
            string scriptPath = NewTestFile(@"
function CanSendGetCommentHelpRequest {
    param(
        [string]
        $myParam
    )
}
");

            CommentHelpRequestResult commentHelpRequestResult =
                await LanguageClient.SendRequest <CommentHelpRequestResult>(
                    "powerShell/getCommentHelp",
                    new CommentHelpRequestParams
            {
                DocumentUri     = new Uri(scriptPath).ToString(),
                BlockComment    = false,
                TriggerPosition = new Position
                {
                    Line      = 0,
                    Character = 0
                }
            });

            Assert.NotEmpty(commentHelpRequestResult.Content);
            Assert.Contains("myParam", commentHelpRequestResult.Content[7]);
        }
示例#2
0
        public async Task CanSendGetCommentHelpRequest()
        {
            string scriptPath = NewTestFile(@"
function CanSendGetCommentHelpRequest {
    param(
        $myParam,
        $myOtherParam,
        $yetAnotherParam
    )

    # Include other problematic code to make sure this still works
    gci
}
");

            CommentHelpRequestResult commentHelpRequestResult =
                await LanguageClient.SendRequest <CommentHelpRequestResult>(
                    "powerShell/getCommentHelp",
                    new CommentHelpRequestParams
            {
                DocumentUri     = new Uri(scriptPath).ToString(),
                BlockComment    = false,
                TriggerPosition = new Position
                {
                    Line      = 0,
                    Character = 0
                }
            });

            Assert.NotEmpty(commentHelpRequestResult.Content);
            Assert.Contains("myParam", commentHelpRequestResult.Content[7]);
        }
示例#3
0
        public async Task CanSendGetCommentHelpRequestAsync()
        {
            Skip.If(
                PsesStdioProcess.RunningInConstainedLanguageMode && PsesStdioProcess.IsWindowsPowerShell,
                "Windows PowerShell doesn't trust PSScriptAnalyzer by default so it won't load.");

            string scriptPath = NewTestFile(@"
function CanSendGetCommentHelpRequest {
    param(
        $myParam,
        $myOtherParam,
        $yetAnotherParam
    )

    # Include other problematic code to make sure this still works
    gci
}
");

            CommentHelpRequestResult commentHelpRequestResult =
                await PsesLanguageClient
                .SendRequest <CommentHelpRequestParams>(
                    "powerShell/getCommentHelp",
                    new CommentHelpRequestParams
            {
                DocumentUri     = new Uri(scriptPath).ToString(),
                BlockComment    = false,
                TriggerPosition = new Position
                {
                    Line      = 0,
                    Character = 0
                }
            })
                .Returning <CommentHelpRequestResult>(CancellationToken.None).ConfigureAwait(false);

            Assert.NotEmpty(commentHelpRequestResult.Content);
            Assert.Contains("myParam", commentHelpRequestResult.Content[7]);
        }