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 /tests/testaccounttest.cpp | |
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 'tests/testaccounttest.cpp')
-rw-r--r-- | tests/testaccounttest.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/testaccounttest.cpp b/tests/testaccounttest.cpp new file mode 100644 index 0000000..c630846 --- /dev/null +++ b/tests/testaccounttest.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <QtTest> | ||
2 | #include <QDebug> | ||
3 | #include <functional> | ||
4 | |||
5 | #include "store.h" | ||
6 | #include "test.h" | ||
7 | #include "log.h" | ||
8 | |||
9 | using namespace Sink; | ||
10 | |||
11 | /** | ||
12 | * Test of the test account. | ||
13 | */ | ||
14 | class TestAccountTest : public QObject | ||
15 | { | ||
16 | Q_OBJECT | ||
17 | private slots: | ||
18 | |||
19 | void initTestCase() | ||
20 | { | ||
21 | // Sink::FacadeFactory::instance().resetFactory(); | ||
22 | // ResourceConfig::clear(); | ||
23 | Log::setDebugOutputLevel(Sink::Log::Trace); | ||
24 | Test::initTest(); | ||
25 | } | ||
26 | |||
27 | void testLoad() | ||
28 | { | ||
29 | auto &&account = Test::TestAccount::registerAccount(); | ||
30 | auto folder = ApplicationDomain::Folder::Ptr::create(ApplicationDomain::ApplicationDomainType::createEntity<ApplicationDomain::Folder>()); | ||
31 | account.addEntity<ApplicationDomain::Folder>(folder); | ||
32 | |||
33 | auto folders = account.entities<ApplicationDomain::Folder>(); | ||
34 | QCOMPARE(folders.size(), 1); | ||
35 | QCOMPARE(account.entities<ApplicationDomain::Mail>().size(), 0); | ||
36 | |||
37 | auto mail = ApplicationDomain::ApplicationDomainType::createEntity<ApplicationDomain::Mail>(); | ||
38 | Sink::Store::create(ApplicationDomain::Mail(account.identifier)).exec(); | ||
39 | QCOMPARE(account.entities<ApplicationDomain::Mail>().size(), 1); | ||
40 | } | ||
41 | |||
42 | }; | ||
43 | |||
44 | QTEST_MAIN(TestAccountTest) | ||
45 | #include "testaccounttest.moc" | ||