Google Test fixture for running integration tests against the StatusCommand.
More...
#include <IntStatusCommandTest.hxx>
|
| void | SetUp () override |
| | Sets up the testing environment before each test.
|
| void | TearDown () override |
| | Tears down the testing environment after each test.
|
| void | createTestFile (const std::string &filename, const std::string &content) |
| | Creates a test file with specified content in the temporary directory.
|
| void | createTestDirectory (const std::string &dirname) |
| | Creates a test directory in the temporary location.
|
| void | stageFiles (const std::vector< std::string > &files) |
| | Stages a list of files using the RepositoryManager's staging logic.
|
| bool | containsMessage (const std::vector< Event > ¬ifications, const std::string &message) |
| | Checks if a specific message (substring) exists in any event notification.
|
| int | countMessages (const std::vector< Event > ¬ifications, const std::string &message) |
| | Counts the occurrences of a specific message (substring) across all event notifications.
|
|
|
std::shared_ptr< MockSubject > | mockEventBus |
| | Shared pointer to the mock event bus (observer).
|
|
std::shared_ptr< RepositoryManager > | repoManager |
| | Shared pointer to the repository core logic component.
|
|
std::unique_ptr< StatusCommand > | command |
| | Unique pointer to the command being tested.
|
|
std::filesystem::path | testDir |
| | Path to the temporary test repository directory.
|
Google Test fixture for running integration tests against the StatusCommand.
This fixture provides the necessary infrastructure for integration tests:
- SetUp/TearDown: Manage a temporary SVCS repository directory.
- Core Components: Instances of MockSubject (for event bus) and RepositoryManager (for core logic).
- Helper Methods: Simplify file creation, directory setup, staging, and verification of notifications.
◆ containsMessage()
| bool svcs::test::cli::utils::StatusCommandTest::containsMessage |
( |
const std::vector< Event > & | notifications, |
|
|
const std::string & | message ) |
|
protected |
Checks if a specific message (substring) exists in any event notification.
- Parameters
-
| notifications | The list of captured events. |
| message | The substring to search for. |
- Returns
- true if the message is found, false otherwise.
◆ countMessages()
| int svcs::test::cli::utils::StatusCommandTest::countMessages |
( |
const std::vector< Event > & | notifications, |
|
|
const std::string & | message ) |
|
protected |
Counts the occurrences of a specific message (substring) across all event notifications.
- Parameters
-
| notifications | The list of captured events. |
| message | The substring to count. |
- Returns
- The number of events containing the substring.
◆ createTestDirectory()
| void svcs::test::cli::utils::StatusCommandTest::createTestDirectory |
( |
const std::string & | dirname | ) |
|
|
protected |
Creates a test directory in the temporary location.
- Parameters
-
| dirname | The relative path/name of the directory. |
◆ createTestFile()
| void svcs::test::cli::utils::StatusCommandTest::createTestFile |
( |
const std::string & | filename, |
|
|
const std::string & | content ) |
|
protected |
Creates a test file with specified content in the temporary directory.
- Parameters
-
| filename | The relative path/name of the file. |
| content | The content to write to the file. |
◆ SetUp()
| void svcs::test::cli::utils::StatusCommandTest::SetUp |
( |
| ) |
|
|
overrideprotected |
Sets up the testing environment before each test.
Initializes components, creates the temporary directory, and initializes the repository.
◆ stageFiles()
| void svcs::test::cli::utils::StatusCommandTest::stageFiles |
( |
const std::vector< std::string > & | files | ) |
|
|
protected |
Stages a list of files using the RepositoryManager's staging logic.
- Parameters
-
| files | A vector of file names to stage. |
◆ TearDown()
| void svcs::test::cli::utils::StatusCommandTest::TearDown |
( |
| ) |
|
|
overrideprotected |
Tears down the testing environment after each test.
Cleans up the temporary directory and restores the working path.
The documentation for this class was generated from the following files: