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 template<
typename Scope>
63 friend class TypedScopeFixture;
66 template<
typename Scope>
67 class TypedScopeFixture :
public ::testing::Test
71 : registry_proxy(®istry, [](unity::scopes::Registry*) {})
72 , scope(ScopeTraits<Scope>::construct())
74 TypedScopeFixtureHelper::set_registry(scope, registry_proxy);
79 EXPECT_NO_THROW(scope->start(ScopeTraits<Scope>::name()));
80 EXPECT_NO_THROW(scope->run());
85 EXPECT_NO_THROW(scope->stop());
89 unity::scopes::testing::MockRegistry registry;
91 std::shared_ptr<Scope> scope;
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:34