SVCS - English Documentation
Loading...
Searching...
No Matches
IntSaveCommandTest.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 SaveCommandTest : 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
122
131 void stageFiles(const std::vector<std::string>& files);
132
146 bool containsMessage(const std::vector<Event>& notifications, const std::string& message);
147
155 std::shared_ptr<MockSubject> mockEventBus;
156
164 std::shared_ptr<RepositoryManager> repoManager;
165
173 std::unique_ptr<SaveCommand> command;
174
182 std::filesystem::path testDir;
183};
184
185}
Declaration of the SaveCommand class for saving (committing) staged changes.
Command for saving (committing) staged changes to the repository.
Definition SaveCommand.hxx:37
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 SaveCommand (commit).
Definition IntSaveCommandTest.hxx:51
std::shared_ptr< RepositoryManager > repoManager
Shared pointer to the repository core logic component.
Definition IntSaveCommandTest.hxx:108
std::shared_ptr< MockSubject > mockEventBus
Shared pointer to the mock event bus (observer).
Definition IntSaveCommandTest.hxx:102
std::filesystem::path testDir
Path to the temporary test repository directory.
Definition IntSaveCommandTest.hxx:120
std::unique_ptr< SaveCommand > command
Unique pointer to the command being tested.
Definition IntSaveCommandTest.hxx:114
void stageFiles(const std::vector< std::string > &files)
Stages a list of files using the RepositoryManager's staging logic.
Definition IntSaveCommandTest.cxx:60
void createTestDirectory(const std::string &dirname)
Creates a test directory in the temporary location.
Definition IntSaveCommandTest.cxx:56
bool containsMessage(const std::vector< Event > &notifications, const std::string &message)
Checks if a specific message (substring) exists in any event notification.
Definition IntSaveCommandTest.cxx:66
void TearDown() override
Tears down the testing environment after each test.
Definition IntSaveCommandTest.cxx:44
void SetUp() override
Sets up the testing environment before each test.
Definition IntSaveCommandTest.cxx:22
void createTestFile(const std::string &filename, const std::string &content)
Creates a test file with specified content in the temporary directory.
Definition IntSaveCommandTest.cxx:50
Mock implementation of the ISubject interface for unit testing purposes.
Utility classes and test fixtures for CLI command testing.
Definition ClearCommandTest.cxx:17