--- /dev/null
+#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
#include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
+Colour DefaultColour;
+
TEST(CalendarDataStorage, Setup_Tables){
CalendarDataStorage SetupTablesTest;
}
+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;
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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
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));
}
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;
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;
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;
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");
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");
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");
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");
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");
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");
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");
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");
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");
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;
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;
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;
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");
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");
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");
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.
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);
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");
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");
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");
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);
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");
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");
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");
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.
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.
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.
// 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");
// 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");
// 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");
// 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");
// 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");
// 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");
// 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.
// 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.
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.
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.
// 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);
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.
// 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);
// 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);