MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / TEST_F

Function TEST_F

framework/test/gtest/ServiceReferenceTest.cpp:96–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95
96TEST_F(ServiceReferenceTest, TestServiceReferenceAssignmentAndCopy)
97{
98 auto s1 = std::make_shared<TestServiceA>();
99
100 ServiceRegistrationBase reg1 = context.RegisterService<ServiceNS::ITestServiceA>(s1);
101 ServiceReferenceBase ref1 = reg1.GetReference();
102
103 ASSERT_EQ(ref1.GetInterfaceId(), "");
104 ServiceReference<ServiceNS::ITestServiceA> typedRefAssign;
105 ServiceReference<ServiceNS::ITestServiceA> typedRefCopy = ref1;
106 typedRefAssign = ref1;
107 ASSERT_EQ(typedRefAssign.GetInterfaceId(), "ServiceNS::ITestServiceA");
108 ASSERT_EQ(typedRefCopy.GetInterfaceId(), "ServiceNS::ITestServiceA");
109
110 reg1.Unregister();
111}
112
113// This test exercises the 2 ways to register a service
114// a. using the name of the interface i.e. "Foo::Bar"

Callers

nothing calls this directly

Calls 15

GetInterfaceIdMethod · 0.80
UnregisterMethod · 0.80
atMethod · 0.80
GetReferenceMethod · 0.45
GetBundleContextMethod · 0.45
GetServiceMethod · 0.45
getValueMethod · 0.45
GetServiceReferenceMethod · 0.45
RegisterServiceMethod · 0.45
sizeMethod · 0.45
GetPropertyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected