From 9d079a832ec9c70fccb3446843bd8d7579e3aafd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 3 May 2016 14:38:26 +0200 Subject: An in memory testaccount that can be used for application testing. --- tests/CMakeLists.txt | 1 + tests/testaccounttest.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/testaccounttest.cpp (limited to 'tests') 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 ( modelinteractivitytest inspectiontest accountstest + testaccounttest ) target_link_libraries(dummyresourcetest sink_resource_dummy) target_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 @@ +#include +#include +#include + +#include "store.h" +#include "test.h" +#include "log.h" + +using namespace Sink; + +/** + * Test of the test account. + */ +class TestAccountTest : public QObject +{ + Q_OBJECT +private slots: + + void initTestCase() + { + // Sink::FacadeFactory::instance().resetFactory(); + // ResourceConfig::clear(); + Log::setDebugOutputLevel(Sink::Log::Trace); + Test::initTest(); + } + + void testLoad() + { + auto &&account = Test::TestAccount::registerAccount(); + auto folder = ApplicationDomain::Folder::Ptr::create(ApplicationDomain::ApplicationDomainType::createEntity()); + account.addEntity(folder); + + auto folders = account.entities(); + QCOMPARE(folders.size(), 1); + QCOMPARE(account.entities().size(), 0); + + auto mail = ApplicationDomain::ApplicationDomainType::createEntity(); + Sink::Store::create(ApplicationDomain::Mail(account.identifier)).exec(); + QCOMPARE(account.entities().size(), 1); + } + +}; + +QTEST_MAIN(TestAccountTest) +#include "testaccounttest.moc" -- cgit v1.2.3