public void Suggestion_command_path_is_not_case_sensitive()
        {
            ISuggestionRegistration suggestionProvider = GetSuggestionRegistration();

            suggestionProvider.AddSuggestionRegistration(
                new RegistrationPair(Path.GetFullPath("commandPath"), "suggestionCommand"));

            RegistrationPair registration = suggestionProvider.FindRegistration(new FileInfo("COMMANDPATH"));

            registration.CommandPath.Should().Be(Path.GetFullPath("commandPath"));
            registration.SuggestionCommand.Should().Be("suggestionCommand");
        }
        public async Task Register_command_adds_new_suggestion_entry()
        {
            var provider   = new TestSuggestionRegistration();
            var dispatcher = new SuggestionDispatcher(provider);

            var args = $"register --command-path \"{_netExeFullPath}\" --suggestion-command \"net-suggestions complete\"".Tokenize().ToArray();

            await dispatcher.InvokeAsync(args);

            RegistrationPair addedRegistration = provider.FindAllRegistrations().Single();

            addedRegistration.CommandPath.Should().Be(_netExeFullPath);
            addedRegistration.SuggestionCommand.Should().Be("net-suggestions complete");
        }
        public void When_duplicate_suggestions_are_registered_the_last_one_is_used()
        {
            ISuggestionRegistration suggestionProvider = GetSuggestionRegistration();

            suggestionProvider.AddSuggestionRegistration(
                new RegistrationPair(Path.GetFullPath("commandPath"), "suggestionCommand2"));

            suggestionProvider.AddSuggestionRegistration(
                new RegistrationPair(Path.GetFullPath("commandPath"), "suggestionCommand2"));

            RegistrationPair registration = suggestionProvider.FindRegistration(new FileInfo("commandPath"));

            registration.CommandPath.Should().Be(Path.GetFullPath("commandPath"));
            registration.SuggestionCommand.Should().Be("suggestionCommand2");
        }
        public void Added_suggestions_can_be_retrieved()
        {
            ISuggestionRegistration suggestionProvider = GetSuggestionRegistration();

            var suggestion1 = new RegistrationPair("commandPath1", "suggestionCommand1");
            var suggestion2 = new RegistrationPair("commandPath2", "suggestionCommand2");

            suggestionProvider.AddSuggestionRegistration(suggestion1);
            suggestionProvider.AddSuggestionRegistration(suggestion2);

            var allRegistrations = suggestionProvider.FindAllRegistrations();

            allRegistrations
            .Should()
            .HaveCount(2)
            .And
            .Contain(x =>
                     x.CommandPath == suggestion1.CommandPath && x.SuggestionCommand == suggestion1.SuggestionCommand)
            .And
            .Contain(x =>
                     x.CommandPath == suggestion2.CommandPath && x.SuggestionCommand == suggestion2.SuggestionCommand);
        }
Exemplo n.º 5
0
 public void AddSuggestionRegistration(RegistrationPair registration)
 {
     _suggestionRegistrations.Add(registration);
 }