A mock implementation of the HelpService for testing the HelpCommand.
More...
#include <MockHelpService.hxx>
A mock implementation of the HelpService for testing the HelpCommand.
This mock allows test cases to:
- Configure the list of available commands.
- Configure the descriptions for specific commands.
- Verify which command's help was requested by the HelpCommand.
- Use the provided MockSubject for emitting debug information during testing.
◆ MockHelpService()
| svcs::test::cli::mocks::MockHelpService::MockHelpService |
( |
const std::shared_ptr< MockSubject > & | mockEventBus | ) |
|
|
inlineexplicit |
◆ getAvailableCommands()
| std::vector< std::string > svcs::test::cli::mocks::MockHelpService::getAvailableCommands |
( |
| ) |
const |
|
inlinenodiscard |
Returns the pre-configured list of available commands.
- Returns
- A vector of command names.
◆ getCommandDescription()
| std::string svcs::test::cli::mocks::MockHelpService::getCommandDescription |
( |
const std::string & | commandName | ) |
const |
|
inlinenodiscard |
Returns the pre-configured description for a given command.
- Parameters
-
| commandName | The name of the command. |
- Returns
- The configured description, or "No description available" if not set.
◆ setAvailableCommands()
| void svcs::test::cli::mocks::MockHelpService::setAvailableCommands |
( |
const std::vector< std::string > & | commands | ) |
|
|
inline |
Sets the list of command names to be returned by getAvailableCommands().
- Parameters
-
| commands | The vector of command names. |
◆ setCommandDescription()
| void svcs::test::cli::mocks::MockHelpService::setCommandDescription |
( |
const std::string & | commandName, |
|
|
const std::string & | description ) |
|
inline |
Configures a description for a specific command name.
- Parameters
-
| commandName | The name of the command. |
| description | The description to return for that command. |
◆ showCommandHelp()
| void svcs::test::cli::mocks::MockHelpService::showCommandHelp |
( |
const std::string & | commandName | ) |
|
|
inline |
Records that help was requested for the given command.
Also emits a debug message to the mock event bus.
- Parameters
-
| commandName | The name of the command whose help is requested. |
◆ showGeneralHelp()
| void svcs::test::cli::mocks::MockHelpService::showGeneralHelp |
( |
| ) |
|
|
inline |
Records that general help was requested.
Also emits a debug message to the mock event bus.
◆ wasCommandHelpCalled()
| bool svcs::test::cli::mocks::MockHelpService::wasCommandHelpCalled |
( |
const std::string & | commandName | ) |
const |
|
inlinenodiscard |
Checks if showCommandHelp() was called for a specific command.
- Parameters
-
| commandName | The name of the command to check. |
- Returns
- true if showCommandHelp() was called with this name, false otherwise.
◆ wasGeneralHelpCalled()
| bool svcs::test::cli::mocks::MockHelpService::wasGeneralHelpCalled |
( |
| ) |
const |
|
inlinenodiscard |
The documentation for this class was generated from the following file: