19 #ifndef UNITY_SCOPES_TESTING_TYPED_SCOPE_FIXTURE_H
20 #define UNITY_SCOPES_TESTING_TYPED_SCOPE_FIXTURE_H
22 #include <unity/scopes/Version.h>
24 #include <unity/scopes/testing/MockRegistry.h>
26 #include <gtest/gtest.h>
43 template<
typename Scope>
46 inline static const char* name()
51 inline static std::shared_ptr<Scope> construct()
53 return std::make_shared<Scope>();
57 struct TypedScopeFixtureHelper
60 static void set_registry(std::shared_ptr<ScopeBase>
const& scope,
RegistryProxy const& r);
62 static void set_scope_directory(std::shared_ptr<ScopeBase>
const& scope, std::string
const& path);
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);
92 EXPECT_NO_THROW(scope->stop());
96 unity::scopes::testing::MockRegistry registry;
98 std::shared_ptr<Scope> scope;
Definition: ScopeBase.h:73
Top-level namespace for all things Unity-related.
Definition: Version.h:50
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:34