summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/testaccounttest.cpp45
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b25e7bc..b97596a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -55,6 +55,7 @@ auto_tests (
55 modelinteractivitytest 55 modelinteractivitytest
56 inspectiontest 56 inspectiontest
57 accountstest 57 accountstest
58 testaccounttest
58) 59)
59target_link_libraries(dummyresourcetest sink_resource_dummy) 60target_link_libraries(dummyresourcetest sink_resource_dummy)
60target_link_libraries(dummyresourcebenchmark sink_resource_dummy) 61target_link_libraries(dummyresourcebenchmark sink_resource_dummy)
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
9using namespace Sink;
10
11/**
12 * Test of the test account.
13 */
14class TestAccountTest : public QObject
15{
16 Q_OBJECT
17private 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
44QTEST_MAIN(TestAccountTest)
45#include "testaccounttest.moc"