#pragma once // In-memory IFileSystem fake used to drive the service tests with no real I/O. // Tracks regular files (string contents) and directories (just by presence). #include "ccm/ports/IFileSystem.hpp" #include #include #include namespace ccm::testing { class InMemoryFileSystem final : public IFileSystem { public: [[nodiscard]] bool exists(const std::filesystem::path& p) const override; [[nodiscard]] bool isDirectory(const std::filesystem::path& p) const override; Result ensureDirectory(const std::filesystem::path& p) override; Result readText(const std::filesystem::path& p) override; Result writeText(const std::filesystem::path& p, std::string_view contents) override; Result copyFile(const std::filesystem::path& from, const std::filesystem::path& to, bool overwrite) override; Result remove(const std::filesystem::path& p) override; Result> listDirectory( const std::filesystem::path& p) override; // Test helpers. [[nodiscard]] const std::map& files() const noexcept { return files_; } [[nodiscard]] const std::set& dirs() const noexcept { return dirs_; } private: static std::string norm(const std::filesystem::path& p); std::map files_; std::set dirs_; }; } // namespace ccm::testing