Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
Initializer.mock.hpp
1
2#pragma once
3
4/*
5An example of use:
6
7using ExampleProxy_t = ::mock::covellite::gui::Initializer::Proxy;
8ExampleProxy_t ExampleProxy;
9ExampleProxy_t::GetInstance() = &ExampleProxy;
10
11const ::mock::Id_t ExampleId = 1607301544;
12
13using namespace ::testing;
14
15InSequence Dummy;
16
17EXPECT_CALL(ExampleProxy, Constructor(Value1))
18 .Times(1)
19 .WillOnce(Return(ExampleId));
20
21::mock::covellite::gui::Initializer Example(Value1);
22
23EXPECT_CALL(ExampleProxy, Function(ExampleId, Value2))
24 .Times(1)
25 .WillOnce(Return(Value3));
26
27const auto Result = Example.Function(Value2);
28EXPECT_EQ(Value3, Result);
29*/
30
31namespace mock
32{
33
34namespace covellite
35{
36
37namespace gui
38{
39
40class Initializer
41{
42 using RenderInterfacePtr_t =
43 ::std::shared_ptr<CovelliteGui::RenderInterface>;
44 using StringTranslatorPtr_t =
45 ::std::shared_ptr<::mock::covellite::gui::IStringTranslator>;
46
47public:
48 class Data
49 {
50 public:
51 RenderInterfacePtr_t m_pRenderInterface;
52 StringTranslatorPtr_t m_pStringTranslator;
53
54 public:
55 bool operator== (const Data & _Data) const
56 {
57 if (m_pRenderInterface->m_Id != _Data.m_pRenderInterface->m_Id) return false;
58 if (m_pStringTranslator->m_Id != _Data.m_pStringTranslator->m_Id) return false;
59 return true;
60 }
61 };
62
63public:
64 class Proxy :
65 public ::alicorn::extension::testing::Proxy<Proxy>
66 {
67 public:
68 MOCK_METHOD1(Constructor, Id_t(const Data &));
69 };
70
71public:
72 const Id_t m_Id = 0;
73 Initializer & operator= (const Initializer &) = delete;
74 bool operator== (const Initializer & _Value) const { return (m_Id == _Value.m_Id); }
75
76public:
77 explicit Initializer(const Data & _Param1) :
78 m_Id(Proxy::GetInstance()->Constructor(_Param1))
79 {
80
81 }
82
83};
84
85} // namespace gui
86
87} // namespace covellite
88
89} // namespace mock