diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-03 14:38:26 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-03 14:38:26 +0200 |
commit | 9d079a832ec9c70fccb3446843bd8d7579e3aafd (patch) | |
tree | 5ebd132b5ddf31f5183c71ecd030826b12b38895 /common/test.h | |
parent | a5eb20dd70160f437835d4f5dffb27d8a912709d (diff) | |
download | sink-9d079a832ec9c70fccb3446843bd8d7579e3aafd.tar.gz sink-9d079a832ec9c70fccb3446843bd8d7579e3aafd.zip |
An in memory testaccount that can be used for application testing.
Diffstat (limited to 'common/test.h')
-rw-r--r-- | common/test.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/common/test.h b/common/test.h index 146b4ac..e2bd1ea 100644 --- a/common/test.h +++ b/common/test.h | |||
@@ -21,6 +21,9 @@ | |||
21 | #pragma once | 21 | #pragma once |
22 | 22 | ||
23 | #include "sink_export.h" | 23 | #include "sink_export.h" |
24 | #include "applicationdomaintype.h" | ||
25 | |||
26 | #include <memory> | ||
24 | 27 | ||
25 | namespace Sink { | 28 | namespace Sink { |
26 | namespace Test { | 29 | namespace Test { |
@@ -31,5 +34,28 @@ namespace Test { | |||
31 | * and clears all data directories. | 34 | * and clears all data directories. |
32 | */ | 35 | */ |
33 | void SINK_EXPORT initTest(); | 36 | void SINK_EXPORT initTest(); |
37 | |||
38 | class SINK_EXPORT TestAccount { | ||
39 | public: | ||
40 | QByteArray identifier; | ||
41 | static TestAccount registerAccount(); | ||
42 | |||
43 | template<typename DomainType> | ||
44 | void addEntity(const ApplicationDomain::ApplicationDomainType::Ptr &domainObject); | ||
45 | |||
46 | template<typename DomainType> | ||
47 | typename DomainType::Ptr createEntity(); | ||
48 | |||
49 | template<typename DomainType> | ||
50 | QList<ApplicationDomain::ApplicationDomainType::Ptr> entities() const; | ||
51 | |||
52 | private: | ||
53 | TestAccount(){}; | ||
54 | TestAccount(const TestAccount &); | ||
55 | TestAccount &operator=(const TestAccount &); | ||
56 | QHash<QByteArray, QList<ApplicationDomain::ApplicationDomainType::Ptr> > mEntities; | ||
57 | QHash<QByteArray, std::shared_ptr<void> > mFacades; | ||
58 | }; | ||
59 | |||
34 | } | 60 | } |
35 | } | 61 | } |