SVCS - English Documentation
Loading...
Searching...
No Matches
IntStatusCommandTest.hxx
Go to the documentation of this file.
1
21
22#pragma once
23
24#include <gtest/gtest.h>
25#include <memory>
26#include <vector>
27#include <string>
28#include <filesystem>
29
32
48namespace svcs::test::cli::utils {
49
50using svcs::services::Event;
54
74class StatusCommandTest : public ::testing::Test {
75protected:
85 void SetUp() override;
86
96 void TearDown() override;
97
109 void createTestFile(const std::string& filename, const std::string& content);
110
120 void createTestDirectory(const std::string& dirname);
121
131 void stageFiles(const std::vector<std::string>& files);
132
146 bool containsMessage(const std::vector<Event>& notifications, const std::string& message);
147
161 int countMessages(const std::vector<Event>& notifications, const std::string& message);
162
170 std::shared_ptr<MockSubject> mockEventBus;
171
179 std::shared_ptr<RepositoryManager> repoManager;
180
188 std::unique_ptr<StatusCommand> command;
189
197 std::filesystem::path testDir;
198};
199
200}
Declaration of the StatusCommand class for showing repository status.
Command for showing the current status of the repository.
Definition StatusCommand.hxx:43
Manages all physical file and directory operations within the SVCS repository.
Definition RepositoryManager.hxx:83
A mock implementation of ISubject for testing event-driven components.
Definition MockSubject.hxx:43
Google Test fixture for running integration tests against the StatusCommand.
Definition IntStatusCommandTest.hxx:51
void stageFiles(const std::vector< std::string > &files)
Stages a list of files using the RepositoryManager's staging logic.
Definition IntStatusCommandTest.cxx:62
void createTestFile(const std::string &filename, const std::string &content)
Creates a test file with specified content in the temporary directory.
Definition IntStatusCommandTest.cxx:52
void createTestDirectory(const std::string &dirname)
Creates a test directory in the temporary location.
Definition IntStatusCommandTest.cxx:58
std::unique_ptr< StatusCommand > command
Unique pointer to the command being tested.
Definition IntStatusCommandTest.hxx:123
std::shared_ptr< MockSubject > mockEventBus
Shared pointer to the mock event bus (observer).
Definition IntStatusCommandTest.hxx:111
bool containsMessage(const std::vector< Event > &notifications, const std::string &message)
Checks if a specific message (substring) exists in any event notification.
Definition IntStatusCommandTest.cxx:68
std::filesystem::path testDir
Path to the temporary test repository directory.
Definition IntStatusCommandTest.hxx:129
void TearDown() override
Tears down the testing environment after each test.
Definition IntStatusCommandTest.cxx:46
std::shared_ptr< RepositoryManager > repoManager
Shared pointer to the repository core logic component.
Definition IntStatusCommandTest.hxx:117
int countMessages(const std::vector< Event > &notifications, const std::string &message)
Counts the occurrences of a specific message (substring) across all event notifications.
Definition IntStatusCommandTest.cxx:75
void SetUp() override
Sets up the testing environment before each test.
Definition IntStatusCommandTest.cxx:23
Mock implementation of the ISubject interface for unit testing purposes.
Utility classes and test fixtures for CLI command testing.
Definition ClearCommandTest.cxx:17