19cc42abfSBrad Bishop #include "../interface_ops.hpp"
29cc42abfSBrad Bishop
39cc42abfSBrad Bishop #include <sdbusplus/test/sdbus_mock.hpp>
49cc42abfSBrad Bishop
59cc42abfSBrad Bishop #include <gtest/gtest.h>
69cc42abfSBrad Bishop
79cc42abfSBrad Bishop using namespace phosphor::inventory::manager;
89cc42abfSBrad Bishop using namespace testing;
99cc42abfSBrad Bishop using namespace std::string_literals;
109cc42abfSBrad Bishop
119cc42abfSBrad Bishop struct MockInterface;
129cc42abfSBrad Bishop struct DummyInterfaceWithProperties;
139cc42abfSBrad Bishop
149cc42abfSBrad Bishop MockInterface* g_currentMock = nullptr;
159cc42abfSBrad Bishop
169cc42abfSBrad Bishop using FakeVariantType = int;
179cc42abfSBrad Bishop using InterfaceVariant = std::map<std::string, FakeVariantType>;
189cc42abfSBrad Bishop
199cc42abfSBrad Bishop struct MockInterface
209cc42abfSBrad Bishop {
MockInterfaceMockInterface219cc42abfSBrad Bishop MockInterface()
229cc42abfSBrad Bishop {
239cc42abfSBrad Bishop g_currentMock = this;
249cc42abfSBrad Bishop }
~MockInterfaceMockInterface259cc42abfSBrad Bishop ~MockInterface()
269cc42abfSBrad Bishop {
279cc42abfSBrad Bishop g_currentMock = nullptr;
289cc42abfSBrad Bishop }
299cc42abfSBrad Bishop MockInterface(const MockInterface&) = delete;
309cc42abfSBrad Bishop MockInterface& operator=(const MockInterface&) = delete;
319cc42abfSBrad Bishop // Not supporting move semantics simply because they aren't needed.
329cc42abfSBrad Bishop MockInterface(MockInterface&&) = delete;
339cc42abfSBrad Bishop MockInterface& operator=(MockInterface&&) = delete;
349cc42abfSBrad Bishop
359cc42abfSBrad Bishop // We'll be getting calls proxyed through other objects.
36e96f2aa7SBrad Bishop MOCK_METHOD3(constructWithProperties,
37e96f2aa7SBrad Bishop void(const char*, const InterfaceVariant& i, bool));
389cc42abfSBrad Bishop MOCK_METHOD1(constructWithoutProperties, void(const char*));
39e96f2aa7SBrad Bishop MOCK_METHOD3(setPropertyByName, void(std::string, FakeVariantType, bool));
409cc42abfSBrad Bishop
419cc42abfSBrad Bishop MOCK_METHOD2(serializeTwoArgs,
429cc42abfSBrad Bishop void(const std::string&, const std::string&));
439cc42abfSBrad Bishop MOCK_METHOD3(serializeThreeArgs,
449cc42abfSBrad Bishop void(const std::string&, const std::string&,
459cc42abfSBrad Bishop const DummyInterfaceWithProperties&));
469cc42abfSBrad Bishop
479cc42abfSBrad Bishop MOCK_METHOD0(deserializeNoop, void());
489cc42abfSBrad Bishop MOCK_METHOD3(deserializeThreeArgs,
499cc42abfSBrad Bishop void(const std::string&, const std::string&,
509cc42abfSBrad Bishop DummyInterfaceWithProperties&));
519cc42abfSBrad Bishop };
529cc42abfSBrad Bishop
539cc42abfSBrad Bishop struct DummyInterfaceWithoutProperties
549cc42abfSBrad Bishop {
DummyInterfaceWithoutPropertiesDummyInterfaceWithoutProperties55563306f6SPatrick Williams DummyInterfaceWithoutProperties(sdbusplus::bus_t&, const char* name)
569cc42abfSBrad Bishop {
579cc42abfSBrad Bishop g_currentMock->constructWithoutProperties(name);
589cc42abfSBrad Bishop }
599cc42abfSBrad Bishop };
609cc42abfSBrad Bishop
619cc42abfSBrad Bishop struct DummyInterfaceWithProperties
629cc42abfSBrad Bishop {
639cc42abfSBrad Bishop using PropertiesVariant = FakeVariantType;
649cc42abfSBrad Bishop
DummyInterfaceWithPropertiesDummyInterfaceWithProperties65563306f6SPatrick Williams DummyInterfaceWithProperties(sdbusplus::bus_t&, const char* name,
66e96f2aa7SBrad Bishop const InterfaceVariant& i, bool skipSignal)
679cc42abfSBrad Bishop {
68e96f2aa7SBrad Bishop g_currentMock->constructWithProperties(name, i, skipSignal);
699cc42abfSBrad Bishop }
709cc42abfSBrad Bishop
setPropertyByNameDummyInterfaceWithProperties71e96f2aa7SBrad Bishop void setPropertyByName(std::string name, PropertiesVariant val,
72e96f2aa7SBrad Bishop bool skipSignal)
739cc42abfSBrad Bishop {
74e96f2aa7SBrad Bishop g_currentMock->setPropertyByName(name, val, skipSignal);
759cc42abfSBrad Bishop }
769cc42abfSBrad Bishop };
779cc42abfSBrad Bishop
789cc42abfSBrad Bishop struct SerialForwarder
799cc42abfSBrad Bishop {
serializeSerialForwarder809cc42abfSBrad Bishop static void serialize(const std::string& path, const std::string& iface)
819cc42abfSBrad Bishop {
829cc42abfSBrad Bishop g_currentMock->serializeTwoArgs(path, iface);
839cc42abfSBrad Bishop }
849cc42abfSBrad Bishop
serializeSerialForwarder859cc42abfSBrad Bishop static void serialize(const std::string& path, const std::string& iface,
869cc42abfSBrad Bishop const DummyInterfaceWithProperties& obj)
879cc42abfSBrad Bishop {
889cc42abfSBrad Bishop g_currentMock->serializeThreeArgs(path, iface, obj);
899cc42abfSBrad Bishop }
909cc42abfSBrad Bishop
deserializeSerialForwarder9123314a5cSGeorge Liu static void deserialize(const std::string& /* path */,
9223314a5cSGeorge Liu const std::string& /* iface */)
939cc42abfSBrad Bishop {
949cc42abfSBrad Bishop g_currentMock->deserializeNoop();
959cc42abfSBrad Bishop }
969cc42abfSBrad Bishop
deserializeSerialForwarder979cc42abfSBrad Bishop static void deserialize(const std::string& path, const std::string& iface,
989cc42abfSBrad Bishop DummyInterfaceWithProperties& obj)
999cc42abfSBrad Bishop {
1009cc42abfSBrad Bishop g_currentMock->deserializeThreeArgs(path, iface, obj);
1019cc42abfSBrad Bishop }
1029cc42abfSBrad Bishop };
1039cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestHasPropertiesNoProperties)1049cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestHasPropertiesNoProperties)
1059cc42abfSBrad Bishop {
1069cc42abfSBrad Bishop EXPECT_FALSE(HasProperties<DummyInterfaceWithoutProperties>::value);
1079cc42abfSBrad Bishop }
1089cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestHasPropertiesHasProperties)1099cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestHasPropertiesHasProperties)
1109cc42abfSBrad Bishop {
1119cc42abfSBrad Bishop EXPECT_TRUE(HasProperties<DummyInterfaceWithProperties>::value);
1129cc42abfSBrad Bishop }
1139cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestMakePropertylessInterfaceWithoutArguments)1149cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestMakePropertylessInterfaceWithoutArguments)
1159cc42abfSBrad Bishop {
1169cc42abfSBrad Bishop MockInterface mock;
1179cc42abfSBrad Bishop Interface i;
1189cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
1199cc42abfSBrad Bishop
1209cc42abfSBrad Bishop EXPECT_CALL(mock, constructWithoutProperties("foo")).Times(1);
121e96f2aa7SBrad Bishop EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
1229cc42abfSBrad Bishop
1239cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
124*d8fba8beSPatrick Williams auto r =
125*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
1269cc42abfSBrad Bishop
1279cc42abfSBrad Bishop EXPECT_NO_THROW(
1289cc42abfSBrad Bishop std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
1299cc42abfSBrad Bishop }
1309cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestMakePropertylessInterfaceWithOneArgument)1319cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestMakePropertylessInterfaceWithOneArgument)
1329cc42abfSBrad Bishop {
1339cc42abfSBrad Bishop MockInterface mock;
1349cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
1359cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
1369cc42abfSBrad Bishop
1379cc42abfSBrad Bishop EXPECT_CALL(mock, constructWithoutProperties("foo")).Times(1);
138e96f2aa7SBrad Bishop EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
1399cc42abfSBrad Bishop
1409cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
141*d8fba8beSPatrick Williams auto r =
142*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
1439cc42abfSBrad Bishop
1449cc42abfSBrad Bishop EXPECT_NO_THROW(
1459cc42abfSBrad Bishop std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
1469cc42abfSBrad Bishop }
1479cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestMakeInterfaceWithWithoutArguments)1489cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestMakeInterfaceWithWithoutArguments)
1499cc42abfSBrad Bishop {
1509cc42abfSBrad Bishop MockInterface mock;
1519cc42abfSBrad Bishop Interface i;
1529cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
1539cc42abfSBrad Bishop
1549cc42abfSBrad Bishop EXPECT_CALL(mock, constructWithoutProperties(_)).Times(0);
155e96f2aa7SBrad Bishop EXPECT_CALL(mock, constructWithProperties("bar", _, _)).Times(1);
1569cc42abfSBrad Bishop
1579cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
158*d8fba8beSPatrick Williams auto r =
159*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
1609cc42abfSBrad Bishop
1619cc42abfSBrad Bishop EXPECT_NO_THROW(
1629cc42abfSBrad Bishop std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
1639cc42abfSBrad Bishop }
1649cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestMakeInterfaceWithOneArgument)1659cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestMakeInterfaceWithOneArgument)
1669cc42abfSBrad Bishop {
1679cc42abfSBrad Bishop MockInterface mock;
1689cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
1699cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
1709cc42abfSBrad Bishop
1719cc42abfSBrad Bishop EXPECT_CALL(mock, constructWithoutProperties(_)).Times(0);
172e96f2aa7SBrad Bishop EXPECT_CALL(mock, constructWithProperties("foo", _, _)).Times(1);
1739cc42abfSBrad Bishop
1749cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
175*d8fba8beSPatrick Williams auto r =
176*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
1779cc42abfSBrad Bishop
1789cc42abfSBrad Bishop EXPECT_NO_THROW(
1799cc42abfSBrad Bishop std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
1809cc42abfSBrad Bishop }
1819cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestAssignPropertylessInterfaceWithoutArguments)1829cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestAssignPropertylessInterfaceWithoutArguments)
1839cc42abfSBrad Bishop {
1849cc42abfSBrad Bishop MockInterface mock;
1859cc42abfSBrad Bishop Interface i;
1869cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
1879cc42abfSBrad Bishop
188e96f2aa7SBrad Bishop EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
1899cc42abfSBrad Bishop
1909cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
191*d8fba8beSPatrick Williams auto r =
192*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
1939cc42abfSBrad Bishop
194e96f2aa7SBrad Bishop AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
1959cc42abfSBrad Bishop }
1969cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestAssignPropertylessInterfaceWithOneArgument)1979cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestAssignPropertylessInterfaceWithOneArgument)
1989cc42abfSBrad Bishop {
1999cc42abfSBrad Bishop MockInterface mock;
2009cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
2019cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2029cc42abfSBrad Bishop
203e96f2aa7SBrad Bishop EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
2049cc42abfSBrad Bishop
2059cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
206*d8fba8beSPatrick Williams auto r =
207*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
2089cc42abfSBrad Bishop
209e96f2aa7SBrad Bishop AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
2109cc42abfSBrad Bishop }
2119cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestAssignInterfaceWithoutArguments)2129cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestAssignInterfaceWithoutArguments)
2139cc42abfSBrad Bishop {
2149cc42abfSBrad Bishop MockInterface mock;
2159cc42abfSBrad Bishop Interface i;
2169cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2179cc42abfSBrad Bishop
218e96f2aa7SBrad Bishop EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
2199cc42abfSBrad Bishop
2209cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
221*d8fba8beSPatrick Williams auto r =
222*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
2239cc42abfSBrad Bishop
224e96f2aa7SBrad Bishop AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
2259cc42abfSBrad Bishop }
2269cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestAssignInterfaceWithOneArgument)2279cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestAssignInterfaceWithOneArgument)
2289cc42abfSBrad Bishop {
2299cc42abfSBrad Bishop MockInterface mock;
2309cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
2319cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2329cc42abfSBrad Bishop
233e96f2aa7SBrad Bishop EXPECT_CALL(mock, setPropertyByName("foo"s, 1ll, _)).Times(1);
2349cc42abfSBrad Bishop
2359cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
236*d8fba8beSPatrick Williams auto r =
237*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
2389cc42abfSBrad Bishop
239e96f2aa7SBrad Bishop AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
2409cc42abfSBrad Bishop }
2419cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestSerializePropertylessInterfaceWithoutArguments)2429cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestSerializePropertylessInterfaceWithoutArguments)
2439cc42abfSBrad Bishop {
2449cc42abfSBrad Bishop MockInterface mock;
2459cc42abfSBrad Bishop Interface i;
2469cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2479cc42abfSBrad Bishop
2489cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
249*d8fba8beSPatrick Williams auto r =
250*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
2519cc42abfSBrad Bishop
2529cc42abfSBrad Bishop EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
2539cc42abfSBrad Bishop
2549cc42abfSBrad Bishop SerializeInterface<DummyInterfaceWithoutProperties, SerialForwarder>::op(
2559cc42abfSBrad Bishop "/foo"s, "bar"s, r);
2569cc42abfSBrad Bishop }
2579cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestSerializePropertylessInterfaceWithOneArgument)2589cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestSerializePropertylessInterfaceWithOneArgument)
2599cc42abfSBrad Bishop {
2609cc42abfSBrad Bishop MockInterface mock;
2619cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
2629cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2639cc42abfSBrad Bishop
2649cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
265*d8fba8beSPatrick Williams auto r =
266*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
2679cc42abfSBrad Bishop
2689cc42abfSBrad Bishop EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
2699cc42abfSBrad Bishop
2709cc42abfSBrad Bishop SerializeInterface<DummyInterfaceWithoutProperties, SerialForwarder>::op(
2719cc42abfSBrad Bishop "/foo"s, "bar"s, r);
2729cc42abfSBrad Bishop }
2739cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestSerializeInterfaceWithNoArguments)2749cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestSerializeInterfaceWithNoArguments)
2759cc42abfSBrad Bishop {
2769cc42abfSBrad Bishop MockInterface mock;
2779cc42abfSBrad Bishop Interface i;
2789cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2799cc42abfSBrad Bishop
2809cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
281*d8fba8beSPatrick Williams auto r =
282*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
2839cc42abfSBrad Bishop
2849cc42abfSBrad Bishop EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
2859cc42abfSBrad Bishop
2869cc42abfSBrad Bishop SerializeInterface<DummyInterfaceWithProperties, SerialForwarder>::op(
2879cc42abfSBrad Bishop "/foo"s, "bar"s, r);
2889cc42abfSBrad Bishop }
2899cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestSerializeInterfaceWithOneArgument)2909cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestSerializeInterfaceWithOneArgument)
2919cc42abfSBrad Bishop {
2929cc42abfSBrad Bishop MockInterface mock;
2939cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
2949cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
2959cc42abfSBrad Bishop
2969cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
297*d8fba8beSPatrick Williams auto r =
298*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
2999cc42abfSBrad Bishop
3009cc42abfSBrad Bishop EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
3019cc42abfSBrad Bishop
3029cc42abfSBrad Bishop SerializeInterface<DummyInterfaceWithProperties, SerialForwarder>::op(
3039cc42abfSBrad Bishop "/foo"s, "bar"s, r);
3049cc42abfSBrad Bishop }
3059cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestDeserializePropertylessInterfaceWithoutArguments)3069cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestDeserializePropertylessInterfaceWithoutArguments)
3079cc42abfSBrad Bishop {
3089cc42abfSBrad Bishop MockInterface mock;
3099cc42abfSBrad Bishop Interface i;
3109cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
3119cc42abfSBrad Bishop
3129cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
313*d8fba8beSPatrick Williams auto r =
314*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
3159cc42abfSBrad Bishop
3169cc42abfSBrad Bishop EXPECT_CALL(mock, deserializeNoop()).Times(1);
3179cc42abfSBrad Bishop
3189cc42abfSBrad Bishop DeserializeInterface<DummyInterfaceWithoutProperties, SerialForwarder>::op(
3199cc42abfSBrad Bishop "/foo"s, "bar"s, r);
3209cc42abfSBrad Bishop }
3219cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestDeserializePropertylessInterfaceWithOneArgument)3229cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestDeserializePropertylessInterfaceWithOneArgument)
3239cc42abfSBrad Bishop {
3249cc42abfSBrad Bishop MockInterface mock;
3259cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
3269cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
3279cc42abfSBrad Bishop
3289cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
329*d8fba8beSPatrick Williams auto r =
330*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
3319cc42abfSBrad Bishop
3329cc42abfSBrad Bishop EXPECT_CALL(mock, deserializeNoop()).Times(1);
3339cc42abfSBrad Bishop
3349cc42abfSBrad Bishop DeserializeInterface<DummyInterfaceWithoutProperties, SerialForwarder>::op(
3359cc42abfSBrad Bishop "/foo"s, "bar"s, r);
3369cc42abfSBrad Bishop }
3379cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestDeserializeInterfaceWithNoArguments)3389cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestDeserializeInterfaceWithNoArguments)
3399cc42abfSBrad Bishop {
3409cc42abfSBrad Bishop MockInterface mock;
3419cc42abfSBrad Bishop Interface i;
3429cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
3439cc42abfSBrad Bishop
3449cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
345*d8fba8beSPatrick Williams auto r =
346*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
3479cc42abfSBrad Bishop
3489cc42abfSBrad Bishop EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
3499cc42abfSBrad Bishop
3509cc42abfSBrad Bishop DeserializeInterface<DummyInterfaceWithProperties, SerialForwarder>::op(
3519cc42abfSBrad Bishop "/foo"s, "bar"s, r);
3529cc42abfSBrad Bishop }
3539cc42abfSBrad Bishop
TEST(InterfaceOpsTest,TestDeserializeInterfaceWithOneArgument)3549cc42abfSBrad Bishop TEST(InterfaceOpsTest, TestDeserializeInterfaceWithOneArgument)
3559cc42abfSBrad Bishop {
3569cc42abfSBrad Bishop MockInterface mock;
3579cc42abfSBrad Bishop Interface i{{"foo"s, static_cast<int64_t>(1ll)}};
3589cc42abfSBrad Bishop sdbusplus::SdBusMock interface;
3599cc42abfSBrad Bishop
3609cc42abfSBrad Bishop auto b = sdbusplus::get_mocked_new(&interface);
361*d8fba8beSPatrick Williams auto r =
362*d8fba8beSPatrick Williams MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
3639cc42abfSBrad Bishop
3649cc42abfSBrad Bishop EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
3659cc42abfSBrad Bishop
3669cc42abfSBrad Bishop DeserializeInterface<DummyInterfaceWithProperties, SerialForwarder>::op(
3679cc42abfSBrad Bishop "/foo"s, "bar"s, r);
3689cc42abfSBrad Bishop }
369