综合平台编程器项目的远程存储
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 rivejä
730 B

  1. #pragma once
  2. #include "domain/project_storage.h"
  3. #include <stdexcept>
  4. #include <string>
  5. namespace TestSupport
  6. {
  7. inline void require(bool condition, const std::string &message)
  8. {
  9. if (!condition)
  10. {
  11. throw std::runtime_error(message);
  12. }
  13. }
  14. // 编辑服务测试只验证内存模型和服务契约,不应依赖真实文件系统
  15. class InMemoryProjectStorage final : public ProjectStorage
  16. {
  17. public:
  18. ProjectSaveResult save(const Project &, const std::string &) override
  19. {
  20. return {true, ProjectStorageError::None, {}};
  21. }
  22. ProjectLoadResult load(const std::string &) override
  23. {
  24. return {false, {}, ProjectStorageError::FileReadFailed, {}};
  25. }
  26. };
  27. } // namespace TestSupport