21 #include <unity/scopes/Version.h>
23 #include <unity/scopes/testing/MockRegistry.h>
25 #include <gtest/gtest.h>
42 template<
typename Scope>
45 inline static const char* name()
50 inline static std::shared_ptr<Scope> construct()
52 return std::make_shared<Scope>();
56 class TypedScopeFixtureHelper
58 static void set_scope_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
59 static void set_cache_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
60 static void set_app_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
61 static void set_tmp_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
62 static void set_registry(std::shared_ptr<ScopeBase>
const& scope,
RegistryProxy const& r);
64 template<
typename Scope>
65 friend class TypedScopeFixture;
68 template<
typename Scope>
69 class TypedScopeFixture :
public ::testing::Test
73 : registry_proxy(®istry, [](
unity::scopes::Registry*) {})
74 , scope(ScopeTraits<Scope>::construct())
76 TypedScopeFixtureHelper::set_registry(scope, registry_proxy);
81 ASSERT_NO_THROW(scope->start(ScopeTraits<Scope>::name()));
82 ASSERT_NO_THROW(scope->run());
85 void set_scope_directory(std::string
const& path)
87 TypedScopeFixtureHelper::set_scope_directory(scope, path);
90 void set_cache_directory(std::string
const& path)
92 TypedScopeFixtureHelper::set_cache_directory(scope, path);
95 void set_app_directory(std::string
const& path)
97 TypedScopeFixtureHelper::set_app_directory(scope, path);
100 void set_tmp_directory(std::string
const& path)
102 TypedScopeFixtureHelper::set_tmp_directory(scope, path);
105 static void set_registry(std::shared_ptr<ScopeBase>
const& scope,
RegistryProxy const& r)
107 TypedScopeFixtureHelper::set_registry(scope, r);
112 EXPECT_NO_THROW(scope->stop());
116 unity::scopes::testing::MockRegistry registry;
118 std::shared_ptr<Scope> scope;
Definition: OnlineAccountClient.h:39
Top-level namespace for all things Unity-related.
Definition: Version.h:49
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:33