Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added CalendarDataStorage code and updated unit tests
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 25 Dec 2016 01:27:47 +0000 (01:27 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 25 Dec 2016 01:27:47 +0000 (01:27 +0000)
source/libraries/CalendarDataStorage/CalendarDataStorage.cpp [new file with mode: 0644]
source/libraries/CalendarDataStorage/CalendarDataStorage.h [new file with mode: 0644]
source/tests/xestiacalendar_calendardatastorage.h

diff --git a/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp b/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp
new file mode 100644 (file)
index 0000000..f516df8
--- /dev/null
@@ -0,0 +1,1569 @@
+#include "CalendarDataStorage.h"
+
+#include <iostream>
+
+using namespace std;
+
+static int callback(void *NotUsed, int argc, char **argv, char **azColName){
+   return 0;
+}
+
+CalendarDataStorage::CalendarDataStorage(){
+       
+       // Initialise the SQLite database.
+       
+       sqlite3_open_v2(":memory:", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX, nullptr);
+       SetupTables();
+       
+}
+
+CalendarDataStorage::~CalendarDataStorage(){
+       
+       // Destory the SQLite database.
+       
+       sqlite3_close(db);
+       
+}
+
+void CalendarDataStorage::SetupTables(){
+       
+       // Setup the tables for the Calendar Data Storage.
+       
+       char *setupTablesErrMsg = nullptr;
+       int resultCode;
+       
+       // Setup the accounts table.
+       
+       const char *accountsTableString;
+       accountsTableString = "CREATE TABLE accounts(id INTEGER PRIMARY KEY "
+               ", name TEXT"
+               ");";
+       
+       resultCode = sqlite3_exec(db, accountsTableString, callback, nullptr, &setupTablesErrMsg);
+       
+       if (resultCode != 0){
+               DataStorageInitOK = false;
+               return;
+       }
+       
+       // Setup the calendars table.
+       
+       const char *calendarTableString;
+       calendarTableString = "CREATE TABLE calendars(id INTEGER PRIMARY KEY "
+               ", accountid INTEGER"
+               ", name TEXT"
+               ", calendarid TEXT"
+               ", colour TEXT"
+               ");";
+       
+       resultCode = sqlite3_exec(db, calendarTableString, callback, nullptr, &setupTablesErrMsg);
+       
+       if (resultCode != 0){
+               DataStorageInitOK = false;
+               return;
+       }
+       
+       // Setup the calendar entries table.
+       
+       const char *calendarentriesTableString;
+       calendarentriesTableString = "CREATE TABLE calendarentries(id INTEGER PRIMARY KEY "
+               ", calendarid INTEGER"
+               ", entryname TEXT"
+               ", entrydescription TEXT"
+               ", entrystartyear INTEGER"
+               ", entrystartmonth INTEGER"
+               ", entrystartday INTEGER"
+               ", entrystarthour INTEGER"
+               ", entrystartminute INTEGER"
+               ", entrystartsecond INTEGER"
+               ", entryendyear INTEGER"
+               ", entryendmonth INTEGER"
+               ", entryendday INTEGER"
+               ", entryendhour INTEGER"
+               ", entryendminute INTEGER"
+               ", entryendsecond INTEGER"
+               ", entrydurationweek INTEGER"
+               ", entrydurationday INTEGER"
+               ", entrydurationhour INTEGER"
+               ", entrydurationminute INTEGER"
+               ", entrydurationsecond INTEGER"
+               ");";
+       
+       resultCode = sqlite3_exec(db, calendarentriesTableString, callback, nullptr, &setupTablesErrMsg);
+       
+       if (resultCode != 0){
+               DataStorageInitOK = false;
+               return;
+       }
+
+       // Setup the checksums table.
+       
+       const char *checksumsTableString;
+       checksumsTableString = "CREATE TABLE checksums(hashname TEXT PRIMARY KEY "
+               ", hashvalue TEXT);";
+       
+       resultCode = sqlite3_exec(db, checksumsTableString, callback, nullptr, &setupTablesErrMsg);
+       
+       if (resultCode != 0){
+               DataStorageInitOK = false;
+               return;
+       }
+       
+       DataStorageInitOK = true;
+       
+}
+
+bool CalendarDataStorage::DidInitOK()
+{
+       
+       return DataStorageInitOK;
+       
+}
+
+CDSAccountResult CalendarDataStorage::AddAccount(string accountName)
+{
+       
+       CDSAccountResult addResult = CDSACCOUNT_UNITTESTFAIL;
+       int resultCode;
+       
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "INSERT INTO accounts (name) VALUES(?1);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 1, accountName.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       addResult = CDSACCOUNT_OK;
+       
+       return addResult;
+       
+}
+
+CDSAccountList CalendarDataStorage::GetAccountList()
+{
+       
+       CDSAccountList accountList;
+       
+       // Check if calendar exists first.
+       
+       int resultCode = 0;
+       
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id, name from accounts;", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               accountList.getAccountListResult = CDSACCOUNT_FAILED;
+               return accountList;
+       }
+       
+       if (resultCode != 0){
+               accountList.getAccountListResult = CDSACCOUNT_FAILED;
+               return accountList;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               accountList.getAccountListResult = CDSACCOUNT_NOACCOUNT;
+               return accountList;
+       } else {
+               accountList.getAccountListResult = CDSACCOUNT_FAILED;
+               return accountList;
+       }
+       
+       while (resultCode == SQLITE_ROW){
+               
+               CDSGetAccountInfo accountInfo;
+               
+               accountInfo.accountID = sqlite3_column_int(statementHandle, 0);
+               
+               stringstream calendarStream;
+               
+               calendarStream << sqlite3_column_text(statementHandle, 1);
+               
+               accountInfo.accountName = calendarStream.str();
+               accountInfo.accountInfoResult = CDSACCOUNT_OK;
+               
+               accountList.accountList.push_back(accountInfo);
+               
+               resultCode = sqlite3_step(statementHandle);
+               
+       }       
+       
+       accountList.getAccountListResult = CDSACCOUNT_OK;
+       
+       return accountList;
+       
+}
+
+CDSGetAccountInfo CalendarDataStorage::GetAccount(string accountName)
+{
+       
+       CDSGetAccountInfo accountInfo;
+       accountInfo.accountInfoResult = CDSACCOUNT_UNITTESTFAIL;
+       int resultCode;
+       
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT name, id FROM accounts WHERE name=(?1);", -1, &statementHandle, nullptr);
+
+       if (resultCode != 0){
+               accountInfo.accountInfoResult = CDSACCOUNT_FAILED;
+               return accountInfo;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 1, accountName.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               accountInfo.accountInfoResult = CDSACCOUNT_FAILED;
+               return accountInfo;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_DONE){
+               
+               accountInfo.accountInfoResult = CDSACCOUNT_NOACCOUNT;
+               return accountInfo;
+               
+       } else if (resultCode == SQLITE_ROW){
+               
+               // Get the result data.
+               
+               stringstream accountNameStream;
+               
+               accountNameStream << sqlite3_column_text(statementHandle, 0);
+               
+               accountInfo.accountName = accountNameStream.str();
+               accountInfo.accountID = sqlite3_column_int(statementHandle, 1);
+               
+               accountInfo.accountInfoResult = CDSACCOUNT_OK;
+               return accountInfo;
+               
+       } else {
+               
+               accountInfo.accountInfoResult = CDSACCOUNT_FAILED;
+               return accountInfo;
+               
+       }
+       
+       return accountInfo;
+       
+}
+
+CDSAccountResult CalendarDataStorage::UpdateAccount(int accountID, string accountName)
+{
+       
+       CDSAccountResult updateResult = CDSACCOUNT_UNITTESTFAIL;
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       
+       // Check if account exists first.
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from accounts WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               return CDSACCOUNT_NOACCOUNT;
+       } else {
+               return CDSACCOUNT_FAILED;
+       }
+       
+       // Update the account.
+       
+       resultCode = sqlite3_prepare_v2(db, "UPDATE accounts SET name=(?1) WHERE id=(?2);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 1, accountName.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 2, accountID);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       updateResult = CDSACCOUNT_OK;
+       
+       return updateResult;
+       
+}
+
+CDSAccountResult CalendarDataStorage::DeleteAccount(int accountID)
+{
+       
+       CDSAccountResult deleteResult = CDSACCOUNT_UNITTESTFAIL;
+       
+       // Check if account exists first.
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       sqlite3_stmt *calendarHandle;
+       int resultCode;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from accounts WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               return CDSACCOUNT_NOACCOUNT;
+       } else {
+               return CDSACCOUNT_FAILED;
+       }
+       
+       // Delete the account.
+       
+       resultCode = sqlite3_prepare_v2(db, "DELETE FROM accounts WHERE id=(?1);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_DONE){
+               //deleteResult = CDSACCOUNT_OK;
+       } else {
+               return CDSACCOUNT_FAILED;
+       }
+       
+       // Get the calendar IDs and delete each calendar (and associated entries).
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id FROM calendars WHERE accountid=(?1);", -1, &calendarHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(calendarHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               return CDSACCOUNT_FAILED;
+       }
+       
+       resultCode = sqlite3_step(calendarHandle);
+       
+       if (resultCode == SQLITE_DONE || resultCode == SQLITE_ROW){
+               deleteResult = CDSACCOUNT_OK;
+       } else {
+               return CDSACCOUNT_FAILED;
+       }
+       
+       while (resultCode == SQLITE_ROW){
+               
+               int calendarDeleteID = sqlite3_column_int(calendarHandle, 0);
+               
+               DeleteCalendar(calendarDeleteID);
+               
+               resultCode = sqlite3_step(calendarHandle);
+               
+       }
+       
+       deleteResult = CDSACCOUNT_OK;
+       
+       return deleteResult;
+       
+       
+}
+
+CDSCalendarResult CalendarDataStorage::AddCalendar(int accountID, string calendarName, string calendarID, Colour calendarColour)
+{
+
+       CDSCalendarResult addResult = CDSCALENDAR_UNITTESTFAIL;
+       int resultCode;
+       
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "INSERT INTO calendars (name, calendarid, accountid, colour) VALUES(?1, ?2, ?3, ?4);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 1, calendarName.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 2, calendarID.c_str(), -1, SQLITE_STATIC);
+
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 3, accountID);
+
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 4, ((string)calendarColour).c_str(), -1, SQLITE_STATIC);
+
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       addResult = CDSCALENDAR_OK;
+       
+       return addResult;
+       
+}
+
+CDSGetCalendarInfo CalendarDataStorage::GetCalendar(std::string accountName, std::string calendarTextID)
+{
+       
+       CDSGetAccountInfo accountResult;
+       CDSGetCalendarInfo calendarResult;
+       sqlite3_stmt *statementHandle;
+       int resultCode;
+       
+       // Check if the account exists.
+       
+       accountResult = GetAccount(accountName);
+       
+       switch (accountResult.accountInfoResult){
+               
+               case CDSACCOUNT_OK:
+                       calendarResult.accountName = accountResult.accountName;
+                       calendarResult.accountInfoResult = CDSACCOUNT_OK;
+                       break;
+               case CDSACCOUNT_FAILED:
+                       calendarResult.accountInfoResult = CDSACCOUNT_FAILED;
+                       calendarResult.calendarInfoResult = CDSCALENDAR_FAILED;
+                       return calendarResult;
+               case CDSACCOUNT_NOACCOUNT:
+                       calendarResult.accountInfoResult = CDSACCOUNT_NOACCOUNT;
+                       calendarResult.calendarInfoResult = CDSCALENDAR_NOCALENDAR;
+                       return calendarResult;
+               
+       }
+       
+       // Check if the calendar exists.
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id, accountid, name, calendarid, colour FROM calendars WHERE accountid=(?1) AND calendarid=(?2);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               calendarResult.calendarInfoResult = CDSCALENDAR_FAILED;
+               return calendarResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 1, accountResult.accountID);
+       
+       if (resultCode != 0){
+               calendarResult.calendarInfoResult = CDSCALENDAR_FAILED;
+               return calendarResult;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 2, calendarTextID.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               calendarResult.calendarInfoResult = CDSCALENDAR_FAILED;
+               return calendarResult;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_DONE){
+               
+               calendarResult.calendarInfoResult = CDSCALENDAR_NOCALENDAR;
+               return calendarResult;
+               
+       } else if (resultCode == SQLITE_ROW){
+               
+               // Get the calendar name.
+               
+               stringstream calendarStream;
+               
+               calendarStream << sqlite3_column_text(statementHandle, 2);
+               calendarResult.calendarName = calendarStream.str();
+               
+               calendarStream.str("");
+               calendarStream << sqlite3_column_text(statementHandle, 3);
+               calendarResult.calendarTextID = calendarStream.str();
+
+               calendarStream.str("");
+               calendarStream << sqlite3_column_text(statementHandle, 4);
+               calendarResult.calendarColour = calendarStream.str();
+               
+               calendarResult.calendarID = sqlite3_column_int(statementHandle, 0);
+               calendarResult.accountID = sqlite3_column_int(statementHandle, 1);
+               calendarResult.calendarInfoResult = CDSCALENDAR_OK;
+               return calendarResult;
+               
+       } else {
+               
+               calendarResult.calendarInfoResult = CDSCALENDAR_FAILED;
+               return calendarResult;
+               
+       }
+       
+       return calendarResult;
+       
+}
+
+CDSCalendarResult CalendarDataStorage::UpdateCalendar(int calendarID, string calendarName)
+{
+       
+       CDSCalendarResult updateResult = CDSCALENDAR_UNITTESTFAIL;
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       
+       // Check if calendar exists first.
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from calendars WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               return CDSCALENDAR_NOCALENDAR;
+       } else {
+               return CDSCALENDAR_FAILED;
+       }
+       
+       // Update the account.
+       
+       resultCode = sqlite3_prepare_v2(db, "UPDATE calendars SET name=(?1) WHERE id=(?2);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 1, calendarName.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 2, calendarID);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       updateResult = CDSCALENDAR_OK;
+       
+       return updateResult;
+       
+}
+
+CDSCalendarResult CalendarDataStorage::DeleteCalendar(int calendarID)
+{
+       
+       CDSCalendarResult deleteResult = CDSCALENDAR_UNITTESTFAIL;
+       
+       // Check if account exists first.
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       sqlite3_stmt *entriesHandle;
+       int resultCode;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from calendars WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               return CDSCALENDAR_NOCALENDAR;
+       } else {
+               return CDSCALENDAR_FAILED;
+       }
+       
+       // Delete the calendar.
+       
+       resultCode = sqlite3_prepare_v2(db, "DELETE FROM calendars WHERE id=(?1);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       // Delete the calendar entries.
+       
+       resultCode = sqlite3_prepare_v2(db, "DELETE FROM calendarentries WHERE calendarid=(?1);", -1, &entriesHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(entriesHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               return CDSCALENDAR_FAILED;
+       }
+       
+       resultCode = sqlite3_step(entriesHandle);
+       
+       if (resultCode == SQLITE_DONE){
+               deleteResult = CDSCALENDAR_OK;
+       } else {
+               return CDSCALENDAR_FAILED;
+       }
+       
+       return deleteResult;
+       
+}
+
+CDSAddEntryResult CalendarDataStorage::AddEvent(int calendarID, std::string filename)
+{
+       
+       CDSAddEntryResult addResult;
+       addResult.addEventResult = CDSENTRY_UNITTESTFAIL;
+       
+       // Load the event file.
+       
+       CalendarEventObject eventData;
+       CalendarObjectLoadResult eventLoadResult = eventData.LoadFile(filename);
+       
+       // Check the result of the event file load.
+       
+       switch (eventLoadResult){
+               
+               case CALENDAROBJECTLOAD_OK:
+                       break;
+               case CALENDAROBJECTLOAD_MISSING:
+                       addResult.addEventResult = CDSENTRY_MISSINGFILE;
+                       return addResult;
+               case CALENDAROBJECTLOAD_INVALIDFORMAT:
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               case CALENDAROBJECTLOAD_CANNOTOPEN:
+                       addResult.addEventResult = CDSENTRY_CANNOTOPENFILE;
+                       return addResult;
+               
+       }
+       
+       // Check if calendar exists first.
+       
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from calendars WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               addResult.addEventResult = CDSENTRY_NOCALENDAR;
+               return addResult;
+       } else {
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       // Get the required values from the event object.
+       
+       int eventStartYear = 0;
+       int eventStartMonth = 0;
+       int eventStartDay = 0;
+       int eventStartHour = 0;
+       int eventStartMinute = 0;
+       int eventStartSecond = 0;
+       int eventStartDuration = 0;
+       std::string eventString = "";
+       
+       // Start Date.
+       
+       if (eventData.DateTimeStartData.size() < 16){
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+       
+       eventString = eventData.DateTimeStartData.substr(0,4);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartYear = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+
+       eventString = eventData.DateTimeStartData.substr(4,2);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartMonth = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+       
+       eventString = eventData.DateTimeStartData.substr(6,2);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartDay = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+
+       eventString = eventData.DateTimeStartData.substr(9,2);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartHour = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+       
+       eventString = eventData.DateTimeStartData.substr(11,2);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartMinute = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+       
+       eventString = eventData.DateTimeStartData.substr(13,2);
+       
+       if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+               eventStartSecond = atoi(eventString.c_str());
+               
+       } else {
+               
+               addResult.addEventResult = CDSENTRY_INVALIDFILE;
+               return addResult;
+               
+       }
+       
+       //eventYear = eventStartDate.substr(0, 4);
+       
+       // End Date.
+       
+       int eventEndYear = 0;
+       int eventEndMonth = 0;
+       int eventEndDay = 0;
+       int eventEndHour = 0;
+       int eventEndMinute = 0;
+       int eventEndSecond = 0;
+       int eventEndDuration = 0;
+       
+       if (eventData.DateTimeEndData != ""){
+       
+               if (eventData.DateTimeEndData.size() < 16){
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+       
+               eventString = eventData.DateTimeEndData.substr(0,4);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndYear = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+
+               eventString = eventData.DateTimeEndData.substr(4,2);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndMonth = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+       
+               eventString = eventData.DateTimeEndData.substr(6,2);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndDay = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+
+               eventString = eventData.DateTimeEndData.substr(9,2);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndHour = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+       
+               eventString = eventData.DateTimeEndData.substr(11,2);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndMinute = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+       
+               eventString = eventData.DateTimeEndData.substr(13,2);
+       
+               if (all_of(eventString.begin(), eventString.end(), ::isdigit)){
+               
+                       eventEndSecond = atoi(eventString.c_str());
+               
+               } else {
+               
+                       addResult.addEventResult = CDSENTRY_INVALIDFILE;
+                       return addResult;
+               
+               }
+               
+       }
+
+       eventString = eventData.DurationData;
+       
+       // Process the duration data.
+       
+       int eventDurationWeeks = 0;
+       int eventDurationDays = 0;
+       int eventDurationHours = 0;
+       int eventDurationMinutes = 0;
+       int eventDurationSeconds = 0;
+       
+       // Get the duration (if DTEND hasn't been specified).
+       
+       if (eventData.DurationData.size() > 0){
+               
+               bool FoundP = false;
+               bool FoundW = false;
+               bool DateTimeMode = false;
+               
+               std::string::iterator eventDataChar = eventData.DurationData.begin();
+               std::string currentValue = "";
+               
+               if (*eventDataChar != 'P'){
+                       
+                       eventDataChar = eventData.DurationData.end();
+                       
+               }
+               
+               for(eventDataChar; eventDataChar != eventData.DurationData.end(); eventDataChar++){
+                       
+                       // Check if value is a digit.
+                       
+                       if (isdigit(*eventDataChar)){
+                               
+                               currentValue += *eventDataChar;
+                               
+                       } else {
+                               
+                               // Check that the value matches one of the letters.
+                               
+                               if (*eventDataChar == 'W' && DateTimeMode == false){
+                               
+                                       eventDurationWeeks = atoi(currentValue.c_str());
+                                       
+                               } else if (*eventDataChar == 'D' && DateTimeMode == false){
+
+                                       eventDurationDays = atoi(currentValue.c_str());
+                                       
+                               } else if (*eventDataChar == 'T' && DateTimeMode == false){
+                                       
+                                       DateTimeMode = true;
+                                       
+                               } else if (*eventDataChar == 'H'){
+
+                                       eventDurationHours = atoi(currentValue.c_str());
+                                       
+                               } else if (*eventDataChar == 'M'){
+                                       
+                                       eventDurationMinutes = atoi(currentValue.c_str());
+                                       
+                               } else if (*eventDataChar == 'S'){
+                               
+                                       eventDurationSeconds = atoi(currentValue.c_str());
+                                       
+                               }
+                                       
+                               // Reset the current value.
+                               
+                               currentValue = "";
+                               
+                       }
+                       
+               }
+               
+       }
+       
+       // Add the calendar entry.
+       
+       std::string sqlParameter = "INSERT INTO calendarentries (calendarid, entryname, entrydescription,"
+       " entrystartyear, entrystartmonth, entrystartday, entrystarthour, entrystartminute, entrystartsecond,"
+       " entryendyear, entryendmonth, entryendday, entryendhour, entryendminute, entryendsecond, "
+       " entrydurationweek, entrydurationday, entrydurationhour, entrydurationminute, entrydurationsecond)"
+       " VALUES ((?1), (?2), (?3), (?4), (?5), (?6), (?7), (?8), (?9), (?10), "
+       " (?11), (?12), (?13), (?14), (?15), (?16), (?17), (?18), (?19), (?20))";
+       
+       resultCode = sqlite3_prepare_v2(db, sqlParameter.c_str(), -1, &statementHandle, nullptr);
+
+       resultCode = sqlite3_bind_int(statementHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       // Process Entry Name.
+       
+       resultCode = sqlite3_bind_text(statementHandle, 2, eventData.SummaryData.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       // Process Entry Description.
+       
+       string eventDescription;
+       
+       try {
+               eventDescription = eventData.DescriptionList.at(0);
+       }
+       
+       catch (out_of_range &err){
+               eventDescription = "";
+       }
+       
+       resultCode = sqlite3_bind_text(statementHandle, 3, eventDescription.c_str(), -1, SQLITE_STATIC);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       // Process Entry Start Date information.
+       
+       resultCode = sqlite3_bind_int(statementHandle, 4, eventStartYear);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 5, eventStartMonth);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 6, eventStartDay);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 7, eventStartHour);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 8, eventStartMinute);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 9, eventStartSecond);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       // Process Entry Start End information.
+       
+       resultCode = sqlite3_bind_int(statementHandle, 10, eventEndYear);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 11, eventEndMonth);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 12, eventEndDay);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 13, eventEndHour);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+
+       resultCode = sqlite3_bind_int(statementHandle, 14, eventEndMinute);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 15, eventEndSecond);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 16, eventDurationWeeks);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 17, eventDurationDays);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 18, eventDurationHours);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 19, eventDurationMinutes);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 20, eventDurationSeconds);
+       
+       if (resultCode != 0){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode != SQLITE_DONE){
+               addResult.addEventResult = CDSENTRY_FAILED;
+               return addResult;
+       }
+       
+       addResult.calendarEntryID = sqlite3_last_insert_rowid(db);
+       addResult.addEventResult = CDSENTRY_OK;
+       
+       return addResult;
+       
+}
+
+CDSGetCalendarEntryInfo CalendarDataStorage::GetEvent(int calendarEntryID)
+{
+       
+       CDSGetCalendarEntryInfo entryResult;
+       
+       // Check if the calendar entry exists.
+       
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id FROM calendarentries WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarEntryID);
+       
+       if (resultCode != 0){
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               entryResult.getEventResult = CDSENTRY_NOENTRY;
+               return entryResult;
+       } else {
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       // Get the calendar entry data.
+       
+       std::string sqlParameter = "SELECT entryname, entrydescription,"
+       " entrystartyear, entrystartmonth, entrystartday, entrystarthour, entrystartminute, entrystartsecond,"
+       " entryendyear, entryendmonth, entryendday, entryendhour, entryendminute, entryendsecond, "
+       " entrydurationweek, entrydurationday, entrydurationhour, entrydurationminute, entrydurationsecond "
+       " FROM calendarentries WHERE id=(?1)";
+       
+       resultCode = sqlite3_prepare_v2(db, sqlParameter.c_str(), -1, &statementHandle, nullptr);
+
+       if (resultCode != 0){
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 1, calendarEntryID);
+       
+       if (resultCode != 0){
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+               // Get the calendar entry name,
+               
+               stringstream entryStream;
+               
+               entryStream << sqlite3_column_text(statementHandle, 0);
+               entryResult.entryName = entryStream.str();
+               
+               entryStream.str("");
+               
+               // Get the calendar entry description.
+               
+               entryStream << sqlite3_column_text(statementHandle, 1);
+               entryResult.entryDescription = entryStream.str();               
+
+               entryStream.str("");
+               
+               entryResult.entryStartYear = sqlite3_column_int(statementHandle, 2);
+               entryResult.entryStartMonth = sqlite3_column_int(statementHandle, 3);
+               entryResult.entryStartDay = sqlite3_column_int(statementHandle, 4);
+               entryResult.entryStartHour = sqlite3_column_int(statementHandle, 5);
+               entryResult.entryStartMinute = sqlite3_column_int(statementHandle, 6);
+               entryResult.entryStartSecond = sqlite3_column_int(statementHandle, 7);
+               entryResult.entryEndYear = sqlite3_column_int(statementHandle, 8);
+               entryResult.entryEndMonth = sqlite3_column_int(statementHandle, 9);
+               entryResult.entryEndDay = sqlite3_column_int(statementHandle, 10);
+               entryResult.entryEndHour = sqlite3_column_int(statementHandle, 11);             
+               entryResult.entryEndMinute = sqlite3_column_int(statementHandle, 12);
+               entryResult.entryEndSecond = sqlite3_column_int(statementHandle, 13);
+               entryResult.entryDurationWeeks = sqlite3_column_int(statementHandle, 14);
+               entryResult.entryDurationDays = sqlite3_column_int(statementHandle, 15);
+               entryResult.entryDurationHours = sqlite3_column_int(statementHandle, 16);
+               entryResult.entryDurationMinutes = sqlite3_column_int(statementHandle, 17);
+               entryResult.entryDurationSeconds = sqlite3_column_int(statementHandle, 18);
+               
+       } else if (resultCode == SQLITE_DONE) {
+               entryResult.getEventResult = CDSENTRY_NOCALENDAR;
+               return entryResult;
+       } else {
+               entryResult.getEventResult = CDSENTRY_FAILED;
+               return entryResult;
+       }
+       
+       entryResult.getEventResult = CDSENTRY_OK;
+       
+       return entryResult;
+       
+}
+
+CDSEntryResult CalendarDataStorage::DeleteEvent(int calendarEntryID)
+{
+       
+       CDSEntryResult deleteResult = CDSENTRY_UNITTESTFAIL;
+       
+       // Check if the calendar entry exists.
+       
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *statementHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id FROM calendarentries WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSENTRY_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarEntryID);
+       
+       if (resultCode != 0){
+               return CDSENTRY_FAILED;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               return CDSENTRY_NOENTRY;
+       } else {
+               return CDSENTRY_FAILED;
+       }
+
+       // Delete the account.
+       
+       resultCode = sqlite3_prepare_v2(db, "DELETE FROM calendarentries WHERE id=(?1);", -1, &statementHandle, nullptr);
+       
+       if (resultCode != 0){
+               return CDSENTRY_FAILED;
+       }
+       
+       resultCode = sqlite3_bind_int(statementHandle, 1, calendarEntryID);
+       
+       if (resultCode != 0){
+               return CDSENTRY_FAILED;
+       }
+       
+       resultCode = sqlite3_step(statementHandle);
+       
+       if (resultCode == SQLITE_DONE){
+               deleteResult = CDSENTRY_OK;
+       } else {
+               return CDSENTRY_FAILED;
+       }
+       
+       return deleteResult;    
+       
+}
+
+CDSEntryList CalendarDataStorage::GetEventList(int calendarID){
+       
+       CDSEntryList entryList;
+       entryList.getEventListResult = CDSENTRY_UNITTESTFAIL;
+       
+       // Check if calendar exists first.
+       
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *calendarHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from calendars WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               entryList.getEventListResult = CDSENTRY_NOCALENDAR;
+               return entryList;
+       } else {
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       // Get the list of entry IDs.
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id FROM calendarentries WHERE calendarid=(?1);", -1, &calendarHandle, nullptr);
+       
+       if (resultCode != 0){
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       resultCode = sqlite3_bind_int(calendarHandle, 1, calendarID);
+       
+       if (resultCode != 0){
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       resultCode = sqlite3_step(calendarHandle);
+       
+       if (resultCode == SQLITE_DONE || resultCode == SQLITE_ROW){
+       } else {
+               entryList.getEventListResult = CDSENTRY_FAILED;
+               return entryList;
+       }
+       
+       while (resultCode == SQLITE_ROW){
+               
+               int calendarID = sqlite3_column_int(calendarHandle, 0);
+               
+               entryList.entryList.push_back(calendarID);
+               
+               resultCode = sqlite3_step(calendarHandle);
+               
+       }       
+       
+       entryList.getEventListResult = CDSENTRY_OK;
+       
+       return entryList;
+       
+}
+
+CDSCalendarList CalendarDataStorage::GetCalendarList(int accountID){
+       
+       CDSCalendarList calendarList;
+       calendarList.getCalendarListResult = CDSCALENDAR_UNITTESTFAIL;
+       
+       // Check if calendar exists first.
+       
+       int resultCode;
+       
+       sqlite3_stmt *findHandle;
+       sqlite3_stmt *calendarHandle;
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id from accounts WHERE id=(?1);", -1, &findHandle, nullptr);
+       
+       if (resultCode != 0){
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       resultCode = sqlite3_bind_int(findHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       resultCode = sqlite3_step(findHandle);
+       
+       if (resultCode == SQLITE_ROW){
+               
+       } else if (resultCode == SQLITE_DONE) {
+               calendarList.getCalendarListResult = CDSCALENDAR_NOCALENDAR;
+               return calendarList;
+       } else {
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       // Get the list of entry IDs.
+       
+       resultCode = sqlite3_prepare_v2(db, "SELECT id, calendarid FROM calendars WHERE accountid=(?1);", -1, &calendarHandle, nullptr);
+       
+       if (resultCode != 0){
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       resultCode = sqlite3_bind_int(calendarHandle, 1, accountID);
+       
+       if (resultCode != 0){
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       resultCode = sqlite3_step(calendarHandle);
+       
+       if (resultCode == SQLITE_DONE || resultCode == SQLITE_ROW){
+       } else {
+               calendarList.getCalendarListResult = CDSCALENDAR_FAILED;
+               return calendarList;
+       }
+       
+       while (resultCode == SQLITE_ROW){
+               
+               int calendarID = sqlite3_column_int(calendarHandle, 0);
+               
+               stringstream calendarStream;
+               
+               calendarStream << sqlite3_column_text(calendarHandle, 1);
+               
+               calendarList.calendarList.push_back(calendarID);
+               calendarList.calendarListTextID.push_back(calendarStream.str());
+               
+               calendarStream.str("");
+               
+               resultCode = sqlite3_step(calendarHandle);
+               
+       }       
+       
+       calendarList.getCalendarListResult = CDSCALENDAR_OK;
+       
+       return calendarList;
+       
+}
\ No newline at end of file
diff --git a/source/libraries/CalendarDataStorage/CalendarDataStorage.h b/source/libraries/CalendarDataStorage/CalendarDataStorage.h
new file mode 100644 (file)
index 0000000..7387194
--- /dev/null
@@ -0,0 +1,149 @@
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <cctype>
+#include <algorithm>
+
+#include <sqlite3.h>
+
+#include "../../objects/calendarevent/CalendarEvent.h"
+#include "../../common/colour.h"
+
+#ifndef __LIBRARIES_CALENDARDATASTORAGE_H__
+#define __LIBRARIES_CALENDARDATASTORAGE_H__
+
+/*enum CDSAddEntryResult{
+       CDSADDENTRY_UNITTESTFAIL = -1,
+       CDSADDENTRY_OK
+}*/
+
+enum CDSAccountResult{
+       CDSACCOUNT_UNITTESTFAIL = -1,
+       CDSACCOUNT_OK,
+       CDSACCOUNT_FAILED,
+       CDSACCOUNT_NOACTION,
+       CDSACCOUNT_NOACCOUNT
+};
+
+enum CDSCalendarResult{
+       CDSCALENDAR_UNITTESTFAIL = -1,
+       CDSCALENDAR_OK,
+       CDSCALENDAR_FAILED,
+       CDSCALENDAR_NOACTION,
+       CDSCALENDAR_NOCALENDAR
+};
+
+enum CDSEntryResult{
+       CDSENTRY_UNITTESTFAIL = -1,
+       CDSENTRY_OK,
+       CDSENTRY_FAILED,
+       CDSENTRY_NOACTION,
+       CDSENTRY_NOACCOUNT,
+       CDSENTRY_NOCALENDAR,
+       CDSENTRY_NOENTRY,
+       CDSENTRY_MISSINGFILE,
+       CDSENTRY_CANNOTOPENFILE,
+       CDSENTRY_INVALIDFILE,
+};
+
+struct CDSGetAccountInfo{
+       int accountID = 0;
+       std::string accountName = "";
+       CDSAccountResult accountInfoResult = CDSACCOUNT_NOACTION;
+};
+
+struct CDSGetCalendarInfo{
+       int accountID = 0;
+       int calendarID = 0;
+       std::string accountName = "";
+       std::string calendarName = "";
+       std::string calendarTextID = "";
+       Colour calendarColour;
+       CDSAccountResult accountInfoResult = CDSACCOUNT_NOACTION;
+       CDSCalendarResult calendarInfoResult = CDSCALENDAR_NOACTION;
+};
+
+struct CDSAddEntryResult{
+       int calendarEntryID = 0;
+       CDSEntryResult addEventResult = CDSENTRY_NOACTION;
+};
+
+struct CDSGetCalendarEntryInfo{
+       int accountID = 0;
+       int calendarID = 0;
+       int calendarEntryID = 0;
+       std::string entryName = "";
+       std::string entryDescription = "";
+       int entryStartYear = 0;
+       int entryStartMonth = 0;
+       int entryStartDay = 0;
+       int entryStartHour = 0;
+       int entryStartMinute = 0;
+       int entryStartSecond = 0;
+       int entryEndYear = 0;
+       int entryEndMonth = 0;
+       int entryEndDay = 0;
+       int entryEndHour = 0;
+       int entryEndMinute = 0;
+       int entryEndSecond = 0;
+       int entryDurationWeeks = 0;
+       int entryDurationDays = 0;
+       int entryDurationHours = 0;
+       int entryDurationMinutes = 0;
+       int entryDurationSeconds = 0;
+       CDSEntryResult getEventResult = CDSENTRY_NOACTION;
+};
+
+struct CDSEntryList{
+       std::vector <int> entryList;
+       CDSEntryResult getEventListResult = CDSENTRY_NOACTION;
+};
+
+struct CDSCalendarList{
+       std::vector <int> calendarList;
+       std::vector <std::string> calendarListTextID;
+       CDSCalendarResult getCalendarListResult = CDSCALENDAR_NOACTION;
+};
+
+struct CDSAccountList{
+       std::vector<CDSGetAccountInfo> accountList;
+       CDSAccountResult getAccountListResult = CDSACCOUNT_NOACTION;
+};
+
+class CalendarDataStorage{
+
+       private:
+               sqlite3 *db = nullptr;
+               void SetupTables();
+               bool DataStorageInitOK = false;
+       public:
+               CalendarDataStorage();
+               ~CalendarDataStorage();
+               bool DidInitOK();
+       
+               // Account functions.
+       
+               CDSAccountResult AddAccount(std::string accountName);
+               CDSGetAccountInfo GetAccount(std::string accountName);
+               CDSAccountResult UpdateAccount(int accountID, std::string accountName);
+               CDSAccountResult DeleteAccount(int accountID);
+               CDSAccountList GetAccountList();
+       
+               // Calendar functions.
+       
+               CDSCalendarResult AddCalendar(int accountID, std::string calendarName, std::string calendarID, Colour calendarColour);
+               CDSGetCalendarInfo GetCalendar(std::string accountName, std::string calendarTextID);
+               CDSCalendarList GetCalendarList(int accountID);
+               CDSCalendarResult UpdateCalendar(int calendarID, std::string calendarName);
+               CDSCalendarResult DeleteCalendar(int calendarID);
+       
+               // Entry functions
+       
+               CDSAddEntryResult AddEvent(int calendarID, std::string filename);
+               CDSGetCalendarEntryInfo GetEvent(int calendarEntryID);
+               CDSEntryList GetEventList(int calendarID);
+               CDSEntryResult DeleteEvent(int calendarEntryID);
+        
+};
+
+#endif
\ No newline at end of file
index 129533e..c75ca72 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
 
+Colour DefaultColour;
+
 TEST(CalendarDataStorage, Setup_Tables){
        
        CalendarDataStorage SetupTablesTest;
@@ -103,6 +105,72 @@ TEST(CalendarDataStorage, Get_Three_Accounts_Information){
        
 }
 
+TEST(CalendarDataStorage, Get_List_Of_One_Account){
+       
+       CalendarDataStorage AccountInformationTest;
+       
+       AccountInformationTest.AddAccount("Test Account 1");
+       
+       CDSAccountList accountListData = AccountInformationTest.GetAccountList();
+       
+       ASSERT_EQ(1, accountListData.accountList.size());
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
+
+       ASSERT_EQ(1, accountListData.accountList[0].accountID); 
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
+       ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
+       
+}
+
+TEST(CalendarDataStorage, Get_List_Of_Two_Accounts){
+       
+       CalendarDataStorage AccountInformationTest;
+       
+       AccountInformationTest.AddAccount("Test Account 1");
+       AccountInformationTest.AddAccount("Test Account 2");
+       
+       CDSAccountList accountListData = AccountInformationTest.GetAccountList();
+       
+       ASSERT_EQ(2, accountListData.accountList.size());
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
+
+       ASSERT_EQ(1, accountListData.accountList[0].accountID); 
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
+       ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
+
+       ASSERT_EQ(2, accountListData.accountList[1].accountID);
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[1].accountInfoResult);
+       ASSERT_EQ("Test Account 2", accountListData.accountList[1].accountName);
+       
+}
+
+TEST(CalendarDataStorage, Get_List_Of_Three_Accounts){
+       
+       CalendarDataStorage AccountInformationTest;
+       
+       AccountInformationTest.AddAccount("Test Account 1");
+       AccountInformationTest.AddAccount("Test Account 2");
+       AccountInformationTest.AddAccount("Test Account 3");
+       
+       CDSAccountList accountListData = AccountInformationTest.GetAccountList();
+       
+       ASSERT_EQ(3, accountListData.accountList.size());
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
+
+       ASSERT_EQ(1, accountListData.accountList[0].accountID); 
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
+       ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
+
+       ASSERT_EQ(2, accountListData.accountList[1].accountID);
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[1].accountInfoResult);
+       ASSERT_EQ("Test Account 2", accountListData.accountList[1].accountName);
+
+       ASSERT_EQ(3, accountListData.accountList[2].accountID);
+       ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[2].accountInfoResult);
+       ASSERT_EQ("Test Account 3", accountListData.accountList[2].accountName);
+
+}
+
 TEST(CalendarDataStorage, Update_One_Account){
        
        CalendarDataStorage UpdateAccountTest;
@@ -215,7 +283,7 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_One_Account){
        
        AddCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
 }
 
@@ -225,8 +293,8 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_One_Account){
        
        AddCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
 }
 
@@ -236,9 +304,9 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_One_Account){
        
        AddCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
 }
 
@@ -249,9 +317,9 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_Two_Accounts){
        AddCalendarTest.AddAccount("Test Account 1");
        AddCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
 }
 
@@ -262,11 +330,11 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_Two_Accounts){
        AddCalendarTest.AddAccount("Test Account 1");
        AddCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
 }
 
@@ -277,13 +345,13 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_Two_Accounts){
        AddCalendarTest.AddAccount("Test Account 1");
        AddCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
 }
 
@@ -295,11 +363,11 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_Three_Accounts){
        AddCalendarTest.AddAccount("Test Account 2");
        AddCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
 }
 
@@ -311,14 +379,14 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_Three_Accounts){
        AddCalendarTest.AddAccount("Test Account 2");
        AddCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
 }
 
@@ -330,17 +398,17 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_Three_Accounts){
        AddCalendarTest.AddAccount("Test Account 2");
        AddCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
 }
 
@@ -350,9 +418,9 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_One_Account){
        
        GetCalendarTest.AddAccount("Test Account 1");   
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info;
        CDSGetCalendarInfo calendar2Info;
@@ -399,13 +467,13 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_Two_Accounts){
        GetCalendarTest.AddAccount("Test Account 1");
        GetCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info;
        CDSGetCalendarInfo calendar2Info;
@@ -489,17 +557,17 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_Three_Accounts){
        GetCalendarTest.AddAccount("Test Account 2");
        GetCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", DefaultColour));
 
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info;
        CDSGetCalendarInfo calendar2Info;
@@ -617,7 +685,7 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_One_Account){
        
        UpdateCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        
@@ -633,8 +701,8 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_Two_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 1");
        UpdateCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
@@ -655,9 +723,9 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_Three_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 2");
        UpdateCalendarTest.AddAccount("Test Account 3");        
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test"));   
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", DefaultColour));    
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
@@ -679,8 +747,8 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_One_Account){
        
        UpdateCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -700,10 +768,10 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_Two_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 1");
        UpdateCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -730,12 +798,12 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_Three_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 2");
        UpdateCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 5", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 6", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 5", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 6", "calendar2-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -767,9 +835,9 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_One_Account){
        
        UpdateCalendarTest.AddAccount("Test Account 1");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -792,12 +860,12 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_Two_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 1");
        UpdateCalendarTest.AddAccount("Test Account 2");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -830,15 +898,15 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_Three_Accounts){
        UpdateCalendarTest.AddAccount("Test Account 2");
        UpdateCalendarTest.AddAccount("Test Account 3");
 
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 7", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 8", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 9", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 7", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 8", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 9", "calendar3-test", DefaultColour));
        
        CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
        CDSGetCalendarInfo calendar2Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
@@ -879,7 +947,7 @@ TEST(CalendarDataStorage, Delete_One_Calendar){
        
        DeleteCalendarTest.AddAccount("Test Account 1");
        
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
        
        calendarID = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
        
@@ -896,8 +964,8 @@ TEST(CalendarDataStorage, Delete_Two_Calendars){
        DeleteCalendarTest.AddAccount("Test Account 1");
        DeleteCalendarTest.AddAccount("Test Account 2");        
        
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
        
        calendarID1 = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
        calendarID2 = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
@@ -918,9 +986,9 @@ TEST(CalendarDataStorage, Delete_Three_Calendars){
        DeleteCalendarTest.AddAccount("Test Account 2");
        DeleteCalendarTest.AddAccount("Test Account 3");
        
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test"));
-       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test"));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", DefaultColour));
+       ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", DefaultColour));
        
        calendarID1 = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
        calendarID2 = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
@@ -937,7 +1005,7 @@ TEST(CalendarDataStorage, Add_One_Event){
        CalendarDataStorage AddEventTest;
        
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEventResult = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        
@@ -951,7 +1019,7 @@ TEST(CalendarDataStorage, Add_Two_Events){
        CalendarDataStorage AddEventTest;
        
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEvent1Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        
@@ -970,7 +1038,7 @@ TEST(CalendarDataStorage, Add_Three_Events){
        CalendarDataStorage AddEventTest;
        
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEvent1Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        
@@ -994,7 +1062,7 @@ TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information){
        CalendarDataStorage AddEventTest;       
 
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEventResult = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        
        // Get the entry information.
@@ -1024,7 +1092,7 @@ TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information_With_Dur
        CalendarDataStorage AddEventTest;       
 
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEventResult = AddEventTest.AddEvent(1, "CalendarEvent2.ics");
        
        EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
@@ -1061,7 +1129,7 @@ TEST(CalendarDataStorage, Add_Two_Events_And_Get_Event_Basic_Information){
        CalendarDataStorage AddEventTest;       
 
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = AddEventTest.AddEvent(1, "CalendarEvent2.ics");
        
@@ -1117,7 +1185,7 @@ TEST(CalendarDataStorage, Add_The_Same_Three_Events_And_Get_Event_Information){
        CalendarDataStorage AddEventTest;
 
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent3Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
@@ -1188,7 +1256,7 @@ TEST(CalendarDataStorage, Add_Three_Events_And_Get_Event_Information){
        CalendarDataStorage AddEventTest;
 
        AddEventTest.AddAccount("Test Account 1");
-       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = AddEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = AddEventTest.AddEvent(1, "CalendarEvent2.ics");
        CDSAddEntryResult addEvent3Result = AddEventTest.AddEvent(1, "CalendarEvent3.ics");
@@ -1264,7 +1332,7 @@ TEST(CalendarDataStorage, Delete_One_Event){
        CalendarDataStorage DeleteEventTest;
 
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEventResult = DeleteEventTest.AddEvent(1, "CalendarEvent1.ics");
        
        EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
@@ -1278,7 +1346,7 @@ TEST(CalendarDataStorage, Delete_Two_Events){
        CalendarDataStorage DeleteEventTest;
 
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = DeleteEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = DeleteEventTest.AddEvent(1, "CalendarEvent2.ics");
        
@@ -1295,7 +1363,7 @@ TEST(CalendarDataStorage, Delete_Three_Events){
        CalendarDataStorage DeleteEventTest;
 
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = DeleteEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = DeleteEventTest.AddEvent(1, "CalendarEvent2.ics");
        CDSAddEntryResult addEvent3Result = DeleteEventTest.AddEvent(1, "CalendarEvent3.ics");
@@ -1315,7 +1383,7 @@ TEST(CalendarDataStorage, Delete_One_Calendar_And_Events){
        CalendarDataStorage DeleteEventTest;
        
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
        CDSAddEntryResult addEvent1Result = DeleteEventTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = DeleteEventTest.AddEvent(1, "CalendarEvent2.ics");
        CDSAddEntryResult addEvent3Result = DeleteEventTest.AddEvent(1, "CalendarEvent3.ics");
@@ -1333,8 +1401,8 @@ TEST(CalendarDataStorage, Delete_Two_Calendars_And_Events){
        CalendarDataStorage DeleteEventTest;
        
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar2-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar2-test", DefaultColour);
 
        // Setup and delete the first calendar.
        
@@ -1367,9 +1435,9 @@ TEST(CalendarDataStorage, Delete_Three_Calendars_And_Events){
        CalendarDataStorage DeleteEventTest;
        
        DeleteEventTest.AddAccount("Test Account 1");
-       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       DeleteEventTest.AddCalendar(1, "Calendar 2", "calendar2-test");
-       DeleteEventTest.AddCalendar(1, "Calendar 3", "calendar3-test");
+       DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteEventTest.AddCalendar(1, "Calendar 2", "calendar2-test", DefaultColour);
+       DeleteEventTest.AddCalendar(1, "Calendar 3", "calendar3-test", DefaultColour);
 
        // Setup and delete the first calendar.
        
@@ -1414,7 +1482,7 @@ TEST(CalendarDataStorage, Delete_One_Account_And_Associated_Data){
        CalendarDataStorage DeleteAccountTest;
        
        DeleteAccountTest.AddAccount("Test Account 1");
-       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test");
+       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
 
        // Setup and delete the first account.
        
@@ -1442,9 +1510,9 @@ TEST(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){
 
        // Setup and delete the first account.
        
-       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test");
-       DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test");
+       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEvent1Result = DeleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = DeleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
@@ -1460,9 +1528,9 @@ TEST(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){
 
        // Setup and delete the second account.
        
-       DeleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test");
-       DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test");
-       DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test");
+       DeleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", DefaultColour);
        
        addEvent1Result = DeleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
        addEvent2Result = DeleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
@@ -1488,9 +1556,9 @@ TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){
 
        // Setup and delete the first account.
        
-       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test");
-       DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test");
+       DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEvent1Result = DeleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = DeleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
@@ -1506,9 +1574,9 @@ TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){
 
        // Setup and delete the second account.
        
-       DeleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test");
-       DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test");
-       DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test");
+       DeleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", DefaultColour);
        
        addEvent1Result = DeleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
        addEvent2Result = DeleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
@@ -1524,9 +1592,9 @@ TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){
 
        // Setup and delete the third account.
        
-       DeleteAccountTest.AddCalendar(3, "Calendar 1", "calendar1-test");
-       DeleteAccountTest.AddCalendar(3, "Calendar 2", "calendar1-test");
-       DeleteAccountTest.AddCalendar(3, "Calendar 3", "calendar1-test");
+       DeleteAccountTest.AddCalendar(3, "Calendar 1", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(3, "Calendar 2", "calendar1-test", DefaultColour);
+       DeleteAccountTest.AddCalendar(3, "Calendar 3", "calendar1-test", DefaultColour);
        
        addEvent1Result = DeleteAccountTest.AddEvent(7, "CalendarEvent1.ics");
        addEvent2Result = DeleteAccountTest.AddEvent(7, "CalendarEvent2.ics");
@@ -1550,9 +1618,9 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_One_Account){
 
        // Setup and delete the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", DefaultColour);
        
        CDSAddEntryResult addEvent1Result = GetEventsListTest.AddEvent(1, "CalendarEvent1.ics");
        CDSAddEntryResult addEvent2Result = GetEventsListTest.AddEvent(1, "CalendarEvent2.ics");
@@ -1574,9 +1642,9 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_Two_Accounts){
 
        // Setup and delete the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", DefaultColour);
        
        // Setup the first account.
        
@@ -1612,9 +1680,9 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_Three_Accounts){
 
        // Setup and delete the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", DefaultColour);
        
        // Setup the first account.
        
@@ -1659,12 +1727,12 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_One_Account){
        CalendarDataStorage GetEventsListTest;
        
        GetEventsListTest.AddAccount("Test Account 1");
-
+       
        // Setup the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", DefaultColour);
        
        // Get the list of calendar IDs.
        
@@ -1686,12 +1754,12 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){
        
        GetEventsListTest.AddAccount("Test Account 1");
        GetEventsListTest.AddAccount("Test Account 2");
-
+       
        // Setup the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", DefaultColour);
        
        // Get the list of calendar IDs.
        
@@ -1707,9 +1775,9 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){
        
        // Setup the second account.
        
-       GetEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test");
-       GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test");
-       GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test");
+       GetEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", DefaultColour);
+       GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", DefaultColour);
+       GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", DefaultColour);
 
        calendarList = GetEventsListTest.GetCalendarList(2);
 
@@ -1730,12 +1798,12 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){
        GetEventsListTest.AddAccount("Test Account 1");
        GetEventsListTest.AddAccount("Test Account 2");
        GetEventsListTest.AddAccount("Test Account 3");
-
+       
        // Setup the first account.
        
-       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test");
-       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test");
+       GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", DefaultColour);
+       GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", DefaultColour);
        
        // Get the list of calendar IDs.
        
@@ -1751,9 +1819,9 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){
        
        // Setup the second account.
        
-       GetEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test");
-       GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test");
-       GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test");
+       GetEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", DefaultColour);
+       GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", DefaultColour);
+       GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", DefaultColour);
 
        calendarList = GetEventsListTest.GetCalendarList(2);
 
@@ -1767,9 +1835,9 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){
 
        // Setup the third account.
        
-       GetEventsListTest.AddCalendar(3, "Calendar 7", "calendar7-test");
-       GetEventsListTest.AddCalendar(3, "Calendar 8", "calendar8-test");
-       GetEventsListTest.AddCalendar(3, "Calendar 9", "calendar9-test");
+       GetEventsListTest.AddCalendar(3, "Calendar 7", "calendar7-test", DefaultColour);
+       GetEventsListTest.AddCalendar(3, "Calendar 8", "calendar8-test", DefaultColour);
+       GetEventsListTest.AddCalendar(3, "Calendar 9", "calendar9-test", DefaultColour);
 
        calendarList = GetEventsListTest.GetCalendarList(3);
 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy