From: Steve Brokenshire Date: Sun, 11 Dec 2016 22:58:52 +0000 (+0000) Subject: Added unit tests for CalendarDataStorage X-Git-Tag: release-0.02~75 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=51c291353798e0081c475d7e6f9c13c84c147a16;p=xestiacalendar%2F.git Added unit tests for CalendarDataStorage --- diff --git a/source/tests/xestiacalendar_calendardatastorage.h b/source/tests/xestiacalendar_calendardatastorage.h new file mode 100644 index 0000000..129533e --- /dev/null +++ b/source/tests/xestiacalendar_calendardatastorage.h @@ -0,0 +1,1784 @@ +// xestiacalendar_calendardatastorage.h - Xestia Calendar Calendar Data Storage Unit Tests +// +// (c) 2016 Xestia Software Development. +// +// This file is part of Xestia Calendar. +// +// Xestia Address Book 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 Address Book 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 "../libraries/CalendarDataStorage/CalendarDataStorage.h" + +TEST(CalendarDataStorage, Setup_Tables){ + + CalendarDataStorage SetupTablesTest; + + ASSERT_EQ(true, SetupTablesTest.DidInitOK()); + +} + +TEST(CalendarDataStorage, Add_One_Account){ + + CalendarDataStorage AddOneEntryTest; + + ASSERT_EQ(CDSACCOUNT_OK, AddOneEntryTest.AddAccount("Test Account 1")); + +} + +TEST(CalendarDataStorage, Add_Two_Accounts){ + + CalendarDataStorage AddTwoEntryTest; + + ASSERT_EQ(CDSACCOUNT_OK, AddTwoEntryTest.AddAccount("Test Account 1")); + ASSERT_EQ(CDSACCOUNT_OK, AddTwoEntryTest.AddAccount("Test Account 2")); + +} + +TEST(CalendarDataStorage, Add_Three_Accounts){ + + CalendarDataStorage AddThreeEntryTest; + + ASSERT_EQ(CDSACCOUNT_OK, AddThreeEntryTest.AddAccount("Test Account 1")); + ASSERT_EQ(CDSACCOUNT_OK, AddThreeEntryTest.AddAccount("Test Account 2")); + ASSERT_EQ(CDSACCOUNT_OK, AddThreeEntryTest.AddAccount("Test Account 3")); + +} + +TEST(CalendarDataStorage, Get_Account_Information){ + + CalendarDataStorage AccountInformationTest; + + AccountInformationTest.AddAccount("Test Account 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(CalendarDataStorage, Get_Two_Accounts_Information){ + + CalendarDataStorage AccountInformationTest; + + AccountInformationTest.AddAccount("Test Account 1"); + AccountInformationTest.AddAccount("Test Account 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(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); + +} + +TEST(CalendarDataStorage, Get_Three_Accounts_Information){ + + CalendarDataStorage AccountInformationTest; + + AccountInformationTest.AddAccount("Test Account 1"); + AccountInformationTest.AddAccount("Test Account 2"); + AccountInformationTest.AddAccount("Test Account 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(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(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); + +} + +TEST(CalendarDataStorage, Update_One_Account){ + + CalendarDataStorage UpdateAccountTest; + + UpdateAccountTest.AddAccount("Test Account 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(CalendarDataStorage, Update_Two_Accounts){ + + CalendarDataStorage UpdateAccountTest; + + UpdateAccountTest.AddAccount("Test Account 1"); + UpdateAccountTest.AddAccount("Test Account 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(CalendarDataStorage, Update_Three_Accounts){ + + CalendarDataStorage UpdateAccountTest; + + UpdateAccountTest.AddAccount("Test Account 1"); + UpdateAccountTest.AddAccount("Test Account 2"); + UpdateAccountTest.AddAccount("Test Account 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(CalendarDataStorage, Delete_One_Account){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSACCOUNT_OK, DeleteAccountTest.DeleteAccount(DeleteAccountTest.GetAccount("Test Account 1").accountID)); + +} + +TEST(CalendarDataStorage, Delete_Two_Accounts){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + DeleteAccountTest.AddAccount("Test Account 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(CalendarDataStorage, Delete_Three_Accounts){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + DeleteAccountTest.AddAccount("Test Account 2"); + DeleteAccountTest.AddAccount("Test Account 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(CalendarDataStorage, Add_One_Calendar_To_One_Account){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + +} + +TEST(CalendarDataStorage, Add_Two_Calendars_To_One_Account){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + +} + +TEST(CalendarDataStorage, Add_Three_Calendars_To_One_Account){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + +} + +TEST(CalendarDataStorage, Add_One_Calendar_To_Two_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + +} + +TEST(CalendarDataStorage, Add_Two_Calendars_To_Two_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + +} + +TEST(CalendarDataStorage, Add_Three_Calendars_To_Two_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test")); + +} + +TEST(CalendarDataStorage, Add_One_Calendar_To_Three_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + AddCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test")); + +} + +TEST(CalendarDataStorage, Add_Two_Calendars_To_Three_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + AddCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test")); + +} + +TEST(CalendarDataStorage, Add_Three_Calendars_To_Three_Accounts){ + + CalendarDataStorage AddCalendarTest; + + AddCalendarTest.AddAccount("Test Account 1"); + AddCalendarTest.AddAccount("Test Account 2"); + AddCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, AddCalendarTest.AddCalendar(AddCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test")); + +} + +TEST(CalendarDataStorage, Get_Calendar_Information_From_One_Account){ + + CalendarDataStorage GetCalendarTest; + + GetCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + 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", calendar1Info.accountName); + ASSERT_EQ("Test Account 1", calendar1Info.accountName); + +} + +TEST(CalendarDataStorage, Get_Calendar_Information_From_Two_Accounts){ + + CalendarDataStorage GetCalendarTest; + + GetCalendarTest.AddAccount("Test Account 1"); + GetCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test")); + + 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); + +} + +TEST(CalendarDataStorage, Get_Calendar_Information_From_Three_Accounts){ + + CalendarDataStorage GetCalendarTest; + + GetCalendarTest.AddAccount("Test Account 1"); + GetCalendarTest.AddAccount("Test Account 2"); + GetCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test")); + + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, GetCalendarTest.AddCalendar(GetCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test")); + + 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); + +} + +TEST(CalendarDataStorage, Update_One_Calendar_With_One_Account){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + + CDSGetCalendarInfo calendar1Info = UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated")); + ASSERT_EQ("Calendar 1 Updated", UpdateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName); + +} + +TEST(CalendarDataStorage, Update_One_Calendar_With_Two_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 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); + +} + +TEST(CalendarDataStorage, Update_One_Calendar_With_Three_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + UpdateCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 1 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); + +} + +TEST(CalendarDataStorage, Update_Two_Calendars_With_One_Account){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 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); + +} + +TEST(CalendarDataStorage, Update_Two_Calendars_With_Two_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 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); + +} + +TEST(CalendarDataStorage, Update_Two_Calendars_With_Three_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + UpdateCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 5", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 6", "calendar2-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 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); + +} + + +TEST(CalendarDataStorage, Update_Three_Calendars_With_One_Account){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 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); + +} + +TEST(CalendarDataStorage, Update_Three_Calendars_With_Two_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 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); + +} + +TEST(CalendarDataStorage, Update_Three_Calendars_With_Three_Accounts){ + + CalendarDataStorage UpdateCalendarTest; + + UpdateCalendarTest.AddAccount("Test Account 1"); + UpdateCalendarTest.AddAccount("Test Account 2"); + UpdateCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 7", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 8", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.AddCalendar(UpdateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 9", "calendar3-test")); + + 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")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar7Info.calendarID, "Calendar 7 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar8Info.calendarID, "Calendar 8 Updated")); + ASSERT_EQ(CDSCALENDAR_OK, UpdateCalendarTest.UpdateCalendar(calendar9Info.calendarID, "Calendar 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); + +} + +TEST(CalendarDataStorage, Delete_One_Calendar){ + + CalendarDataStorage DeleteCalendarTest; + int calendarID = 0; + + DeleteCalendarTest.AddAccount("Test Account 1"); + + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + + calendarID = DeleteCalendarTest.GetCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID; + + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.DeleteCalendar(calendarID)); + +} + +TEST(CalendarDataStorage, Delete_Two_Calendars){ + + CalendarDataStorage DeleteCalendarTest; + int calendarID1 = 0; + int calendarID2 = 0; + + DeleteCalendarTest.AddAccount("Test Account 1"); + DeleteCalendarTest.AddAccount("Test Account 2"); + + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + + 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(CalendarDataStorage, Delete_Three_Calendars){ + + CalendarDataStorage DeleteCalendarTest; + int calendarID1 = 0; + int calendarID2 = 0; + int calendarID3 = 0; + + DeleteCalendarTest.AddAccount("Test Account 1"); + DeleteCalendarTest.AddAccount("Test Account 2"); + DeleteCalendarTest.AddAccount("Test Account 3"); + + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test")); + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test")); + ASSERT_EQ(CDSCALENDAR_OK, DeleteCalendarTest.AddCalendar(DeleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test")); + + 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(CalendarDataStorage, Add_One_Event){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + + CDSAddEntryResult addEventResult = AddEventTest.AddEvent(1, "CalendarEvent1.ics"); + + ASSERT_EQ(CDSENTRY_OK, addEventResult.addEventResult); + ASSERT_EQ(1, addEventResult.calendarEntryID); + +} + +TEST(CalendarDataStorage, Add_Two_Events){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + + 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(CalendarDataStorage, Add_Three_Events){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + + 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(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information_With_Duration){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Add_Two_Events_And_Get_Event_Basic_Information){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Add_The_Same_Three_Events_And_Get_Event_Information){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Add_Three_Events_And_Get_Event_Information){ + + CalendarDataStorage AddEventTest; + + AddEventTest.AddAccount("Test Account 1"); + AddEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Delete_One_Event){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + CDSAddEntryResult addEventResult = DeleteEventTest.AddEvent(1, "CalendarEvent1.ics"); + + EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult); + + ASSERT_EQ(CDSENTRY_OK, DeleteEventTest.DeleteEvent(addEventResult.calendarEntryID)); + +} + +TEST(CalendarDataStorage, Delete_Two_Events){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Delete_Three_Events){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Delete_One_Calendar_And_Events){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + 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(CalendarDataStorage, Delete_Two_Calendars_And_Events){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar2-test"); + + // 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(CalendarDataStorage, Delete_Three_Calendars_And_Events){ + + CalendarDataStorage DeleteEventTest; + + DeleteEventTest.AddAccount("Test Account 1"); + DeleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + DeleteEventTest.AddCalendar(1, "Calendar 2", "calendar2-test"); + DeleteEventTest.AddCalendar(1, "Calendar 3", "calendar3-test"); + + // 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(CalendarDataStorage, Delete_One_Account_And_Associated_Data){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + + // 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").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(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + DeleteAccountTest.AddAccount("Test Account 2"); + DeleteAccountTest.AddAccount("Test Account 3"); + + // Setup and delete the first account. + + DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test"); + DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test"); + + 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").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"); + DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test"); + DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test"); + + 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").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(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){ + + CalendarDataStorage DeleteAccountTest; + + DeleteAccountTest.AddAccount("Test Account 1"); + DeleteAccountTest.AddAccount("Test Account 2"); + DeleteAccountTest.AddAccount("Test Account 3"); + + // Setup and delete the first account. + + DeleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + DeleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test"); + DeleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test"); + + 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").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"); + DeleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test"); + DeleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test"); + + 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").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"); + DeleteAccountTest.AddCalendar(3, "Calendar 2", "calendar1-test"); + DeleteAccountTest.AddCalendar(3, "Calendar 3", "calendar1-test"); + + 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").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(CalendarDataStorage, Get_List_Of_Events_For_One_Account){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + + // Setup and delete the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test"); + + 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(CalendarDataStorage, Get_List_Of_Events_For_Two_Accounts){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + + // Setup and delete the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test"); + + // 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(CalendarDataStorage, Get_List_Of_Events_For_Three_Accounts){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + + // Setup and delete the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test"); + + // 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(CalendarDataStorage, Get_List_Of_Calendars_For_One_Account){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + + // Setup the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test"); + + // 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(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + GetEventsListTest.AddAccount("Test Account 2"); + + // Setup the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test"); + + // 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"); + GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test"); + GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test"); + + 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(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){ + + CalendarDataStorage GetEventsListTest; + + GetEventsListTest.AddAccount("Test Account 1"); + GetEventsListTest.AddAccount("Test Account 2"); + GetEventsListTest.AddAccount("Test Account 3"); + + // Setup the first account. + + GetEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test"); + GetEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test"); + GetEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test"); + + // 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"); + GetEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test"); + GetEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test"); + + 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"); + GetEventsListTest.AddCalendar(3, "Calendar 8", "calendar8-test"); + GetEventsListTest.AddCalendar(3, "Calendar 9", "calendar9-test"); + + 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)); + +} \ No newline at end of file