summaryrefslogtreecommitdiffstats
path: root/common/test.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-03 14:38:26 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-03 14:38:26 +0200
commit9d079a832ec9c70fccb3446843bd8d7579e3aafd (patch)
tree5ebd132b5ddf31f5183c71ecd030826b12b38895 /common/test.h
parenta5eb20dd70160f437835d4f5dffb27d8a912709d (diff)
downloadsink-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.h26
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
25namespace Sink { 28namespace Sink {
26namespace Test { 29namespace Test {
@@ -31,5 +34,28 @@ namespace Test {
31 * and clears all data directories. 34 * and clears all data directories.
32 */ 35 */
33void SINK_EXPORT initTest(); 36void SINK_EXPORT initTest();
37
38class SINK_EXPORT TestAccount {
39public:
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
52private:
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}