Beispiel #1
0
        public void Suggest_WithBlankSecondParameter_NoExceptionAndCorrectSuggestions()
        {
            // Arrange
            ArrangeInputs(commandText: "dir ",
                          baseAddress: "https://localhost/",
                          path: "/",
                          urlsWithResponse: null,
                          out MockedShellState shellState,
                          out HttpState httpState,
                          out ICoreParseResult parseResult,
                          out _,
                          out IPreferences preferences);

            ListCommand listCommand = new ListCommand(preferences);

            // Act
            List <string> suggestions = listCommand.Suggest(shellState, httpState, parseResult).ToList();

            // Assert
            for (int optionIndex = 0; optionIndex < listCommand.InputSpec.Options.Count; optionIndex++)
            {
                CommandOptionSpecification option = listCommand.InputSpec.Options[optionIndex];
                for (int formIndex = 0; formIndex < option.Forms.Count; formIndex++)
                {
                    Assert.Contains(option.Forms[formIndex], suggestions, StringComparer.Ordinal);
                }
            }
        }
Beispiel #2
0
        public void Suggest_WithBlankSecondParameter_NoExceptionAndNullSuggestions()
        {
            ArrangeInputs(commandText: "dir ",
                          baseAddress: "https://localhost/",
                          path: "/",
                          urlsWithResponse: null,
                          out MockedShellState shellState,
                          out HttpState httpState,
                          out ICoreParseResult parseResult,
                          out _,
                          out IPreferences preferences);

            ListCommand listCommand = new ListCommand(preferences);

            IEnumerable <string> suggestions = listCommand.Suggest(shellState, httpState, parseResult);

            Assert.Empty(suggestions);
        }