// xestiacalendar_calendardatastorage.h - Xestia Calendar Calendar Data Storage Unit Tests
//
// (c) 2016-2017 Xestia Software Development.
//
// This file is part of Xestia Calendar.
//
// Xestia Calendar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, version 3 of the license.
//
// Xestia Calendar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with Xestia Calendar. If not, see
#include "CalendarDataStorage.h"
#include
class CalendarDataStorageTests : public ::testing::Test
{
private:
virtual void SetUp()
{
}
virtual void TearDown()
{
}
};
Colour defaultColour;
TEST_F(CalendarDataStorageTests, Setup_Tables){
CalendarDataStorage setupTablesTest;
ASSERT_EQ(true, setupTablesTest.DidInitOK());
}
TEST_F(CalendarDataStorageTests, Add_One_Account){
CalendarDataStorage addOneEntryTest;
ASSERT_EQ(CDSACCOUNT_OK, addOneEntryTest.AddAccount("Test Account 1", 1));
}
TEST_F(CalendarDataStorageTests, Add_Two_Accounts){
CalendarDataStorage addTwoEntryTest;
ASSERT_EQ(CDSACCOUNT_OK, addTwoEntryTest.AddAccount("Test Account 1", 1));
ASSERT_EQ(CDSACCOUNT_OK, addTwoEntryTest.AddAccount("Test Account 2", 2));
}
TEST_F(CalendarDataStorageTests, Add_Three_Accounts){
CalendarDataStorage addThreeEntryTest;
ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 1", 1));
ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 2", 2));
ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 3", 3));
}
TEST_F(CalendarDataStorageTests, Add_Account_With_No_Name_And_Return_No_Name_Message){
CalendarDataStorage failNameTest;
ASSERT_EQ(CDSACCOUNT_NONAME, failNameTest.AddAccount("", 1));
}
TEST_F(CalendarDataStorageTests, Add_Account_With_Same_Name_Twice_And_Return_Failed_Message){
CalendarDataStorage duplicateNameTest;
ASSERT_EQ(CDSACCOUNT_OK, duplicateNameTest.AddAccount("Account 1", 1));
ASSERT_EQ(CDSACCOUNT_FAILED, duplicateNameTest.AddAccount("Account 1", 1));
}
TEST_F(CalendarDataStorageTests, Get_Account_Information){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
}
TEST_F(CalendarDataStorageTests, Get_Account_Information_That_Does_Not_Exist_Return_No_Account_Message){
CalendarDataStorage noAccountTest;
ASSERT_EQ(CDSACCOUNT_NOACCOUNT, noAccountTest.GetAccount("Test Account 1").accountInfoResult);
}
TEST_F(CalendarDataStorageTests, Get_Two_Accounts_Information){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 1);
accountInformationTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountPreferencesID);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 2").accountInfoResult);
ASSERT_EQ("Test Account 2", accountInformationTest.GetAccount("Test Account 2").accountName);
ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountID);
ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountPreferencesID);
}
TEST_F(CalendarDataStorageTests, Get_Three_Accounts_Information){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 1);
accountInformationTest.AddAccount("Test Account 2", 2);
accountInformationTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountPreferencesID);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 2").accountInfoResult);
ASSERT_EQ("Test Account 2", accountInformationTest.GetAccount("Test Account 2").accountName);
ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountID);
ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountPreferencesID);
ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 3").accountInfoResult);
ASSERT_EQ("Test Account 3", accountInformationTest.GetAccount("Test Account 3").accountName);
ASSERT_EQ(3, accountInformationTest.GetAccount("Test Account 3").accountID);
ASSERT_EQ(3, accountInformationTest.GetAccount("Test Account 3").accountPreferencesID);
}
TEST_F(CalendarDataStorageTests, Get_List_Of_One_Account){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 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);
ASSERT_EQ(1, accountListData.accountList[0].accountPreferencesID);
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Two_Accounts){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 1);
accountInformationTest.AddAccount("Test Account 2", 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(1, accountListData.accountList[0].accountPreferencesID);
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(2, accountListData.accountList[1].accountPreferencesID);
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Three_Accounts){
CalendarDataStorage accountInformationTest;
accountInformationTest.AddAccount("Test Account 1", 1);
accountInformationTest.AddAccount("Test Account 2", 2);
accountInformationTest.AddAccount("Test Account 3", 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(1, accountListData.accountList[0].accountPreferencesID);
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(2, accountListData.accountList[1].accountPreferencesID);
ASSERT_EQ(3, accountListData.accountList[2].accountID);
ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[2].accountInfoResult);
ASSERT_EQ("Test Account 3", accountListData.accountList[2].accountName);
ASSERT_EQ(3, accountListData.accountList[2].accountPreferencesID);
}
TEST_F(CalendarDataStorageTests, Update_One_Account){
CalendarDataStorage updateAccountTest;
updateAccountTest.AddAccount("Test Account 1", 1);
int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
EXPECT_EQ(1, testAccount1ID);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
}
TEST_F(CalendarDataStorageTests, Update_One_Account_Set_Account_Name_To_No_Name_Return_No_Name_Message){
CalendarDataStorage updateAccountTest;
updateAccountTest.AddAccount("Test Account 1", 1);
int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
EXPECT_EQ(1, testAccount1ID);
ASSERT_EQ(CDSACCOUNT_NONAME, updateAccountTest.UpdateAccount(testAccount1ID, ""));
}
TEST_F(CalendarDataStorageTests, Update_One_Account_Set_Account_Name_To_Existing_Account_Return_Failed_Message){
CalendarDataStorage updateAccountTest;
updateAccountTest.AddAccount("Test Account 1", 1);
updateAccountTest.AddAccount("Test Account 2", 2);
int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
EXPECT_EQ(2, testAccount2ID);
ASSERT_EQ(CDSACCOUNT_FAILED, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 1"));
}
TEST_F(CalendarDataStorageTests, Update_One_Account_That_Does_Not_Exist_Return_No_Account_Message){
CalendarDataStorage updateAccountTest;
ASSERT_EQ(CDSACCOUNT_NOACCOUNT, updateAccountTest.UpdateAccount(1, "Missing Account"));
}
TEST_F(CalendarDataStorageTests, Update_Two_Accounts){
CalendarDataStorage updateAccountTest;
updateAccountTest.AddAccount("Test Account 1", 1);
updateAccountTest.AddAccount("Test Account 2", 2);
int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
EXPECT_EQ(1, testAccount1ID);
EXPECT_EQ(2, testAccount2ID);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 2 - Updated"));
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2 - Updated").accountInfoResult);
}
TEST_F(CalendarDataStorageTests, Update_Three_Accounts){
CalendarDataStorage updateAccountTest;
updateAccountTest.AddAccount("Test Account 1", 1);
updateAccountTest.AddAccount("Test Account 2", 2);
updateAccountTest.AddAccount("Test Account 3", 3);
int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
int testAccount3ID = updateAccountTest.GetAccount("Test Account 3").accountID;
EXPECT_EQ(1, testAccount1ID);
EXPECT_EQ(2, testAccount2ID);
EXPECT_EQ(3, testAccount3ID);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 2 - Updated"));
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount3ID, "Test Account 3 - Updated"));
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2 - Updated").accountInfoResult);
ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 3").accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 3 - Updated").accountInfoResult);
}
TEST_F(CalendarDataStorageTests, Delete_One_Account){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
}
TEST_F(CalendarDataStorageTests, Delete_Two_Accounts){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
deleteAccountTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 2").accountID));
}
TEST_F(CalendarDataStorageTests, Delete_Three_Accounts){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
deleteAccountTest.AddAccount("Test Account 2", 2);
deleteAccountTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 2").accountID));
ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 3").accountID));
}
TEST_F(CalendarDataStorageTests, Delete_Account_That_Does_Not_Exist_Return_No_Account_Message){
CalendarDataStorage deleteAccountTest;
ASSERT_EQ(CDSACCOUNT_NOACCOUNT, deleteAccountTest.DeleteAccount(1));
}
TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_One_Account){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_One_Account){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_One_Account){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Calendar_To_Account_That_Does_Not_Exist_Return_No_Account_Message){
CalendarDataStorage addCalendarTest;
ASSERT_EQ(CDSCALENDAR_NOACCOUNT, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_Two_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_Two_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_Two_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_Three_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
addCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_Three_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
addCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_Three_Accounts){
CalendarDataStorage addCalendarTest;
addCalendarTest.AddAccount("Test Account 1", 1);
addCalendarTest.AddAccount("Test Account 2", 2);
addCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
}
TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_One_Account){
CalendarDataStorage getCalendarTest;
getCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
CDSGetCalendarInfo calendar1Info;
CDSGetCalendarInfo calendar2Info;
CDSGetCalendarInfo calendar3Info;
calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
ASSERT_EQ(1, calendar1Info.accountID);
ASSERT_EQ(1, calendar2Info.accountID);
ASSERT_EQ(1, calendar3Info.accountID);
ASSERT_EQ(1, calendar1Info.calendarID);
ASSERT_EQ(2, calendar2Info.calendarID);
ASSERT_EQ(3, calendar3Info.calendarID);
ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
ASSERT_EQ("Test Account 1", calendar1Info.accountName);
ASSERT_EQ("Test Account 1", calendar2Info.accountName);
ASSERT_EQ("Test Account 1", calendar3Info.accountName);
ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
}
TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_Two_Accounts){
CalendarDataStorage getCalendarTest;
getCalendarTest.AddAccount("Test Account 1", 1);
getCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 4"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 5"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 6"));
CDSGetCalendarInfo calendar1Info;
CDSGetCalendarInfo calendar2Info;
CDSGetCalendarInfo calendar3Info;
CDSGetCalendarInfo calendar4Info;
CDSGetCalendarInfo calendar5Info;
CDSGetCalendarInfo calendar6Info;
calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
calendar4Info = getCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
calendar5Info = getCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
calendar6Info = getCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar4Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar5Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar6Info.calendarInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar4Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar5Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar6Info.accountInfoResult);
ASSERT_EQ(1, calendar1Info.accountID);
ASSERT_EQ(1, calendar2Info.accountID);
ASSERT_EQ(1, calendar3Info.accountID);
ASSERT_EQ(2, calendar4Info.accountID);
ASSERT_EQ(2, calendar5Info.accountID);
ASSERT_EQ(2, calendar6Info.accountID);
ASSERT_EQ(1, calendar1Info.calendarID);
ASSERT_EQ(2, calendar2Info.calendarID);
ASSERT_EQ(3, calendar3Info.calendarID);
ASSERT_EQ(4, calendar4Info.calendarID);
ASSERT_EQ(5, calendar5Info.calendarID);
ASSERT_EQ(6, calendar6Info.calendarID);
ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
ASSERT_EQ("Calendar 1", calendar4Info.calendarName);
ASSERT_EQ("Calendar 2", calendar5Info.calendarName);
ASSERT_EQ("Calendar 3", calendar6Info.calendarName);
ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
ASSERT_EQ("calendar1-test", calendar4Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar5Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar6Info.calendarTextID);
ASSERT_EQ("Test Account 1", calendar1Info.accountName);
ASSERT_EQ("Test Account 1", calendar2Info.accountName);
ASSERT_EQ("Test Account 1", calendar3Info.accountName);
ASSERT_EQ("Test Account 2", calendar4Info.accountName);
ASSERT_EQ("Test Account 2", calendar5Info.accountName);
ASSERT_EQ("Test Account 2", calendar6Info.accountName);
ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
ASSERT_EQ("Calendar Description 4", calendar4Info.calendarDescription);
ASSERT_EQ("Calendar Description 5", calendar5Info.calendarDescription);
ASSERT_EQ("Calendar Description 6", calendar6Info.calendarDescription);
}
TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_Three_Accounts){
CalendarDataStorage getCalendarTest;
getCalendarTest.AddAccount("Test Account 1", 1);
getCalendarTest.AddAccount("Test Account 2", 2);
getCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 4"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 5"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 6"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 7"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 8"));
ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 9"));
CDSGetCalendarInfo calendar1Info;
CDSGetCalendarInfo calendar2Info;
CDSGetCalendarInfo calendar3Info;
CDSGetCalendarInfo calendar4Info;
CDSGetCalendarInfo calendar5Info;
CDSGetCalendarInfo calendar6Info;
CDSGetCalendarInfo calendar7Info;
CDSGetCalendarInfo calendar8Info;
CDSGetCalendarInfo calendar9Info;
calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
calendar4Info = getCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
calendar5Info = getCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
calendar6Info = getCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
calendar7Info = getCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
calendar8Info = getCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
calendar9Info = getCalendarTest.GetCalendar("Test Account 3", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar4Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar5Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar6Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar7Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar8Info.calendarInfoResult);
ASSERT_EQ(CDSCALENDAR_OK, calendar9Info.calendarInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar4Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar5Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar6Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar7Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar8Info.accountInfoResult);
ASSERT_EQ(CDSACCOUNT_OK, calendar9Info.accountInfoResult);
ASSERT_EQ(1, calendar1Info.accountID);
ASSERT_EQ(1, calendar2Info.accountID);
ASSERT_EQ(1, calendar3Info.accountID);
ASSERT_EQ(2, calendar4Info.accountID);
ASSERT_EQ(2, calendar5Info.accountID);
ASSERT_EQ(2, calendar6Info.accountID);
ASSERT_EQ(3, calendar7Info.accountID);
ASSERT_EQ(3, calendar8Info.accountID);
ASSERT_EQ(3, calendar9Info.accountID);
ASSERT_EQ(1, calendar1Info.calendarID);
ASSERT_EQ(2, calendar2Info.calendarID);
ASSERT_EQ(3, calendar3Info.calendarID);
ASSERT_EQ(4, calendar4Info.calendarID);
ASSERT_EQ(5, calendar5Info.calendarID);
ASSERT_EQ(6, calendar6Info.calendarID);
ASSERT_EQ(7, calendar7Info.calendarID);
ASSERT_EQ(8, calendar8Info.calendarID);
ASSERT_EQ(9, calendar9Info.calendarID);
ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
ASSERT_EQ("Calendar 1", calendar4Info.calendarName);
ASSERT_EQ("Calendar 2", calendar5Info.calendarName);
ASSERT_EQ("Calendar 3", calendar6Info.calendarName);
ASSERT_EQ("Calendar 1", calendar7Info.calendarName);
ASSERT_EQ("Calendar 2", calendar8Info.calendarName);
ASSERT_EQ("Calendar 3", calendar9Info.calendarName);
ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
ASSERT_EQ("calendar1-test", calendar4Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar5Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar6Info.calendarTextID);
ASSERT_EQ("calendar1-test", calendar7Info.calendarTextID);
ASSERT_EQ("calendar2-test", calendar8Info.calendarTextID);
ASSERT_EQ("calendar3-test", calendar9Info.calendarTextID);
ASSERT_EQ("Test Account 1", calendar1Info.accountName);
ASSERT_EQ("Test Account 1", calendar2Info.accountName);
ASSERT_EQ("Test Account 1", calendar3Info.accountName);
ASSERT_EQ("Test Account 2", calendar4Info.accountName);
ASSERT_EQ("Test Account 2", calendar5Info.accountName);
ASSERT_EQ("Test Account 2", calendar6Info.accountName);
ASSERT_EQ("Test Account 3", calendar7Info.accountName);
ASSERT_EQ("Test Account 3", calendar8Info.accountName);
ASSERT_EQ("Test Account 3", calendar9Info.accountName);
ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
ASSERT_EQ("Calendar Description 4", calendar4Info.calendarDescription);
ASSERT_EQ("Calendar Description 5", calendar5Info.calendarDescription);
ASSERT_EQ("Calendar Description 6", calendar6Info.calendarDescription);
ASSERT_EQ("Calendar Description 7", calendar7Info.calendarDescription);
ASSERT_EQ("Calendar Description 8", calendar8Info.calendarDescription);
ASSERT_EQ("Calendar Description 9", calendar9Info.calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_One_Account){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_Two_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 2"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_Three_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
updateCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 3"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_One_Account){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_Two_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", defaultColour, "Calendar Description 4"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_Three_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
updateCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", defaultColour, "Calendar Description 4"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 5", "calendar1-test", defaultColour, "Calendar Description 5"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 6", "calendar2-test", defaultColour, "Calendar Description 6"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_One_Account){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_Two_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", defaultColour, "Calendar Description 4"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", defaultColour, "Calendar Description 5"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", defaultColour, "Calendar Description 6"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_Three_Accounts){
CalendarDataStorage updateCalendarTest;
updateCalendarTest.AddAccount("Test Account 1", 1);
updateCalendarTest.AddAccount("Test Account 2", 2);
updateCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", defaultColour, "Calendar Description 4"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", defaultColour, "Calendar Description 5"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", defaultColour, "Calendar Description 6"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 7", "calendar1-test", defaultColour, "Calendar Description 7"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 8", "calendar2-test", defaultColour, "Calendar Description 8"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 9", "calendar3-test", defaultColour, "Calendar Description 9"));
CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
CDSGetCalendarInfo calendar7Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
CDSGetCalendarInfo calendar8Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
CDSGetCalendarInfo calendar9Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test");
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar7Info.calendarID, "Calendar 7 Updated", defaultColour, "Calendar Description 7 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar8Info.calendarID, "Calendar 8 Updated", defaultColour, "Calendar Description 8 Updated"));
ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar9Info.calendarID, "Calendar 9 Updated", defaultColour, "Calendar Description 9 Updated"));
ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarName);
ASSERT_EQ("Calendar 7 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
ASSERT_EQ("Calendar 8 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarName);
ASSERT_EQ("Calendar 9 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test").calendarName);
ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarDescription);
ASSERT_EQ("Calendar Description 7 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
ASSERT_EQ("Calendar Description 8 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarDescription);
ASSERT_EQ("Calendar Description 9 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test").calendarDescription);
}
TEST_F(CalendarDataStorageTests, Delete_One_Calendar){
CalendarDataStorage deleteCalendarTest;
int calendarID = 0;
deleteCalendarTest.AddAccount("Test Account 1", 1);
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
calendarID = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID));
}
TEST_F(CalendarDataStorageTests, Delete_Two_Calendars){
CalendarDataStorage deleteCalendarTest;
int calendarID1 = 0;
int calendarID2 = 0;
deleteCalendarTest.AddAccount("Test Account 1", 1);
deleteCalendarTest.AddAccount("Test Account 2", 2);
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1"));
calendarID1 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
calendarID2 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID1));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID2));
}
TEST_F(CalendarDataStorageTests, Delete_Three_Calendars){
CalendarDataStorage deleteCalendarTest;
int calendarID1 = 0;
int calendarID2 = 0;
int calendarID3 = 0;
deleteCalendarTest.AddAccount("Test Account 1", 1);
deleteCalendarTest.AddAccount("Test Account 2", 2);
deleteCalendarTest.AddAccount("Test Account 3", 3);
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1"));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1"));
calendarID1 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
calendarID2 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
calendarID3 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar3-test").calendarID;
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID1));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID2));
ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID3));
}
TEST_F(CalendarDataStorageTests, Add_One_Event){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
ASSERT_EQ(1, addEventResult.calendarEntryID);
}
TEST_F(CalendarDataStorageTests, Add_Two_Events){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
ASSERT_EQ(1, addEvent1Result.calendarEntryID);
CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
ASSERT_EQ(2, addEvent2Result.calendarEntryID);
}
TEST_F(CalendarDataStorageTests, Add_Three_Events){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
ASSERT_EQ(1, addEvent1Result.calendarEntryID);
CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
ASSERT_EQ(2, addEvent2Result.calendarEntryID);
CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
ASSERT_EQ(CDSENTRY_OK, addEvent3Result.addEventResult);
ASSERT_EQ(3, addEvent3Result.calendarEntryID);
}
TEST_F(CalendarDataStorageTests, Add_One_Event_And_Get_Event_Basic_Information){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent1.ics");
// Get the entry information.
CDSGetCalendarEntryInfo entryInfo = addEventTest.GetEvent(addEventResult.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entryInfo.getEventResult);
ASSERT_EQ("First test event", entryInfo.entryName);
ASSERT_EQ("First entry description", entryInfo.entryDescription);
ASSERT_EQ(2016, entryInfo.entryStartYear);
ASSERT_EQ(12, entryInfo.entryStartMonth);
ASSERT_EQ(1, entryInfo.entryStartDay);
ASSERT_EQ(12, entryInfo.entryStartHour);
ASSERT_EQ(30, entryInfo.entryStartMinute);
ASSERT_EQ(0, entryInfo.entryStartSecond);
ASSERT_EQ(2016, entryInfo.entryEndYear);
ASSERT_EQ(12, entryInfo.entryEndMonth);
ASSERT_EQ(1, entryInfo.entryEndDay);
ASSERT_EQ(15, entryInfo.entryEndHour);
ASSERT_EQ(30, entryInfo.entryEndMinute);
ASSERT_EQ(0, entryInfo.entryEndSecond);
}
TEST_F(CalendarDataStorageTests, Add_One_Event_And_Get_Event_Basic_Information_With_Duration){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent2.ics");
EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
// Get the entry information.
CDSGetCalendarEntryInfo entryInfo = addEventTest.GetEvent(addEventResult.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entryInfo.getEventResult);
ASSERT_EQ("Second test event", entryInfo.entryName);
ASSERT_EQ("Second entry description", entryInfo.entryDescription);
ASSERT_EQ(2016, entryInfo.entryStartYear);
ASSERT_EQ(12, entryInfo.entryStartMonth);
ASSERT_EQ(1, entryInfo.entryStartDay);
ASSERT_EQ(12, entryInfo.entryStartHour);
ASSERT_EQ(30, entryInfo.entryStartMinute);
ASSERT_EQ(0, entryInfo.entryStartSecond);
ASSERT_EQ(0, entryInfo.entryEndYear);
ASSERT_EQ(0, entryInfo.entryEndMonth);
ASSERT_EQ(0, entryInfo.entryEndDay);
ASSERT_EQ(0, entryInfo.entryEndHour);
ASSERT_EQ(0, entryInfo.entryEndMinute);
ASSERT_EQ(0, entryInfo.entryEndSecond);
ASSERT_EQ(0, entryInfo.entryDurationWeeks);
ASSERT_EQ(1, entryInfo.entryDurationDays);
ASSERT_EQ(5, entryInfo.entryDurationHours);
ASSERT_EQ(30, entryInfo.entryDurationMinutes);
ASSERT_EQ(15, entryInfo.entryDurationSeconds);
}
TEST_F(CalendarDataStorageTests, Add_Two_Events_And_Get_Event_Basic_Information){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent2.ics");
// Get the entry information.
CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ("First test event", entry1Info.entryName);
ASSERT_EQ("First entry description", entry1Info.entryDescription);
ASSERT_EQ(2016, entry1Info.entryStartYear);
ASSERT_EQ(12, entry1Info.entryStartMonth);
ASSERT_EQ(1, entry1Info.entryStartDay);
ASSERT_EQ(12, entry1Info.entryStartHour);
ASSERT_EQ(30, entry1Info.entryStartMinute);
ASSERT_EQ(0, entry1Info.entryStartSecond);
ASSERT_EQ(2016, entry1Info.entryEndYear);
ASSERT_EQ(12, entry1Info.entryEndMonth);
ASSERT_EQ(1, entry1Info.entryEndDay);
ASSERT_EQ(15, entry1Info.entryEndHour);
ASSERT_EQ(30, entry1Info.entryEndMinute);
ASSERT_EQ(0, entry1Info.entryEndSecond);
CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ("Second test event", entry2Info.entryName);
ASSERT_EQ("Second entry description", entry2Info.entryDescription);
ASSERT_EQ(2016, entry2Info.entryStartYear);
ASSERT_EQ(12, entry2Info.entryStartMonth);
ASSERT_EQ(1, entry2Info.entryStartDay);
ASSERT_EQ(12, entry2Info.entryStartHour);
ASSERT_EQ(30, entry2Info.entryStartMinute);
ASSERT_EQ(0, entry2Info.entryStartSecond);
ASSERT_EQ(0, entry2Info.entryEndYear);
ASSERT_EQ(0, entry2Info.entryEndMonth);
ASSERT_EQ(0, entry2Info.entryEndDay);
ASSERT_EQ(0, entry2Info.entryEndHour);
ASSERT_EQ(0, entry2Info.entryEndMinute);
ASSERT_EQ(0, entry2Info.entryEndSecond);
ASSERT_EQ(0, entry2Info.entryDurationWeeks);
ASSERT_EQ(1, entry2Info.entryDurationDays);
ASSERT_EQ(5, entry2Info.entryDurationHours);
ASSERT_EQ(30, entry2Info.entryDurationMinutes);
ASSERT_EQ(15, entry2Info.entryDurationSeconds);
}
TEST_F(CalendarDataStorageTests, Add_The_Same_Three_Events_And_Get_Event_Information){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
// Get the entry information.
CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ("First test event", entry1Info.entryName);
ASSERT_EQ("First entry description", entry1Info.entryDescription);
ASSERT_EQ(2016, entry1Info.entryStartYear);
ASSERT_EQ(12, entry1Info.entryStartMonth);
ASSERT_EQ(1, entry1Info.entryStartDay);
ASSERT_EQ(12, entry1Info.entryStartHour);
ASSERT_EQ(30, entry1Info.entryStartMinute);
ASSERT_EQ(0, entry1Info.entryStartSecond);
ASSERT_EQ(2016, entry1Info.entryEndYear);
ASSERT_EQ(12, entry1Info.entryEndMonth);
ASSERT_EQ(1, entry1Info.entryEndDay);
ASSERT_EQ(15, entry1Info.entryEndHour);
ASSERT_EQ(30, entry1Info.entryEndMinute);
ASSERT_EQ(0, entry1Info.entryEndSecond);
CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ("First test event", entry2Info.entryName);
ASSERT_EQ("First entry description", entry2Info.entryDescription);
ASSERT_EQ(2016, entry2Info.entryStartYear);
ASSERT_EQ(12, entry2Info.entryStartMonth);
ASSERT_EQ(1, entry2Info.entryStartDay);
ASSERT_EQ(12, entry2Info.entryStartHour);
ASSERT_EQ(30, entry2Info.entryStartMinute);
ASSERT_EQ(0, entry2Info.entryStartSecond);
ASSERT_EQ(2016, entry2Info.entryEndYear);
ASSERT_EQ(12, entry2Info.entryEndMonth);
ASSERT_EQ(1, entry2Info.entryEndDay);
ASSERT_EQ(15, entry2Info.entryEndHour);
ASSERT_EQ(30, entry2Info.entryEndMinute);
ASSERT_EQ(0, entry2Info.entryEndSecond);
CDSGetCalendarEntryInfo entry3Info = addEventTest.GetEvent(addEvent3Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
ASSERT_EQ("First test event", entry3Info.entryName);
ASSERT_EQ("First entry description", entry3Info.entryDescription);
ASSERT_EQ(2016, entry3Info.entryStartYear);
ASSERT_EQ(12, entry3Info.entryStartMonth);
ASSERT_EQ(1, entry3Info.entryStartDay);
ASSERT_EQ(12, entry3Info.entryStartHour);
ASSERT_EQ(30, entry3Info.entryStartMinute);
ASSERT_EQ(0, entry3Info.entryStartSecond);
ASSERT_EQ(2016, entry3Info.entryEndYear);
ASSERT_EQ(12, entry3Info.entryEndMonth);
ASSERT_EQ(1, entry3Info.entryEndDay);
ASSERT_EQ(15, entry3Info.entryEndHour);
ASSERT_EQ(30, entry3Info.entryEndMinute);
ASSERT_EQ(0, entry3Info.entryEndSecond);
}
TEST_F(CalendarDataStorageTests, Add_Three_Events_And_Get_Event_Information){
CalendarDataStorage addEventTest;
addEventTest.AddAccount("Test Account 1", 1);
addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent3.ics");
// Get the entry information.
CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
ASSERT_EQ("First test event", entry1Info.entryName);
ASSERT_EQ("First entry description", entry1Info.entryDescription);
ASSERT_EQ(2016, entry1Info.entryStartYear);
ASSERT_EQ(12, entry1Info.entryStartMonth);
ASSERT_EQ(1, entry1Info.entryStartDay);
ASSERT_EQ(12, entry1Info.entryStartHour);
ASSERT_EQ(30, entry1Info.entryStartMinute);
ASSERT_EQ(0, entry1Info.entryStartSecond);
ASSERT_EQ(2016, entry1Info.entryEndYear);
ASSERT_EQ(12, entry1Info.entryEndMonth);
ASSERT_EQ(1, entry1Info.entryEndDay);
ASSERT_EQ(15, entry1Info.entryEndHour);
ASSERT_EQ(30, entry1Info.entryEndMinute);
ASSERT_EQ(0, entry1Info.entryEndSecond);
CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
ASSERT_EQ("Second test event", entry2Info.entryName);
ASSERT_EQ("Second entry description", entry2Info.entryDescription);
ASSERT_EQ(2016, entry2Info.entryStartYear);
ASSERT_EQ(12, entry2Info.entryStartMonth);
ASSERT_EQ(1, entry2Info.entryStartDay);
ASSERT_EQ(12, entry2Info.entryStartHour);
ASSERT_EQ(30, entry2Info.entryStartMinute);
ASSERT_EQ(0, entry2Info.entryStartSecond);
ASSERT_EQ(0, entry2Info.entryEndYear);
ASSERT_EQ(0, entry2Info.entryEndMonth);
ASSERT_EQ(0, entry2Info.entryEndDay);
ASSERT_EQ(0, entry2Info.entryEndHour);
ASSERT_EQ(0, entry2Info.entryEndMinute);
ASSERT_EQ(0, entry2Info.entryEndSecond);
ASSERT_EQ(0, entry2Info.entryDurationWeeks);
ASSERT_EQ(1, entry2Info.entryDurationDays);
ASSERT_EQ(5, entry2Info.entryDurationHours);
ASSERT_EQ(30, entry2Info.entryDurationMinutes);
ASSERT_EQ(15, entry2Info.entryDurationSeconds);
CDSGetCalendarEntryInfo entry3Info = addEventTest.GetEvent(addEvent3Result.calendarEntryID);
ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
ASSERT_EQ("Third test event", entry3Info.entryName);
ASSERT_EQ("Third entry description", entry3Info.entryDescription);
ASSERT_EQ(2015, entry3Info.entryStartYear);
ASSERT_EQ(7, entry3Info.entryStartMonth);
ASSERT_EQ(15, entry3Info.entryStartDay);
ASSERT_EQ(15, entry3Info.entryStartHour);
ASSERT_EQ(30, entry3Info.entryStartMinute);
ASSERT_EQ(0, entry3Info.entryStartSecond);
ASSERT_EQ(2015, entry3Info.entryEndYear);
ASSERT_EQ(7, entry3Info.entryEndMonth);
ASSERT_EQ(16, entry3Info.entryEndDay);
ASSERT_EQ(22, entry3Info.entryEndHour);
ASSERT_EQ(30, entry3Info.entryEndMinute);
ASSERT_EQ(0, entry3Info.entryEndSecond);
}
TEST_F(CalendarDataStorageTests, Delete_One_Event){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEventResult = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEventResult.calendarEntryID));
}
TEST_F(CalendarDataStorageTests, Delete_Two_Events){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
EXPECT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
EXPECT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent1Result.calendarEntryID));
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent2Result.calendarEntryID));
}
TEST_F(CalendarDataStorageTests, Delete_Three_Events){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
EXPECT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
EXPECT_EQ(CDSENTRY_OK, addEvent3Result.addEventResult);
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent1Result.calendarEntryID));
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent2Result.calendarEntryID));
ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent3Result.calendarEntryID));
}
TEST_F(CalendarDataStorageTests, Delete_One_Calendar_And_Events){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Delete_Two_Calendars_And_Events){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar2-test", defaultColour, "Calendar Description 1");
// Setup and delete the first calendar.
CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the second calendar.
addEvent1Result = deleteEventTest.AddEvent(2, "CalendarEvent1.ics");
addEvent2Result = deleteEventTest.AddEvent(2, "CalendarEvent2.ics");
addEvent3Result = deleteEventTest.AddEvent(2, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(2));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Delete_Three_Calendars_And_Events){
CalendarDataStorage deleteEventTest;
deleteEventTest.AddAccount("Test Account 1", 1);
deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteEventTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
deleteEventTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
// Setup and delete the first calendar.
CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the second calendar.
addEvent1Result = deleteEventTest.AddEvent(2, "CalendarEvent1.ics");
addEvent2Result = deleteEventTest.AddEvent(2, "CalendarEvent2.ics");
addEvent3Result = deleteEventTest.AddEvent(2, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(2));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the third calendar.
addEvent1Result = deleteEventTest.AddEvent(3, "CalendarEvent1.ics");
addEvent2Result = deleteEventTest.AddEvent(3, "CalendarEvent2.ics");
addEvent3Result = deleteEventTest.AddEvent(3, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(3));
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Delete_One_Account_And_Associated_Data){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
// Setup and delete the first account.
CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Delete_Two_Accounts_And_Associated_Data){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
deleteAccountTest.AddAccount("Test Account 2", 2);
deleteAccountTest.AddAccount("Test Account 3", 3);
// Setup and delete the first account.
deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the second account.
deleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
addEvent1Result = deleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
addEvent2Result = deleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
addEvent3Result = deleteAccountTest.AddEvent(4, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(2));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Delete_Three_Accounts_And_Associated_Data){
CalendarDataStorage deleteAccountTest;
deleteAccountTest.AddAccount("Test Account 1", 1);
deleteAccountTest.AddAccount("Test Account 2", 2);
deleteAccountTest.AddAccount("Test Account 3", 3);
// Setup and delete the first account.
deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the second account.
deleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
addEvent1Result = deleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
addEvent2Result = deleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
addEvent3Result = deleteAccountTest.AddEvent(4, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(2));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
// Setup and delete the third account.
deleteAccountTest.AddCalendar(3, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(3, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
deleteAccountTest.AddCalendar(3, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
addEvent1Result = deleteAccountTest.AddEvent(7, "CalendarEvent1.ics");
addEvent2Result = deleteAccountTest.AddEvent(7, "CalendarEvent2.ics");
addEvent3Result = deleteAccountTest.AddEvent(7, "CalendarEvent3.ics");
EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(3));
EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 3", "calendar1-test").accountInfoResult);
EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 3", "calendar1-test").calendarInfoResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_One_Account){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
// Setup and delete the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
CDSEntryList entryList = getEventsListTest.GetEventList(1);
EXPECT_EQ(1, entryList.entryList.at(0));
EXPECT_EQ(2, entryList.entryList.at(1));
EXPECT_EQ(3, entryList.entryList.at(2));
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_Two_Accounts){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
// Setup and delete the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
// Setup the first account.
CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
CDSEntryList entryList = getEventsListTest.GetEventList(1);
EXPECT_EQ(1, entryList.entryList.at(0));
EXPECT_EQ(2, entryList.entryList.at(1));
EXPECT_EQ(3, entryList.entryList.at(2));
// Setup the second account.
addEvent1Result = getEventsListTest.AddEvent(2, "CalendarEvent1.ics");
addEvent2Result = getEventsListTest.AddEvent(2, "CalendarEvent2.ics");
addEvent3Result = getEventsListTest.AddEvent(2, "CalendarEvent3.ics");
entryList = getEventsListTest.GetEventList(2);
EXPECT_EQ(4, entryList.entryList.at(0));
EXPECT_EQ(5, entryList.entryList.at(1));
EXPECT_EQ(6, entryList.entryList.at(2));
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_Three_Accounts){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
// Setup and delete the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
// Setup the first account.
CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
CDSEntryList entryList = getEventsListTest.GetEventList(1);
EXPECT_EQ(1, entryList.entryList.at(0));
EXPECT_EQ(2, entryList.entryList.at(1));
EXPECT_EQ(3, entryList.entryList.at(2));
// Setup the second account.
addEvent1Result = getEventsListTest.AddEvent(2, "CalendarEvent1.ics");
addEvent2Result = getEventsListTest.AddEvent(2, "CalendarEvent2.ics");
addEvent3Result = getEventsListTest.AddEvent(2, "CalendarEvent3.ics");
entryList = getEventsListTest.GetEventList(2);
EXPECT_EQ(4, entryList.entryList.at(0));
EXPECT_EQ(5, entryList.entryList.at(1));
EXPECT_EQ(6, entryList.entryList.at(2));
// Setup the third account.
addEvent1Result = getEventsListTest.AddEvent(3, "CalendarEvent1.ics");
addEvent2Result = getEventsListTest.AddEvent(3, "CalendarEvent2.ics");
addEvent3Result = getEventsListTest.AddEvent(3, "CalendarEvent3.ics");
entryList = getEventsListTest.GetEventList(3);
EXPECT_EQ(7, entryList.entryList.at(0));
EXPECT_EQ(8, entryList.entryList.at(1));
EXPECT_EQ(9, entryList.entryList.at(2));
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_One_Account){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
// Setup the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
// Get the list of calendar IDs.
CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
EXPECT_EQ(1, calendarList.calendarList.at(0));
EXPECT_EQ(2, calendarList.calendarList.at(1));
EXPECT_EQ(3, calendarList.calendarList.at(2));
EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_Two_Accounts){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
getEventsListTest.AddAccount("Test Account 2", 2);
// Setup the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
// Get the list of calendar IDs.
CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
EXPECT_EQ(1, calendarList.calendarList.at(0));
EXPECT_EQ(2, calendarList.calendarList.at(1));
EXPECT_EQ(3, calendarList.calendarList.at(2));
EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
// Setup the second account.
getEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", defaultColour, "Calendar Description 1");
calendarList = getEventsListTest.GetCalendarList(2);
EXPECT_EQ(4, calendarList.calendarList.at(0));
EXPECT_EQ(5, calendarList.calendarList.at(1));
EXPECT_EQ(6, calendarList.calendarList.at(2));
EXPECT_EQ("calendar4-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar5-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar6-test", calendarList.calendarListTextID.at(2));
}
TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_Three_Accounts){
CalendarDataStorage getEventsListTest;
getEventsListTest.AddAccount("Test Account 1", 1);
getEventsListTest.AddAccount("Test Account 2", 2);
getEventsListTest.AddAccount("Test Account 3", 3);
// Setup the first account.
getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
// Get the list of calendar IDs.
CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
EXPECT_EQ(1, calendarList.calendarList.at(0));
EXPECT_EQ(2, calendarList.calendarList.at(1));
EXPECT_EQ(3, calendarList.calendarList.at(2));
EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
// Setup the second account.
getEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", defaultColour, "Calendar Description 1");
calendarList = getEventsListTest.GetCalendarList(2);
EXPECT_EQ(4, calendarList.calendarList.at(0));
EXPECT_EQ(5, calendarList.calendarList.at(1));
EXPECT_EQ(6, calendarList.calendarList.at(2));
EXPECT_EQ("calendar4-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar5-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar6-test", calendarList.calendarListTextID.at(2));
// Setup the third account.
getEventsListTest.AddCalendar(3, "Calendar 7", "calendar7-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(3, "Calendar 8", "calendar8-test", defaultColour, "Calendar Description 1");
getEventsListTest.AddCalendar(3, "Calendar 9", "calendar9-test", defaultColour, "Calendar Description 1");
calendarList = getEventsListTest.GetCalendarList(3);
EXPECT_EQ(7, calendarList.calendarList.at(0));
EXPECT_EQ(8, calendarList.calendarList.at(1));
EXPECT_EQ(9, calendarList.calendarList.at(2));
EXPECT_EQ("calendar7-test", calendarList.calendarListTextID.at(0));
EXPECT_EQ("calendar8-test", calendarList.calendarListTextID.at(1));
EXPECT_EQ("calendar9-test", calendarList.calendarListTextID.at(2));
}
TEST_F(CalendarDataStorageTests, Add_One_Checksum){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
// Get the checksum.
//EXPECT_EQ("checksumYay", checksumTest.GetChecksum("firstChecksum"));
}
TEST_F(CalendarDataStorageTests, Add_Two_Checksus){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
}
TEST_F(CalendarDataStorageTests, Add_Three_Checksus){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
}
TEST_F(CalendarDataStorageTests, Add_One_Checksum_And_Get_One_Checksum){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
// Get the checksum.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
}
TEST_F(CalendarDataStorageTests, Add_Two_Checksums_And_Get_Two_Checksums){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
// Get the checksums.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
}
TEST_F(CalendarDataStorageTests, Add_Three_Checksums_And_Get_Three_Checksums){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
// Get the checksums.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumThree", getChecksumResult.checksumValue);
}
TEST_F(CalendarDataStorageTests, Add_One_Checksum_Update_One_Checksum_And_Get_One_Checksum){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
// Get the checksum.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
// Update the checksum.
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
// Get the checksum again.
getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
}
TEST_F(CalendarDataStorageTests, Add_Two_Checksums_Update_Two_Checksums_And_Get_Two_Checksums){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
// Get the checksum.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
// Update the checksum.
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("secondChecksum", "updatedChecksum2"));
// Get the checksum again.
getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum2", getChecksumResult.checksumValue);
}
TEST_F(CalendarDataStorageTests, Add_Three_Checksums_Update_Three_Checksums_And_Get_Three_Checksums){
CalendarDataStorage checksumTest;
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
// Get the checksum.
CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("checksumThree", getChecksumResult.checksumValue);
// Update the checksum.
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("secondChecksum", "updatedChecksum2"));
EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("thirdChecksum", "updatedChecksum3"));
// Get the checksum again.
getChecksumResult = checksumTest.GetChecksum("firstChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("secondChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum2", getChecksumResult.checksumValue);
getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
EXPECT_EQ("updatedChecksum3", getChecksumResult.checksumValue);
}