26#include <gtest/gtest.h>
87 void SetUp()
override;
111 void createTestFile(
const std::string& filename,
const std::string& content)
const;
133 void stageFiles(
const std::vector<std::string>& files);
163 static bool containsMessage(
const std::vector<Event>& notifications,
const std::string& message);
178 static int countMessages(
const std::vector<Event>& notifications,
const std::string& message);
218 std::unique_ptr<UndoCommand>
command;
Declaration of the UndoCommand class for reverting changes.
Command to revert the repository state to a previous commit.
Definition UndoCommand.hxx:44
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 UndoCommand.
Definition IntUndoCommandTest.hxx:52
std::unique_ptr< UndoCommand > command
Unique pointer to the command being tested.
Definition IntUndoCommandTest.hxx:141
bool createTestCommit(const std::string &message)
Creates a new commit (save) with a specified message.
Definition IntUndoCommandTest.cxx:67
std::shared_ptr< MockSubject > mockEventBus
Shared pointer to the mock event bus (observer/input simulator).
Definition IntUndoCommandTest.hxx:129
void SetUp() override
Sets up the testing environment before each test.
Definition IntUndoCommandTest.cxx:24
static bool containsMessage(const std::vector< Event > ¬ifications, const std::string &message)
Checks if a specific message (substring) exists in any event notification.
Definition IntUndoCommandTest.cxx:72
void createTestDirectory(const std::string &dirname) const
Creates a test directory in the temporary location.
Definition IntUndoCommandTest.cxx:57
static int countMessages(const std::vector< Event > ¬ifications, const std::string &message)
Counts the occurrences of a specific message (substring) across all event notifications.
Definition IntUndoCommandTest.cxx:79
std::shared_ptr< RepositoryManager > repoManager
Shared pointer to the repository core logic component.
Definition IntUndoCommandTest.hxx:135
void stageFiles(const std::vector< std::string > &files)
Stages a list of files using the RepositoryManager's staging logic.
Definition IntUndoCommandTest.cxx:61
std::filesystem::path testDir
Path to the temporary test repository directory.
Definition IntUndoCommandTest.hxx:147
static void simulateUserInput(const std::string &input)
Simulates user input by pushing the string into the mock event bus's input queue.
Definition IntUndoCommandTest.cxx:86
void TearDown() override
Tears down the testing environment after each test.
Definition IntUndoCommandTest.cxx:45
void createTestFile(const std::string &filename, const std::string &content) const
Creates a test file with specified content in the temporary directory.
Definition IntUndoCommandTest.cxx:51
Mock implementation of the ISubject interface for unit testing purposes.
Utility classes and test fixtures for CLI command testing.
Definition ClearCommandTest.cxx:17
Structure describing an event published by the VCS core.
Definition Event.hxx:30