1 // xestiacalendar_calendardatastorage.h - Xestia Calendar Calendar Data Storage Unit Tests
3 // (c) 2016-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
23 TEST(CalendarDataStorage, Setup_Tables){
25 CalendarDataStorage setupTablesTest;
27 ASSERT_EQ(true, setupTablesTest.DidInitOK());
31 TEST(CalendarDataStorage, Add_One_Account){
33 CalendarDataStorage addOneEntryTest;
35 ASSERT_EQ(CDSACCOUNT_OK, addOneEntryTest.AddAccount("Test Account 1", 1));
39 TEST(CalendarDataStorage, Add_Two_Accounts){
41 CalendarDataStorage addTwoEntryTest;
43 ASSERT_EQ(CDSACCOUNT_OK, addTwoEntryTest.AddAccount("Test Account 1", 1));
44 ASSERT_EQ(CDSACCOUNT_OK, addTwoEntryTest.AddAccount("Test Account 2", 2));
48 TEST(CalendarDataStorage, Add_Three_Accounts){
50 CalendarDataStorage addThreeEntryTest;
52 ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 1", 1));
53 ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 2", 2));
54 ASSERT_EQ(CDSACCOUNT_OK, addThreeEntryTest.AddAccount("Test Account 3", 3));
58 TEST(CalendarDataStorage, Add_Account_With_No_Name_And_Return_No_Name_Message){
60 CalendarDataStorage failNameTest;
62 ASSERT_EQ(CDSACCOUNT_NONAME, failNameTest.AddAccount("", 1));
66 TEST(CalendarDataStorage, Add_Account_With_Same_Name_Twice_And_Return_Failed_Message){
68 CalendarDataStorage duplicateNameTest;
70 ASSERT_EQ(CDSACCOUNT_OK, duplicateNameTest.AddAccount("Account 1", 1));
71 ASSERT_EQ(CDSACCOUNT_FAILED, duplicateNameTest.AddAccount("Account 1", 1));
75 TEST(CalendarDataStorage, Get_Account_Information){
77 CalendarDataStorage accountInformationTest;
79 accountInformationTest.AddAccount("Test Account 1", 1);
80 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
81 ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
82 ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
86 TEST(CalendarDataStorage, Get_Account_Information_That_Does_Not_Exist_Return_No_Account_Message){
88 CalendarDataStorage noAccountTest;
90 ASSERT_EQ(CDSACCOUNT_NOACCOUNT, noAccountTest.GetAccount("Test Account 1").accountInfoResult);
94 TEST(CalendarDataStorage, Get_Two_Accounts_Information){
96 CalendarDataStorage accountInformationTest;
98 accountInformationTest.AddAccount("Test Account 1", 1);
99 accountInformationTest.AddAccount("Test Account 2", 2);
101 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
102 ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
103 ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
104 ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountPreferencesID);
106 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 2").accountInfoResult);
107 ASSERT_EQ("Test Account 2", accountInformationTest.GetAccount("Test Account 2").accountName);
108 ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountID);
109 ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountPreferencesID);
113 TEST(CalendarDataStorage, Get_Three_Accounts_Information){
115 CalendarDataStorage accountInformationTest;
117 accountInformationTest.AddAccount("Test Account 1", 1);
118 accountInformationTest.AddAccount("Test Account 2", 2);
119 accountInformationTest.AddAccount("Test Account 3", 3);
121 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 1").accountInfoResult);
122 ASSERT_EQ("Test Account 1", accountInformationTest.GetAccount("Test Account 1").accountName);
123 ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountID);
124 ASSERT_EQ(1, accountInformationTest.GetAccount("Test Account 1").accountPreferencesID);
126 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 2").accountInfoResult);
127 ASSERT_EQ("Test Account 2", accountInformationTest.GetAccount("Test Account 2").accountName);
128 ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountID);
129 ASSERT_EQ(2, accountInformationTest.GetAccount("Test Account 2").accountPreferencesID);
131 ASSERT_EQ(CDSACCOUNT_OK, accountInformationTest.GetAccount("Test Account 3").accountInfoResult);
132 ASSERT_EQ("Test Account 3", accountInformationTest.GetAccount("Test Account 3").accountName);
133 ASSERT_EQ(3, accountInformationTest.GetAccount("Test Account 3").accountID);
134 ASSERT_EQ(3, accountInformationTest.GetAccount("Test Account 3").accountPreferencesID);
138 TEST(CalendarDataStorage, Get_List_Of_One_Account){
140 CalendarDataStorage accountInformationTest;
142 accountInformationTest.AddAccount("Test Account 1", 1);
144 CDSAccountList accountListData = accountInformationTest.GetAccountList();
146 ASSERT_EQ(1, accountListData.accountList.size());
147 ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
149 ASSERT_EQ(1, accountListData.accountList[0].accountID);
150 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
151 ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
152 ASSERT_EQ(1, accountListData.accountList[0].accountPreferencesID);
156 TEST(CalendarDataStorage, Get_List_Of_Two_Accounts){
158 CalendarDataStorage accountInformationTest;
160 accountInformationTest.AddAccount("Test Account 1", 1);
161 accountInformationTest.AddAccount("Test Account 2", 2);
163 CDSAccountList accountListData = accountInformationTest.GetAccountList();
165 ASSERT_EQ(2, accountListData.accountList.size());
166 ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
168 ASSERT_EQ(1, accountListData.accountList[0].accountID);
169 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
170 ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
171 ASSERT_EQ(1, accountListData.accountList[0].accountPreferencesID);
173 ASSERT_EQ(2, accountListData.accountList[1].accountID);
174 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[1].accountInfoResult);
175 ASSERT_EQ("Test Account 2", accountListData.accountList[1].accountName);
176 ASSERT_EQ(2, accountListData.accountList[1].accountPreferencesID);
180 TEST(CalendarDataStorage, Get_List_Of_Three_Accounts){
182 CalendarDataStorage accountInformationTest;
184 accountInformationTest.AddAccount("Test Account 1", 1);
185 accountInformationTest.AddAccount("Test Account 2", 2);
186 accountInformationTest.AddAccount("Test Account 3", 3);
188 CDSAccountList accountListData = accountInformationTest.GetAccountList();
190 ASSERT_EQ(3, accountListData.accountList.size());
191 ASSERT_EQ(CDSACCOUNT_OK, accountListData.getAccountListResult);
193 ASSERT_EQ(1, accountListData.accountList[0].accountID);
194 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[0].accountInfoResult);
195 ASSERT_EQ("Test Account 1", accountListData.accountList[0].accountName);
196 ASSERT_EQ(1, accountListData.accountList[0].accountPreferencesID);
198 ASSERT_EQ(2, accountListData.accountList[1].accountID);
199 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[1].accountInfoResult);
200 ASSERT_EQ("Test Account 2", accountListData.accountList[1].accountName);
201 ASSERT_EQ(2, accountListData.accountList[1].accountPreferencesID);
203 ASSERT_EQ(3, accountListData.accountList[2].accountID);
204 ASSERT_EQ(CDSACCOUNT_OK, accountListData.accountList[2].accountInfoResult);
205 ASSERT_EQ("Test Account 3", accountListData.accountList[2].accountName);
206 ASSERT_EQ(3, accountListData.accountList[2].accountPreferencesID);
210 TEST(CalendarDataStorage, Update_One_Account){
212 CalendarDataStorage updateAccountTest;
214 updateAccountTest.AddAccount("Test Account 1", 1);
216 int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
218 EXPECT_EQ(1, testAccount1ID);
219 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
220 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
221 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
225 TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_No_Name_Return_No_Name_Message){
227 CalendarDataStorage updateAccountTest;
229 updateAccountTest.AddAccount("Test Account 1", 1);
231 int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
233 EXPECT_EQ(1, testAccount1ID);
234 ASSERT_EQ(CDSACCOUNT_NONAME, updateAccountTest.UpdateAccount(testAccount1ID, ""));
238 TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_Existing_Account_Return_Failed_Message){
240 CalendarDataStorage updateAccountTest;
242 updateAccountTest.AddAccount("Test Account 1", 1);
243 updateAccountTest.AddAccount("Test Account 2", 2);
245 int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
247 EXPECT_EQ(2, testAccount2ID);
248 ASSERT_EQ(CDSACCOUNT_FAILED, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 1"));
252 TEST(CalendarDataStorage, Update_One_Account_That_Does_Not_Exist_Return_No_Account_Message){
254 CalendarDataStorage updateAccountTest;
256 ASSERT_EQ(CDSACCOUNT_NOACCOUNT, updateAccountTest.UpdateAccount(1, "Missing Account"));
260 TEST(CalendarDataStorage, Update_Two_Accounts){
262 CalendarDataStorage updateAccountTest;
264 updateAccountTest.AddAccount("Test Account 1", 1);
265 updateAccountTest.AddAccount("Test Account 2", 2);
267 int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
268 int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
270 EXPECT_EQ(1, testAccount1ID);
271 EXPECT_EQ(2, testAccount2ID);
273 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
274 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 2 - Updated"));
276 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
277 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
279 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2").accountInfoResult);
280 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2 - Updated").accountInfoResult);
284 TEST(CalendarDataStorage, Update_Three_Accounts){
286 CalendarDataStorage updateAccountTest;
288 updateAccountTest.AddAccount("Test Account 1", 1);
289 updateAccountTest.AddAccount("Test Account 2", 2);
290 updateAccountTest.AddAccount("Test Account 3", 3);
292 int testAccount1ID = updateAccountTest.GetAccount("Test Account 1").accountID;
293 int testAccount2ID = updateAccountTest.GetAccount("Test Account 2").accountID;
294 int testAccount3ID = updateAccountTest.GetAccount("Test Account 3").accountID;
296 EXPECT_EQ(1, testAccount1ID);
297 EXPECT_EQ(2, testAccount2ID);
298 EXPECT_EQ(3, testAccount3ID);
300 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount1ID, "Test Account 1 - Updated"));
301 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount2ID, "Test Account 2 - Updated"));
302 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.UpdateAccount(testAccount3ID, "Test Account 3 - Updated"));
304 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1").accountInfoResult);
305 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 1 - Updated").accountInfoResult);
307 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2").accountInfoResult);
308 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 2 - Updated").accountInfoResult);
310 ASSERT_NE(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 3").accountInfoResult);
311 ASSERT_EQ(CDSACCOUNT_OK, updateAccountTest.GetAccount("Test Account 3 - Updated").accountInfoResult);
315 TEST(CalendarDataStorage, Delete_One_Account){
317 CalendarDataStorage deleteAccountTest;
319 deleteAccountTest.AddAccount("Test Account 1", 1);
321 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
325 TEST(CalendarDataStorage, Delete_Two_Accounts){
327 CalendarDataStorage deleteAccountTest;
329 deleteAccountTest.AddAccount("Test Account 1", 1);
330 deleteAccountTest.AddAccount("Test Account 2", 2);
332 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
333 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 2").accountID));
337 TEST(CalendarDataStorage, Delete_Three_Accounts){
339 CalendarDataStorage deleteAccountTest;
341 deleteAccountTest.AddAccount("Test Account 1", 1);
342 deleteAccountTest.AddAccount("Test Account 2", 2);
343 deleteAccountTest.AddAccount("Test Account 3", 3);
345 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 1").accountID));
346 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 2").accountID));
347 ASSERT_EQ(CDSACCOUNT_OK, deleteAccountTest.DeleteAccount(deleteAccountTest.GetAccount("Test Account 3").accountID));
351 TEST(CalendarDataStorage, Delete_Account_That_Does_Not_Exist_Return_No_Account_Message){
353 CalendarDataStorage deleteAccountTest;
355 ASSERT_EQ(CDSACCOUNT_NOACCOUNT, deleteAccountTest.DeleteAccount(1));
359 TEST(CalendarDataStorage, Add_One_Calendar_To_One_Account){
361 CalendarDataStorage addCalendarTest;
363 addCalendarTest.AddAccount("Test Account 1", 1);
365 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
369 TEST(CalendarDataStorage, Add_Two_Calendars_To_One_Account){
371 CalendarDataStorage addCalendarTest;
373 addCalendarTest.AddAccount("Test Account 1", 1);
375 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
376 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
380 TEST(CalendarDataStorage, Add_Three_Calendars_To_One_Account){
382 CalendarDataStorage addCalendarTest;
384 addCalendarTest.AddAccount("Test Account 1", 1);
386 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
387 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
388 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
392 TEST(CalendarDataStorage, Add_Calendar_To_Account_That_Does_Not_Exist_Return_No_Account_Message){
394 CalendarDataStorage addCalendarTest;
396 ASSERT_EQ(CDSCALENDAR_NOACCOUNT, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
400 TEST(CalendarDataStorage, Add_One_Calendar_To_Two_Accounts){
402 CalendarDataStorage addCalendarTest;
404 addCalendarTest.AddAccount("Test Account 1", 1);
405 addCalendarTest.AddAccount("Test Account 2", 2);
407 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
409 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
413 TEST(CalendarDataStorage, Add_Two_Calendars_To_Two_Accounts){
415 CalendarDataStorage addCalendarTest;
417 addCalendarTest.AddAccount("Test Account 1", 1);
418 addCalendarTest.AddAccount("Test Account 2", 2);
420 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
421 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
423 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
424 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
428 TEST(CalendarDataStorage, Add_Three_Calendars_To_Two_Accounts){
430 CalendarDataStorage addCalendarTest;
432 addCalendarTest.AddAccount("Test Account 1", 1);
433 addCalendarTest.AddAccount("Test Account 2", 2);
435 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
436 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
437 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
439 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
440 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
441 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
445 TEST(CalendarDataStorage, Add_One_Calendar_To_Three_Accounts){
447 CalendarDataStorage addCalendarTest;
449 addCalendarTest.AddAccount("Test Account 1", 1);
450 addCalendarTest.AddAccount("Test Account 2", 2);
451 addCalendarTest.AddAccount("Test Account 3", 3);
453 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
455 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
457 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
461 TEST(CalendarDataStorage, Add_Two_Calendars_To_Three_Accounts){
463 CalendarDataStorage addCalendarTest;
465 addCalendarTest.AddAccount("Test Account 1", 1);
466 addCalendarTest.AddAccount("Test Account 2", 2);
467 addCalendarTest.AddAccount("Test Account 3", 3);
469 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
470 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
472 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
473 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
475 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
476 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
480 TEST(CalendarDataStorage, Add_Three_Calendars_To_Three_Accounts){
482 CalendarDataStorage addCalendarTest;
484 addCalendarTest.AddAccount("Test Account 1", 1);
485 addCalendarTest.AddAccount("Test Account 2", 2);
486 addCalendarTest.AddAccount("Test Account 3", 3);
488 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
489 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
490 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
492 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
493 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
494 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
496 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description"));
497 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description"));
498 ASSERT_EQ(CDSCALENDAR_OK, addCalendarTest.AddCalendar(addCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description"));
502 TEST(CalendarDataStorage, Get_Calendar_Information_From_One_Account){
504 CalendarDataStorage getCalendarTest;
506 getCalendarTest.AddAccount("Test Account 1", 1);
508 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
509 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
510 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
512 CDSGetCalendarInfo calendar1Info;
513 CDSGetCalendarInfo calendar2Info;
514 CDSGetCalendarInfo calendar3Info;
516 calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
517 calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
518 calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
520 ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
521 ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
522 ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
524 ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
525 ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
526 ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
528 ASSERT_EQ(1, calendar1Info.accountID);
529 ASSERT_EQ(1, calendar2Info.accountID);
530 ASSERT_EQ(1, calendar3Info.accountID);
532 ASSERT_EQ(1, calendar1Info.calendarID);
533 ASSERT_EQ(2, calendar2Info.calendarID);
534 ASSERT_EQ(3, calendar3Info.calendarID);
536 ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
537 ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
538 ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
540 ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
541 ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
542 ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
544 ASSERT_EQ("Test Account 1", calendar1Info.accountName);
545 ASSERT_EQ("Test Account 1", calendar2Info.accountName);
546 ASSERT_EQ("Test Account 1", calendar3Info.accountName);
548 ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
549 ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
550 ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
554 TEST(CalendarDataStorage, Get_Calendar_Information_From_Two_Accounts){
556 CalendarDataStorage getCalendarTest;
558 getCalendarTest.AddAccount("Test Account 1", 1);
559 getCalendarTest.AddAccount("Test Account 2", 2);
561 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
562 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
563 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
565 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 4"));
566 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 5"));
567 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 6"));
569 CDSGetCalendarInfo calendar1Info;
570 CDSGetCalendarInfo calendar2Info;
571 CDSGetCalendarInfo calendar3Info;
573 CDSGetCalendarInfo calendar4Info;
574 CDSGetCalendarInfo calendar5Info;
575 CDSGetCalendarInfo calendar6Info;
577 calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
578 calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
579 calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
581 calendar4Info = getCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
582 calendar5Info = getCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
583 calendar6Info = getCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
585 ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
586 ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
587 ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
589 ASSERT_EQ(CDSCALENDAR_OK, calendar4Info.calendarInfoResult);
590 ASSERT_EQ(CDSCALENDAR_OK, calendar5Info.calendarInfoResult);
591 ASSERT_EQ(CDSCALENDAR_OK, calendar6Info.calendarInfoResult);
593 ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
594 ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
595 ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
597 ASSERT_EQ(CDSACCOUNT_OK, calendar4Info.accountInfoResult);
598 ASSERT_EQ(CDSACCOUNT_OK, calendar5Info.accountInfoResult);
599 ASSERT_EQ(CDSACCOUNT_OK, calendar6Info.accountInfoResult);
601 ASSERT_EQ(1, calendar1Info.accountID);
602 ASSERT_EQ(1, calendar2Info.accountID);
603 ASSERT_EQ(1, calendar3Info.accountID);
605 ASSERT_EQ(2, calendar4Info.accountID);
606 ASSERT_EQ(2, calendar5Info.accountID);
607 ASSERT_EQ(2, calendar6Info.accountID);
609 ASSERT_EQ(1, calendar1Info.calendarID);
610 ASSERT_EQ(2, calendar2Info.calendarID);
611 ASSERT_EQ(3, calendar3Info.calendarID);
613 ASSERT_EQ(4, calendar4Info.calendarID);
614 ASSERT_EQ(5, calendar5Info.calendarID);
615 ASSERT_EQ(6, calendar6Info.calendarID);
617 ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
618 ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
619 ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
621 ASSERT_EQ("Calendar 1", calendar4Info.calendarName);
622 ASSERT_EQ("Calendar 2", calendar5Info.calendarName);
623 ASSERT_EQ("Calendar 3", calendar6Info.calendarName);
625 ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
626 ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
627 ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
629 ASSERT_EQ("calendar1-test", calendar4Info.calendarTextID);
630 ASSERT_EQ("calendar2-test", calendar5Info.calendarTextID);
631 ASSERT_EQ("calendar3-test", calendar6Info.calendarTextID);
633 ASSERT_EQ("Test Account 1", calendar1Info.accountName);
634 ASSERT_EQ("Test Account 1", calendar2Info.accountName);
635 ASSERT_EQ("Test Account 1", calendar3Info.accountName);
637 ASSERT_EQ("Test Account 2", calendar4Info.accountName);
638 ASSERT_EQ("Test Account 2", calendar5Info.accountName);
639 ASSERT_EQ("Test Account 2", calendar6Info.accountName);
641 ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
642 ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
643 ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
644 ASSERT_EQ("Calendar Description 4", calendar4Info.calendarDescription);
645 ASSERT_EQ("Calendar Description 5", calendar5Info.calendarDescription);
646 ASSERT_EQ("Calendar Description 6", calendar6Info.calendarDescription);
650 TEST(CalendarDataStorage, Get_Calendar_Information_From_Three_Accounts){
652 CalendarDataStorage getCalendarTest;
654 getCalendarTest.AddAccount("Test Account 1", 1);
655 getCalendarTest.AddAccount("Test Account 2", 2);
656 getCalendarTest.AddAccount("Test Account 3", 3);
658 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
659 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
660 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
662 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 4"));
663 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 5"));
664 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 6"));
666 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 7"));
667 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 8"));
668 ASSERT_EQ(CDSCALENDAR_OK, getCalendarTest.AddCalendar(getCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 9"));
670 CDSGetCalendarInfo calendar1Info;
671 CDSGetCalendarInfo calendar2Info;
672 CDSGetCalendarInfo calendar3Info;
674 CDSGetCalendarInfo calendar4Info;
675 CDSGetCalendarInfo calendar5Info;
676 CDSGetCalendarInfo calendar6Info;
678 CDSGetCalendarInfo calendar7Info;
679 CDSGetCalendarInfo calendar8Info;
680 CDSGetCalendarInfo calendar9Info;
682 calendar1Info = getCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
683 calendar2Info = getCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
684 calendar3Info = getCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
686 calendar4Info = getCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
687 calendar5Info = getCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
688 calendar6Info = getCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
690 calendar7Info = getCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
691 calendar8Info = getCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
692 calendar9Info = getCalendarTest.GetCalendar("Test Account 3", "calendar3-test");
694 ASSERT_EQ(CDSCALENDAR_OK, calendar1Info.calendarInfoResult);
695 ASSERT_EQ(CDSCALENDAR_OK, calendar2Info.calendarInfoResult);
696 ASSERT_EQ(CDSCALENDAR_OK, calendar3Info.calendarInfoResult);
698 ASSERT_EQ(CDSCALENDAR_OK, calendar4Info.calendarInfoResult);
699 ASSERT_EQ(CDSCALENDAR_OK, calendar5Info.calendarInfoResult);
700 ASSERT_EQ(CDSCALENDAR_OK, calendar6Info.calendarInfoResult);
702 ASSERT_EQ(CDSCALENDAR_OK, calendar7Info.calendarInfoResult);
703 ASSERT_EQ(CDSCALENDAR_OK, calendar8Info.calendarInfoResult);
704 ASSERT_EQ(CDSCALENDAR_OK, calendar9Info.calendarInfoResult);
706 ASSERT_EQ(CDSACCOUNT_OK, calendar1Info.accountInfoResult);
707 ASSERT_EQ(CDSACCOUNT_OK, calendar2Info.accountInfoResult);
708 ASSERT_EQ(CDSACCOUNT_OK, calendar3Info.accountInfoResult);
710 ASSERT_EQ(CDSACCOUNT_OK, calendar4Info.accountInfoResult);
711 ASSERT_EQ(CDSACCOUNT_OK, calendar5Info.accountInfoResult);
712 ASSERT_EQ(CDSACCOUNT_OK, calendar6Info.accountInfoResult);
714 ASSERT_EQ(CDSACCOUNT_OK, calendar7Info.accountInfoResult);
715 ASSERT_EQ(CDSACCOUNT_OK, calendar8Info.accountInfoResult);
716 ASSERT_EQ(CDSACCOUNT_OK, calendar9Info.accountInfoResult);
718 ASSERT_EQ(1, calendar1Info.accountID);
719 ASSERT_EQ(1, calendar2Info.accountID);
720 ASSERT_EQ(1, calendar3Info.accountID);
722 ASSERT_EQ(2, calendar4Info.accountID);
723 ASSERT_EQ(2, calendar5Info.accountID);
724 ASSERT_EQ(2, calendar6Info.accountID);
726 ASSERT_EQ(3, calendar7Info.accountID);
727 ASSERT_EQ(3, calendar8Info.accountID);
728 ASSERT_EQ(3, calendar9Info.accountID);
730 ASSERT_EQ(1, calendar1Info.calendarID);
731 ASSERT_EQ(2, calendar2Info.calendarID);
732 ASSERT_EQ(3, calendar3Info.calendarID);
734 ASSERT_EQ(4, calendar4Info.calendarID);
735 ASSERT_EQ(5, calendar5Info.calendarID);
736 ASSERT_EQ(6, calendar6Info.calendarID);
738 ASSERT_EQ(7, calendar7Info.calendarID);
739 ASSERT_EQ(8, calendar8Info.calendarID);
740 ASSERT_EQ(9, calendar9Info.calendarID);
742 ASSERT_EQ("Calendar 1", calendar1Info.calendarName);
743 ASSERT_EQ("Calendar 2", calendar2Info.calendarName);
744 ASSERT_EQ("Calendar 3", calendar3Info.calendarName);
746 ASSERT_EQ("Calendar 1", calendar4Info.calendarName);
747 ASSERT_EQ("Calendar 2", calendar5Info.calendarName);
748 ASSERT_EQ("Calendar 3", calendar6Info.calendarName);
750 ASSERT_EQ("Calendar 1", calendar7Info.calendarName);
751 ASSERT_EQ("Calendar 2", calendar8Info.calendarName);
752 ASSERT_EQ("Calendar 3", calendar9Info.calendarName);
754 ASSERT_EQ("calendar1-test", calendar1Info.calendarTextID);
755 ASSERT_EQ("calendar2-test", calendar2Info.calendarTextID);
756 ASSERT_EQ("calendar3-test", calendar3Info.calendarTextID);
758 ASSERT_EQ("calendar1-test", calendar4Info.calendarTextID);
759 ASSERT_EQ("calendar2-test", calendar5Info.calendarTextID);
760 ASSERT_EQ("calendar3-test", calendar6Info.calendarTextID);
762 ASSERT_EQ("calendar1-test", calendar7Info.calendarTextID);
763 ASSERT_EQ("calendar2-test", calendar8Info.calendarTextID);
764 ASSERT_EQ("calendar3-test", calendar9Info.calendarTextID);
766 ASSERT_EQ("Test Account 1", calendar1Info.accountName);
767 ASSERT_EQ("Test Account 1", calendar2Info.accountName);
768 ASSERT_EQ("Test Account 1", calendar3Info.accountName);
770 ASSERT_EQ("Test Account 2", calendar4Info.accountName);
771 ASSERT_EQ("Test Account 2", calendar5Info.accountName);
772 ASSERT_EQ("Test Account 2", calendar6Info.accountName);
774 ASSERT_EQ("Test Account 3", calendar7Info.accountName);
775 ASSERT_EQ("Test Account 3", calendar8Info.accountName);
776 ASSERT_EQ("Test Account 3", calendar9Info.accountName);
778 ASSERT_EQ("Calendar Description 1", calendar1Info.calendarDescription);
779 ASSERT_EQ("Calendar Description 2", calendar2Info.calendarDescription);
780 ASSERT_EQ("Calendar Description 3", calendar3Info.calendarDescription);
782 ASSERT_EQ("Calendar Description 4", calendar4Info.calendarDescription);
783 ASSERT_EQ("Calendar Description 5", calendar5Info.calendarDescription);
784 ASSERT_EQ("Calendar Description 6", calendar6Info.calendarDescription);
786 ASSERT_EQ("Calendar Description 7", calendar7Info.calendarDescription);
787 ASSERT_EQ("Calendar Description 8", calendar8Info.calendarDescription);
788 ASSERT_EQ("Calendar Description 9", calendar9Info.calendarDescription);
792 TEST(CalendarDataStorage, Update_One_Calendar_With_One_Account){
794 CalendarDataStorage updateCalendarTest;
796 updateCalendarTest.AddAccount("Test Account 1", 1);
798 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
800 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
802 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
803 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
804 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
808 TEST(CalendarDataStorage, Update_One_Calendar_With_Two_Accounts){
810 CalendarDataStorage updateCalendarTest;
812 updateCalendarTest.AddAccount("Test Account 1", 1);
813 updateCalendarTest.AddAccount("Test Account 2", 2);
815 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
816 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 2"));
818 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
819 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
821 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
822 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 2 Updated"));
824 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
825 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
827 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
828 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
832 TEST(CalendarDataStorage, Update_One_Calendar_With_Three_Accounts){
834 CalendarDataStorage updateCalendarTest;
836 updateCalendarTest.AddAccount("Test Account 1", 1);
837 updateCalendarTest.AddAccount("Test Account 2", 2);
838 updateCalendarTest.AddAccount("Test Account 3", 3);
840 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
841 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 2"));
842 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 3"));
844 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
845 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
846 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
848 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
849 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 2 Updated"));
850 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 3 Updated"));
852 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
853 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
854 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
856 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
857 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
858 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
862 TEST(CalendarDataStorage, Update_Two_Calendars_With_One_Account){
864 CalendarDataStorage updateCalendarTest;
866 updateCalendarTest.AddAccount("Test Account 1", 1);
868 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
869 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
871 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
872 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
874 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
875 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
877 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
878 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
880 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
881 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
885 TEST(CalendarDataStorage, Update_Two_Calendars_With_Two_Accounts){
887 CalendarDataStorage updateCalendarTest;
889 updateCalendarTest.AddAccount("Test Account 1", 1);
890 updateCalendarTest.AddAccount("Test Account 2", 2);
892 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
893 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
894 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 3"));
895 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", defaultColour, "Calendar Description 4"));
897 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
898 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
899 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
900 CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
902 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
903 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
904 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
905 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
907 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
908 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
909 ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
910 ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
912 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
913 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
914 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
915 ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
919 TEST(CalendarDataStorage, Update_Two_Calendars_With_Three_Accounts){
921 CalendarDataStorage updateCalendarTest;
923 updateCalendarTest.AddAccount("Test Account 1", 1);
924 updateCalendarTest.AddAccount("Test Account 2", 2);
925 updateCalendarTest.AddAccount("Test Account 3", 3);
927 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
928 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
929 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 3"));
930 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar2-test", defaultColour, "Calendar Description 4"));
931 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 5", "calendar1-test", defaultColour, "Calendar Description 5"));
932 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 6", "calendar2-test", defaultColour, "Calendar Description 6"));
934 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
935 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
936 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
937 CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
938 CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
939 CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
941 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
942 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
943 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
944 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
945 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
946 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
948 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
949 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
950 ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
951 ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
952 ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
953 ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarName);
955 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
956 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
957 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
958 ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
959 ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
960 ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarDescription);
965 TEST(CalendarDataStorage, Update_Three_Calendars_With_One_Account){
967 CalendarDataStorage updateCalendarTest;
969 updateCalendarTest.AddAccount("Test Account 1", 1);
971 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
972 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
973 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
975 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
976 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
977 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
979 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
980 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
981 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
983 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
984 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
985 ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
987 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
988 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
989 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
993 TEST(CalendarDataStorage, Update_Three_Calendars_With_Two_Accounts){
995 CalendarDataStorage updateCalendarTest;
997 updateCalendarTest.AddAccount("Test Account 1", 1);
998 updateCalendarTest.AddAccount("Test Account 2", 2);
1000 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
1001 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
1002 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
1003 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", defaultColour, "Calendar Description 4"));
1004 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", defaultColour, "Calendar Description 5"));
1005 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", defaultColour, "Calendar Description 6"));
1007 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
1008 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
1009 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
1010 CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
1011 CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
1012 CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
1014 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
1015 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
1016 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
1017 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
1018 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
1019 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
1021 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
1022 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
1023 ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
1024 ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
1025 ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
1026 ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarName);
1028 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
1029 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
1030 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
1031 ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
1032 ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
1033 ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarDescription);
1037 TEST(CalendarDataStorage, Update_Three_Calendars_With_Three_Accounts){
1039 CalendarDataStorage updateCalendarTest;
1041 updateCalendarTest.AddAccount("Test Account 1", 1);
1042 updateCalendarTest.AddAccount("Test Account 2", 2);
1043 updateCalendarTest.AddAccount("Test Account 3", 3);
1045 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
1046 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 2"));
1047 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 3"));
1048 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 4", "calendar1-test", defaultColour, "Calendar Description 4"));
1049 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 5", "calendar2-test", defaultColour, "Calendar Description 5"));
1050 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 2").accountID, "Calendar 6", "calendar3-test", defaultColour, "Calendar Description 6"));
1051 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 7", "calendar1-test", defaultColour, "Calendar Description 7"));
1052 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 8", "calendar2-test", defaultColour, "Calendar Description 8"));
1053 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.AddCalendar(updateCalendarTest.GetAccount("Test Account 3").accountID, "Calendar 9", "calendar3-test", defaultColour, "Calendar Description 9"));
1055 CDSGetCalendarInfo calendar1Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test");
1056 CDSGetCalendarInfo calendar2Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test");
1057 CDSGetCalendarInfo calendar3Info = updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test");
1058 CDSGetCalendarInfo calendar4Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test");
1059 CDSGetCalendarInfo calendar5Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test");
1060 CDSGetCalendarInfo calendar6Info = updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test");
1061 CDSGetCalendarInfo calendar7Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test");
1062 CDSGetCalendarInfo calendar8Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test");
1063 CDSGetCalendarInfo calendar9Info = updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test");
1065 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar1Info.calendarID, "Calendar 1 Updated", defaultColour, "Calendar Description 1 Updated"));
1066 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar2Info.calendarID, "Calendar 2 Updated", defaultColour, "Calendar Description 2 Updated"));
1067 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar3Info.calendarID, "Calendar 3 Updated", defaultColour, "Calendar Description 3 Updated"));
1068 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar4Info.calendarID, "Calendar 4 Updated", defaultColour, "Calendar Description 4 Updated"));
1069 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar5Info.calendarID, "Calendar 5 Updated", defaultColour, "Calendar Description 5 Updated"));
1070 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar6Info.calendarID, "Calendar 6 Updated", defaultColour, "Calendar Description 6 Updated"));
1071 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar7Info.calendarID, "Calendar 7 Updated", defaultColour, "Calendar Description 7 Updated"));
1072 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar8Info.calendarID, "Calendar 8 Updated", defaultColour, "Calendar Description 8 Updated"));
1073 ASSERT_EQ(CDSCALENDAR_OK, updateCalendarTest.UpdateCalendar(calendar9Info.calendarID, "Calendar 9 Updated", defaultColour, "Calendar Description 9 Updated"));
1075 ASSERT_EQ("Calendar 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarName);
1076 ASSERT_EQ("Calendar 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarName);
1077 ASSERT_EQ("Calendar 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarName);
1078 ASSERT_EQ("Calendar 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarName);
1079 ASSERT_EQ("Calendar 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarName);
1080 ASSERT_EQ("Calendar 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarName);
1081 ASSERT_EQ("Calendar 7 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarName);
1082 ASSERT_EQ("Calendar 8 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarName);
1083 ASSERT_EQ("Calendar 9 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test").calendarName);
1085 ASSERT_EQ("Calendar Description 1 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar1-test").calendarDescription);
1086 ASSERT_EQ("Calendar Description 2 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar2-test").calendarDescription);
1087 ASSERT_EQ("Calendar Description 3 Updated", updateCalendarTest.GetCalendar("Test Account 1", "calendar3-test").calendarDescription);
1088 ASSERT_EQ("Calendar Description 4 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar1-test").calendarDescription);
1089 ASSERT_EQ("Calendar Description 5 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar2-test").calendarDescription);
1090 ASSERT_EQ("Calendar Description 6 Updated", updateCalendarTest.GetCalendar("Test Account 2", "calendar3-test").calendarDescription);
1091 ASSERT_EQ("Calendar Description 7 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar1-test").calendarDescription);
1092 ASSERT_EQ("Calendar Description 8 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar2-test").calendarDescription);
1093 ASSERT_EQ("Calendar Description 9 Updated", updateCalendarTest.GetCalendar("Test Account 3", "calendar3-test").calendarDescription);
1097 TEST(CalendarDataStorage, Delete_One_Calendar){
1099 CalendarDataStorage deleteCalendarTest;
1102 deleteCalendarTest.AddAccount("Test Account 1", 1);
1104 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
1106 calendarID = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
1108 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID));
1112 TEST(CalendarDataStorage, Delete_Two_Calendars){
1114 CalendarDataStorage deleteCalendarTest;
1115 int calendarID1 = 0;
1116 int calendarID2 = 0;
1118 deleteCalendarTest.AddAccount("Test Account 1", 1);
1119 deleteCalendarTest.AddAccount("Test Account 2", 2);
1121 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
1122 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1"));
1124 calendarID1 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
1125 calendarID2 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
1127 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID1));
1128 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID2));
1132 TEST(CalendarDataStorage, Delete_Three_Calendars){
1134 CalendarDataStorage deleteCalendarTest;
1135 int calendarID1 = 0;
1136 int calendarID2 = 0;
1137 int calendarID3 = 0;
1139 deleteCalendarTest.AddAccount("Test Account 1", 1);
1140 deleteCalendarTest.AddAccount("Test Account 2", 2);
1141 deleteCalendarTest.AddAccount("Test Account 3", 3);
1143 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1"));
1144 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1"));
1145 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.AddCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountID, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1"));
1147 calendarID1 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar1-test").calendarID;
1148 calendarID2 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar2-test").calendarID;
1149 calendarID3 = deleteCalendarTest.GetCalendar(deleteCalendarTest.GetAccount("Test Account 1").accountName, "calendar3-test").calendarID;
1151 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID1));
1152 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID2));
1153 ASSERT_EQ(CDSCALENDAR_OK, deleteCalendarTest.DeleteCalendar(calendarID3));
1157 TEST(CalendarDataStorage, Add_One_Event){
1159 CalendarDataStorage addEventTest;
1161 addEventTest.AddAccount("Test Account 1", 1);
1162 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1164 CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1166 ASSERT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
1167 ASSERT_EQ(1, addEventResult.calendarEntryID);
1171 TEST(CalendarDataStorage, Add_Two_Events){
1173 CalendarDataStorage addEventTest;
1175 addEventTest.AddAccount("Test Account 1", 1);
1176 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1178 CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1180 ASSERT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
1181 ASSERT_EQ(1, addEvent1Result.calendarEntryID);
1183 CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1185 ASSERT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
1186 ASSERT_EQ(2, addEvent2Result.calendarEntryID);
1190 TEST(CalendarDataStorage, Add_Three_Events){
1192 CalendarDataStorage addEventTest;
1194 addEventTest.AddAccount("Test Account 1", 1);
1195 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1197 CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1199 ASSERT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
1200 ASSERT_EQ(1, addEvent1Result.calendarEntryID);
1202 CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1204 ASSERT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
1205 ASSERT_EQ(2, addEvent2Result.calendarEntryID);
1207 CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1209 ASSERT_EQ(CDSENTRY_OK, addEvent3Result.addEventResult);
1210 ASSERT_EQ(3, addEvent3Result.calendarEntryID);
1214 TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information){
1216 CalendarDataStorage addEventTest;
1218 addEventTest.AddAccount("Test Account 1", 1);
1219 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1220 CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1222 // Get the entry information.
1224 CDSGetCalendarEntryInfo entryInfo = addEventTest.GetEvent(addEventResult.calendarEntryID);
1226 ASSERT_EQ(CDSENTRY_OK, entryInfo.getEventResult);
1227 ASSERT_EQ("First test event", entryInfo.entryName);
1228 ASSERT_EQ("First entry description", entryInfo.entryDescription);
1229 ASSERT_EQ(2016, entryInfo.entryStartYear);
1230 ASSERT_EQ(12, entryInfo.entryStartMonth);
1231 ASSERT_EQ(1, entryInfo.entryStartDay);
1232 ASSERT_EQ(12, entryInfo.entryStartHour);
1233 ASSERT_EQ(30, entryInfo.entryStartMinute);
1234 ASSERT_EQ(0, entryInfo.entryStartSecond);
1235 ASSERT_EQ(2016, entryInfo.entryEndYear);
1236 ASSERT_EQ(12, entryInfo.entryEndMonth);
1237 ASSERT_EQ(1, entryInfo.entryEndDay);
1238 ASSERT_EQ(15, entryInfo.entryEndHour);
1239 ASSERT_EQ(30, entryInfo.entryEndMinute);
1240 ASSERT_EQ(0, entryInfo.entryEndSecond);
1244 TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information_With_Duration){
1246 CalendarDataStorage addEventTest;
1248 addEventTest.AddAccount("Test Account 1", 1);
1249 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1250 CDSAddEntryResult addEventResult = addEventTest.AddEvent(1, "CalendarEvent2.ics");
1252 EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
1254 // Get the entry information.
1256 CDSGetCalendarEntryInfo entryInfo = addEventTest.GetEvent(addEventResult.calendarEntryID);
1258 ASSERT_EQ(CDSENTRY_OK, entryInfo.getEventResult);
1259 ASSERT_EQ("Second test event", entryInfo.entryName);
1260 ASSERT_EQ("Second entry description", entryInfo.entryDescription);
1261 ASSERT_EQ(2016, entryInfo.entryStartYear);
1262 ASSERT_EQ(12, entryInfo.entryStartMonth);
1263 ASSERT_EQ(1, entryInfo.entryStartDay);
1264 ASSERT_EQ(12, entryInfo.entryStartHour);
1265 ASSERT_EQ(30, entryInfo.entryStartMinute);
1266 ASSERT_EQ(0, entryInfo.entryStartSecond);
1267 ASSERT_EQ(0, entryInfo.entryEndYear);
1268 ASSERT_EQ(0, entryInfo.entryEndMonth);
1269 ASSERT_EQ(0, entryInfo.entryEndDay);
1270 ASSERT_EQ(0, entryInfo.entryEndHour);
1271 ASSERT_EQ(0, entryInfo.entryEndMinute);
1272 ASSERT_EQ(0, entryInfo.entryEndSecond);
1273 ASSERT_EQ(0, entryInfo.entryDurationWeeks);
1274 ASSERT_EQ(1, entryInfo.entryDurationDays);
1275 ASSERT_EQ(5, entryInfo.entryDurationHours);
1276 ASSERT_EQ(30, entryInfo.entryDurationMinutes);
1277 ASSERT_EQ(15, entryInfo.entryDurationSeconds);
1281 TEST(CalendarDataStorage, Add_Two_Events_And_Get_Event_Basic_Information){
1283 CalendarDataStorage addEventTest;
1285 addEventTest.AddAccount("Test Account 1", 1);
1286 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1287 CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1288 CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent2.ics");
1290 // Get the entry information.
1292 CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
1293 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1295 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1296 ASSERT_EQ("First test event", entry1Info.entryName);
1297 ASSERT_EQ("First entry description", entry1Info.entryDescription);
1298 ASSERT_EQ(2016, entry1Info.entryStartYear);
1299 ASSERT_EQ(12, entry1Info.entryStartMonth);
1300 ASSERT_EQ(1, entry1Info.entryStartDay);
1301 ASSERT_EQ(12, entry1Info.entryStartHour);
1302 ASSERT_EQ(30, entry1Info.entryStartMinute);
1303 ASSERT_EQ(0, entry1Info.entryStartSecond);
1304 ASSERT_EQ(2016, entry1Info.entryEndYear);
1305 ASSERT_EQ(12, entry1Info.entryEndMonth);
1306 ASSERT_EQ(1, entry1Info.entryEndDay);
1307 ASSERT_EQ(15, entry1Info.entryEndHour);
1308 ASSERT_EQ(30, entry1Info.entryEndMinute);
1309 ASSERT_EQ(0, entry1Info.entryEndSecond);
1311 CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
1312 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1314 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1315 ASSERT_EQ("Second test event", entry2Info.entryName);
1316 ASSERT_EQ("Second entry description", entry2Info.entryDescription);
1317 ASSERT_EQ(2016, entry2Info.entryStartYear);
1318 ASSERT_EQ(12, entry2Info.entryStartMonth);
1319 ASSERT_EQ(1, entry2Info.entryStartDay);
1320 ASSERT_EQ(12, entry2Info.entryStartHour);
1321 ASSERT_EQ(30, entry2Info.entryStartMinute);
1322 ASSERT_EQ(0, entry2Info.entryStartSecond);
1323 ASSERT_EQ(0, entry2Info.entryEndYear);
1324 ASSERT_EQ(0, entry2Info.entryEndMonth);
1325 ASSERT_EQ(0, entry2Info.entryEndDay);
1326 ASSERT_EQ(0, entry2Info.entryEndHour);
1327 ASSERT_EQ(0, entry2Info.entryEndMinute);
1328 ASSERT_EQ(0, entry2Info.entryEndSecond);
1329 ASSERT_EQ(0, entry2Info.entryDurationWeeks);
1330 ASSERT_EQ(1, entry2Info.entryDurationDays);
1331 ASSERT_EQ(5, entry2Info.entryDurationHours);
1332 ASSERT_EQ(30, entry2Info.entryDurationMinutes);
1333 ASSERT_EQ(15, entry2Info.entryDurationSeconds);
1337 TEST(CalendarDataStorage, Add_The_Same_Three_Events_And_Get_Event_Information){
1339 CalendarDataStorage addEventTest;
1341 addEventTest.AddAccount("Test Account 1", 1);
1342 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1343 CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1344 CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1345 CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1347 // Get the entry information.
1349 CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
1350 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1352 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1353 ASSERT_EQ("First test event", entry1Info.entryName);
1354 ASSERT_EQ("First entry description", entry1Info.entryDescription);
1355 ASSERT_EQ(2016, entry1Info.entryStartYear);
1356 ASSERT_EQ(12, entry1Info.entryStartMonth);
1357 ASSERT_EQ(1, entry1Info.entryStartDay);
1358 ASSERT_EQ(12, entry1Info.entryStartHour);
1359 ASSERT_EQ(30, entry1Info.entryStartMinute);
1360 ASSERT_EQ(0, entry1Info.entryStartSecond);
1361 ASSERT_EQ(2016, entry1Info.entryEndYear);
1362 ASSERT_EQ(12, entry1Info.entryEndMonth);
1363 ASSERT_EQ(1, entry1Info.entryEndDay);
1364 ASSERT_EQ(15, entry1Info.entryEndHour);
1365 ASSERT_EQ(30, entry1Info.entryEndMinute);
1366 ASSERT_EQ(0, entry1Info.entryEndSecond);
1368 CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
1369 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1371 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1372 ASSERT_EQ("First test event", entry2Info.entryName);
1373 ASSERT_EQ("First entry description", entry2Info.entryDescription);
1374 ASSERT_EQ(2016, entry2Info.entryStartYear);
1375 ASSERT_EQ(12, entry2Info.entryStartMonth);
1376 ASSERT_EQ(1, entry2Info.entryStartDay);
1377 ASSERT_EQ(12, entry2Info.entryStartHour);
1378 ASSERT_EQ(30, entry2Info.entryStartMinute);
1379 ASSERT_EQ(0, entry2Info.entryStartSecond);
1380 ASSERT_EQ(2016, entry2Info.entryEndYear);
1381 ASSERT_EQ(12, entry2Info.entryEndMonth);
1382 ASSERT_EQ(1, entry2Info.entryEndDay);
1383 ASSERT_EQ(15, entry2Info.entryEndHour);
1384 ASSERT_EQ(30, entry2Info.entryEndMinute);
1385 ASSERT_EQ(0, entry2Info.entryEndSecond);
1387 CDSGetCalendarEntryInfo entry3Info = addEventTest.GetEvent(addEvent3Result.calendarEntryID);
1388 ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
1390 ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
1391 ASSERT_EQ("First test event", entry3Info.entryName);
1392 ASSERT_EQ("First entry description", entry3Info.entryDescription);
1393 ASSERT_EQ(2016, entry3Info.entryStartYear);
1394 ASSERT_EQ(12, entry3Info.entryStartMonth);
1395 ASSERT_EQ(1, entry3Info.entryStartDay);
1396 ASSERT_EQ(12, entry3Info.entryStartHour);
1397 ASSERT_EQ(30, entry3Info.entryStartMinute);
1398 ASSERT_EQ(0, entry3Info.entryStartSecond);
1399 ASSERT_EQ(2016, entry3Info.entryEndYear);
1400 ASSERT_EQ(12, entry3Info.entryEndMonth);
1401 ASSERT_EQ(1, entry3Info.entryEndDay);
1402 ASSERT_EQ(15, entry3Info.entryEndHour);
1403 ASSERT_EQ(30, entry3Info.entryEndMinute);
1404 ASSERT_EQ(0, entry3Info.entryEndSecond);
1408 TEST(CalendarDataStorage, Add_Three_Events_And_Get_Event_Information){
1410 CalendarDataStorage addEventTest;
1412 addEventTest.AddAccount("Test Account 1", 1);
1413 addEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1414 CDSAddEntryResult addEvent1Result = addEventTest.AddEvent(1, "CalendarEvent1.ics");
1415 CDSAddEntryResult addEvent2Result = addEventTest.AddEvent(1, "CalendarEvent2.ics");
1416 CDSAddEntryResult addEvent3Result = addEventTest.AddEvent(1, "CalendarEvent3.ics");
1418 // Get the entry information.
1420 CDSGetCalendarEntryInfo entry1Info = addEventTest.GetEvent(addEvent1Result.calendarEntryID);
1421 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1423 ASSERT_EQ(CDSENTRY_OK, entry1Info.getEventResult);
1424 ASSERT_EQ("First test event", entry1Info.entryName);
1425 ASSERT_EQ("First entry description", entry1Info.entryDescription);
1426 ASSERT_EQ(2016, entry1Info.entryStartYear);
1427 ASSERT_EQ(12, entry1Info.entryStartMonth);
1428 ASSERT_EQ(1, entry1Info.entryStartDay);
1429 ASSERT_EQ(12, entry1Info.entryStartHour);
1430 ASSERT_EQ(30, entry1Info.entryStartMinute);
1431 ASSERT_EQ(0, entry1Info.entryStartSecond);
1432 ASSERT_EQ(2016, entry1Info.entryEndYear);
1433 ASSERT_EQ(12, entry1Info.entryEndMonth);
1434 ASSERT_EQ(1, entry1Info.entryEndDay);
1435 ASSERT_EQ(15, entry1Info.entryEndHour);
1436 ASSERT_EQ(30, entry1Info.entryEndMinute);
1437 ASSERT_EQ(0, entry1Info.entryEndSecond);
1439 CDSGetCalendarEntryInfo entry2Info = addEventTest.GetEvent(addEvent2Result.calendarEntryID);
1440 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1442 ASSERT_EQ(CDSENTRY_OK, entry2Info.getEventResult);
1443 ASSERT_EQ("Second test event", entry2Info.entryName);
1444 ASSERT_EQ("Second entry description", entry2Info.entryDescription);
1445 ASSERT_EQ(2016, entry2Info.entryStartYear);
1446 ASSERT_EQ(12, entry2Info.entryStartMonth);
1447 ASSERT_EQ(1, entry2Info.entryStartDay);
1448 ASSERT_EQ(12, entry2Info.entryStartHour);
1449 ASSERT_EQ(30, entry2Info.entryStartMinute);
1450 ASSERT_EQ(0, entry2Info.entryStartSecond);
1451 ASSERT_EQ(0, entry2Info.entryEndYear);
1452 ASSERT_EQ(0, entry2Info.entryEndMonth);
1453 ASSERT_EQ(0, entry2Info.entryEndDay);
1454 ASSERT_EQ(0, entry2Info.entryEndHour);
1455 ASSERT_EQ(0, entry2Info.entryEndMinute);
1456 ASSERT_EQ(0, entry2Info.entryEndSecond);
1457 ASSERT_EQ(0, entry2Info.entryDurationWeeks);
1458 ASSERT_EQ(1, entry2Info.entryDurationDays);
1459 ASSERT_EQ(5, entry2Info.entryDurationHours);
1460 ASSERT_EQ(30, entry2Info.entryDurationMinutes);
1461 ASSERT_EQ(15, entry2Info.entryDurationSeconds);
1463 CDSGetCalendarEntryInfo entry3Info = addEventTest.GetEvent(addEvent3Result.calendarEntryID);
1464 ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
1466 ASSERT_EQ(CDSENTRY_OK, entry3Info.getEventResult);
1467 ASSERT_EQ("Third test event", entry3Info.entryName);
1468 ASSERT_EQ("Third entry description", entry3Info.entryDescription);
1469 ASSERT_EQ(2015, entry3Info.entryStartYear);
1470 ASSERT_EQ(7, entry3Info.entryStartMonth);
1471 ASSERT_EQ(15, entry3Info.entryStartDay);
1472 ASSERT_EQ(15, entry3Info.entryStartHour);
1473 ASSERT_EQ(30, entry3Info.entryStartMinute);
1474 ASSERT_EQ(0, entry3Info.entryStartSecond);
1475 ASSERT_EQ(2015, entry3Info.entryEndYear);
1476 ASSERT_EQ(7, entry3Info.entryEndMonth);
1477 ASSERT_EQ(16, entry3Info.entryEndDay);
1478 ASSERT_EQ(22, entry3Info.entryEndHour);
1479 ASSERT_EQ(30, entry3Info.entryEndMinute);
1480 ASSERT_EQ(0, entry3Info.entryEndSecond);
1484 TEST(CalendarDataStorage, Delete_One_Event){
1486 CalendarDataStorage deleteEventTest;
1488 deleteEventTest.AddAccount("Test Account 1", 1);
1489 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1490 CDSAddEntryResult addEventResult = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1492 EXPECT_EQ(CDSENTRY_OK, addEventResult.addEventResult);
1494 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEventResult.calendarEntryID));
1498 TEST(CalendarDataStorage, Delete_Two_Events){
1500 CalendarDataStorage deleteEventTest;
1502 deleteEventTest.AddAccount("Test Account 1", 1);
1503 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1504 CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1505 CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
1507 EXPECT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
1508 EXPECT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
1510 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent1Result.calendarEntryID));
1511 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent2Result.calendarEntryID));
1515 TEST(CalendarDataStorage, Delete_Three_Events){
1517 CalendarDataStorage deleteEventTest;
1519 deleteEventTest.AddAccount("Test Account 1", 1);
1520 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1521 CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1522 CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
1523 CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
1525 EXPECT_EQ(CDSENTRY_OK, addEvent1Result.addEventResult);
1526 EXPECT_EQ(CDSENTRY_OK, addEvent2Result.addEventResult);
1527 EXPECT_EQ(CDSENTRY_OK, addEvent3Result.addEventResult);
1529 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent1Result.calendarEntryID));
1530 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent2Result.calendarEntryID));
1531 ASSERT_EQ(CDSENTRY_OK, deleteEventTest.DeleteEvent(addEvent3Result.calendarEntryID));
1535 TEST(CalendarDataStorage, Delete_One_Calendar_And_Events){
1537 CalendarDataStorage deleteEventTest;
1539 deleteEventTest.AddAccount("Test Account 1", 1);
1540 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1541 CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1542 CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
1543 CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
1545 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
1547 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1548 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1549 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1553 TEST(CalendarDataStorage, Delete_Two_Calendars_And_Events){
1555 CalendarDataStorage deleteEventTest;
1557 deleteEventTest.AddAccount("Test Account 1", 1);
1558 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1559 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar2-test", defaultColour, "Calendar Description 1");
1561 // Setup and delete the first calendar.
1563 CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1564 CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
1565 CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
1567 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
1569 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1570 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1571 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1573 // Setup and delete the second calendar.
1575 addEvent1Result = deleteEventTest.AddEvent(2, "CalendarEvent1.ics");
1576 addEvent2Result = deleteEventTest.AddEvent(2, "CalendarEvent2.ics");
1577 addEvent3Result = deleteEventTest.AddEvent(2, "CalendarEvent3.ics");
1579 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(2));
1581 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1582 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1583 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1587 TEST(CalendarDataStorage, Delete_Three_Calendars_And_Events){
1589 CalendarDataStorage deleteEventTest;
1591 deleteEventTest.AddAccount("Test Account 1", 1);
1592 deleteEventTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1593 deleteEventTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
1594 deleteEventTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
1596 // Setup and delete the first calendar.
1598 CDSAddEntryResult addEvent1Result = deleteEventTest.AddEvent(1, "CalendarEvent1.ics");
1599 CDSAddEntryResult addEvent2Result = deleteEventTest.AddEvent(1, "CalendarEvent2.ics");
1600 CDSAddEntryResult addEvent3Result = deleteEventTest.AddEvent(1, "CalendarEvent3.ics");
1602 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(1));
1604 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1605 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1606 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1608 // Setup and delete the second calendar.
1610 addEvent1Result = deleteEventTest.AddEvent(2, "CalendarEvent1.ics");
1611 addEvent2Result = deleteEventTest.AddEvent(2, "CalendarEvent2.ics");
1612 addEvent3Result = deleteEventTest.AddEvent(2, "CalendarEvent3.ics");
1614 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(2));
1616 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1617 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1618 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1620 // Setup and delete the third calendar.
1622 addEvent1Result = deleteEventTest.AddEvent(3, "CalendarEvent1.ics");
1623 addEvent2Result = deleteEventTest.AddEvent(3, "CalendarEvent2.ics");
1624 addEvent3Result = deleteEventTest.AddEvent(3, "CalendarEvent3.ics");
1626 EXPECT_EQ(CDSCALENDAR_OK, deleteEventTest.DeleteCalendar(3));
1628 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1629 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1630 EXPECT_EQ(CDSENTRY_NOENTRY, deleteEventTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1634 TEST(CalendarDataStorage, Delete_One_Account_And_Associated_Data){
1636 CalendarDataStorage deleteAccountTest;
1638 deleteAccountTest.AddAccount("Test Account 1", 1);
1639 deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1641 // Setup and delete the first account.
1643 CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
1644 CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
1645 CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
1647 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
1649 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
1650 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
1652 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1653 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1654 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1658 TEST(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){
1660 CalendarDataStorage deleteAccountTest;
1662 deleteAccountTest.AddAccount("Test Account 1", 1);
1663 deleteAccountTest.AddAccount("Test Account 2", 2);
1664 deleteAccountTest.AddAccount("Test Account 3", 3);
1666 // Setup and delete the first account.
1668 deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1669 deleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1670 deleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1672 CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
1673 CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
1674 CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
1676 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
1678 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
1679 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
1681 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1682 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1683 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1685 // Setup and delete the second account.
1687 deleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1688 deleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1689 deleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1691 addEvent1Result = deleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
1692 addEvent2Result = deleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
1693 addEvent3Result = deleteAccountTest.AddEvent(4, "CalendarEvent3.ics");
1695 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(2));
1697 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").accountInfoResult);
1698 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").calendarInfoResult);
1700 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1701 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1702 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1706 TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){
1708 CalendarDataStorage deleteAccountTest;
1710 deleteAccountTest.AddAccount("Test Account 1", 1);
1711 deleteAccountTest.AddAccount("Test Account 2", 2);
1712 deleteAccountTest.AddAccount("Test Account 3", 3);
1714 // Setup and delete the first account.
1716 deleteAccountTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1717 deleteAccountTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1718 deleteAccountTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1720 CDSAddEntryResult addEvent1Result = deleteAccountTest.AddEvent(1, "CalendarEvent1.ics");
1721 CDSAddEntryResult addEvent2Result = deleteAccountTest.AddEvent(1, "CalendarEvent2.ics");
1722 CDSAddEntryResult addEvent3Result = deleteAccountTest.AddEvent(1, "CalendarEvent3.ics");
1724 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(1));
1726 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").accountInfoResult);
1727 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 1", "calendar1-test").calendarInfoResult);
1729 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1730 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1731 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1733 // Setup and delete the second account.
1735 deleteAccountTest.AddCalendar(2, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1736 deleteAccountTest.AddCalendar(2, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1737 deleteAccountTest.AddCalendar(2, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1739 addEvent1Result = deleteAccountTest.AddEvent(4, "CalendarEvent1.ics");
1740 addEvent2Result = deleteAccountTest.AddEvent(4, "CalendarEvent2.ics");
1741 addEvent3Result = deleteAccountTest.AddEvent(4, "CalendarEvent3.ics");
1743 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(2));
1745 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").accountInfoResult);
1746 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 2", "calendar1-test").calendarInfoResult);
1748 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1749 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1750 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1752 // Setup and delete the third account.
1754 deleteAccountTest.AddCalendar(3, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1755 deleteAccountTest.AddCalendar(3, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1756 deleteAccountTest.AddCalendar(3, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1758 addEvent1Result = deleteAccountTest.AddEvent(7, "CalendarEvent1.ics");
1759 addEvent2Result = deleteAccountTest.AddEvent(7, "CalendarEvent2.ics");
1760 addEvent3Result = deleteAccountTest.AddEvent(7, "CalendarEvent3.ics");
1762 EXPECT_EQ(CDSCALENDAR_OK, deleteAccountTest.DeleteAccount(3));
1764 EXPECT_EQ(CDSENTRY_NOACCOUNT, deleteAccountTest.GetCalendar("Test Account 3", "calendar1-test").accountInfoResult);
1765 EXPECT_EQ(CDSENTRY_NOCALENDAR, deleteAccountTest.GetCalendar("Test Account 3", "calendar1-test").calendarInfoResult);
1767 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent1Result.calendarEntryID).getEventResult);
1768 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent2Result.calendarEntryID).getEventResult);
1769 EXPECT_EQ(CDSENTRY_NOENTRY, deleteAccountTest.GetEvent(addEvent3Result.calendarEntryID).getEventResult);
1773 TEST(CalendarDataStorage, Get_List_Of_Events_For_One_Account){
1775 CalendarDataStorage getEventsListTest;
1777 getEventsListTest.AddAccount("Test Account 1", 1);
1779 // Setup and delete the first account.
1781 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1782 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1783 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1785 CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
1786 CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
1787 CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
1789 CDSEntryList entryList = getEventsListTest.GetEventList(1);
1791 EXPECT_EQ(1, entryList.entryList.at(0));
1792 EXPECT_EQ(2, entryList.entryList.at(1));
1793 EXPECT_EQ(3, entryList.entryList.at(2));
1797 TEST(CalendarDataStorage, Get_List_Of_Events_For_Two_Accounts){
1799 CalendarDataStorage getEventsListTest;
1801 getEventsListTest.AddAccount("Test Account 1", 1);
1803 // Setup and delete the first account.
1805 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1806 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1807 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1809 // Setup the first account.
1811 CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
1812 CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
1813 CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
1815 CDSEntryList entryList = getEventsListTest.GetEventList(1);
1817 EXPECT_EQ(1, entryList.entryList.at(0));
1818 EXPECT_EQ(2, entryList.entryList.at(1));
1819 EXPECT_EQ(3, entryList.entryList.at(2));
1821 // Setup the second account.
1823 addEvent1Result = getEventsListTest.AddEvent(2, "CalendarEvent1.ics");
1824 addEvent2Result = getEventsListTest.AddEvent(2, "CalendarEvent2.ics");
1825 addEvent3Result = getEventsListTest.AddEvent(2, "CalendarEvent3.ics");
1827 entryList = getEventsListTest.GetEventList(2);
1829 EXPECT_EQ(4, entryList.entryList.at(0));
1830 EXPECT_EQ(5, entryList.entryList.at(1));
1831 EXPECT_EQ(6, entryList.entryList.at(2));
1835 TEST(CalendarDataStorage, Get_List_Of_Events_For_Three_Accounts){
1837 CalendarDataStorage getEventsListTest;
1839 getEventsListTest.AddAccount("Test Account 1", 1);
1841 // Setup and delete the first account.
1843 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1844 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar1-test", defaultColour, "Calendar Description 1");
1845 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar1-test", defaultColour, "Calendar Description 1");
1847 // Setup the first account.
1849 CDSAddEntryResult addEvent1Result = getEventsListTest.AddEvent(1, "CalendarEvent1.ics");
1850 CDSAddEntryResult addEvent2Result = getEventsListTest.AddEvent(1, "CalendarEvent2.ics");
1851 CDSAddEntryResult addEvent3Result = getEventsListTest.AddEvent(1, "CalendarEvent3.ics");
1853 CDSEntryList entryList = getEventsListTest.GetEventList(1);
1855 EXPECT_EQ(1, entryList.entryList.at(0));
1856 EXPECT_EQ(2, entryList.entryList.at(1));
1857 EXPECT_EQ(3, entryList.entryList.at(2));
1859 // Setup the second account.
1861 addEvent1Result = getEventsListTest.AddEvent(2, "CalendarEvent1.ics");
1862 addEvent2Result = getEventsListTest.AddEvent(2, "CalendarEvent2.ics");
1863 addEvent3Result = getEventsListTest.AddEvent(2, "CalendarEvent3.ics");
1865 entryList = getEventsListTest.GetEventList(2);
1867 EXPECT_EQ(4, entryList.entryList.at(0));
1868 EXPECT_EQ(5, entryList.entryList.at(1));
1869 EXPECT_EQ(6, entryList.entryList.at(2));
1871 // Setup the third account.
1873 addEvent1Result = getEventsListTest.AddEvent(3, "CalendarEvent1.ics");
1874 addEvent2Result = getEventsListTest.AddEvent(3, "CalendarEvent2.ics");
1875 addEvent3Result = getEventsListTest.AddEvent(3, "CalendarEvent3.ics");
1877 entryList = getEventsListTest.GetEventList(3);
1879 EXPECT_EQ(7, entryList.entryList.at(0));
1880 EXPECT_EQ(8, entryList.entryList.at(1));
1881 EXPECT_EQ(9, entryList.entryList.at(2));
1885 TEST(CalendarDataStorage, Get_List_Of_Calendars_For_One_Account){
1887 CalendarDataStorage getEventsListTest;
1889 getEventsListTest.AddAccount("Test Account 1", 1);
1891 // Setup the first account.
1893 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1894 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
1895 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
1897 // Get the list of calendar IDs.
1899 CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
1901 EXPECT_EQ(1, calendarList.calendarList.at(0));
1902 EXPECT_EQ(2, calendarList.calendarList.at(1));
1903 EXPECT_EQ(3, calendarList.calendarList.at(2));
1905 EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
1906 EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
1907 EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
1911 TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){
1913 CalendarDataStorage getEventsListTest;
1915 getEventsListTest.AddAccount("Test Account 1", 1);
1916 getEventsListTest.AddAccount("Test Account 2", 2);
1918 // Setup the first account.
1920 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1921 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
1922 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
1924 // Get the list of calendar IDs.
1926 CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
1928 EXPECT_EQ(1, calendarList.calendarList.at(0));
1929 EXPECT_EQ(2, calendarList.calendarList.at(1));
1930 EXPECT_EQ(3, calendarList.calendarList.at(2));
1932 EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
1933 EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
1934 EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
1936 // Setup the second account.
1938 getEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", defaultColour, "Calendar Description 1");
1939 getEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", defaultColour, "Calendar Description 1");
1940 getEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", defaultColour, "Calendar Description 1");
1942 calendarList = getEventsListTest.GetCalendarList(2);
1944 EXPECT_EQ(4, calendarList.calendarList.at(0));
1945 EXPECT_EQ(5, calendarList.calendarList.at(1));
1946 EXPECT_EQ(6, calendarList.calendarList.at(2));
1948 EXPECT_EQ("calendar4-test", calendarList.calendarListTextID.at(0));
1949 EXPECT_EQ("calendar5-test", calendarList.calendarListTextID.at(1));
1950 EXPECT_EQ("calendar6-test", calendarList.calendarListTextID.at(2));
1954 TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){
1956 CalendarDataStorage getEventsListTest;
1958 getEventsListTest.AddAccount("Test Account 1", 1);
1959 getEventsListTest.AddAccount("Test Account 2", 2);
1960 getEventsListTest.AddAccount("Test Account 3", 3);
1962 // Setup the first account.
1964 getEventsListTest.AddCalendar(1, "Calendar 1", "calendar1-test", defaultColour, "Calendar Description 1");
1965 getEventsListTest.AddCalendar(1, "Calendar 2", "calendar2-test", defaultColour, "Calendar Description 1");
1966 getEventsListTest.AddCalendar(1, "Calendar 3", "calendar3-test", defaultColour, "Calendar Description 1");
1968 // Get the list of calendar IDs.
1970 CDSCalendarList calendarList = getEventsListTest.GetCalendarList(1);
1972 EXPECT_EQ(1, calendarList.calendarList.at(0));
1973 EXPECT_EQ(2, calendarList.calendarList.at(1));
1974 EXPECT_EQ(3, calendarList.calendarList.at(2));
1976 EXPECT_EQ("calendar1-test", calendarList.calendarListTextID.at(0));
1977 EXPECT_EQ("calendar2-test", calendarList.calendarListTextID.at(1));
1978 EXPECT_EQ("calendar3-test", calendarList.calendarListTextID.at(2));
1980 // Setup the second account.
1982 getEventsListTest.AddCalendar(2, "Calendar 4", "calendar4-test", defaultColour, "Calendar Description 1");
1983 getEventsListTest.AddCalendar(2, "Calendar 5", "calendar5-test", defaultColour, "Calendar Description 1");
1984 getEventsListTest.AddCalendar(2, "Calendar 6", "calendar6-test", defaultColour, "Calendar Description 1");
1986 calendarList = getEventsListTest.GetCalendarList(2);
1988 EXPECT_EQ(4, calendarList.calendarList.at(0));
1989 EXPECT_EQ(5, calendarList.calendarList.at(1));
1990 EXPECT_EQ(6, calendarList.calendarList.at(2));
1992 EXPECT_EQ("calendar4-test", calendarList.calendarListTextID.at(0));
1993 EXPECT_EQ("calendar5-test", calendarList.calendarListTextID.at(1));
1994 EXPECT_EQ("calendar6-test", calendarList.calendarListTextID.at(2));
1996 // Setup the third account.
1998 getEventsListTest.AddCalendar(3, "Calendar 7", "calendar7-test", defaultColour, "Calendar Description 1");
1999 getEventsListTest.AddCalendar(3, "Calendar 8", "calendar8-test", defaultColour, "Calendar Description 1");
2000 getEventsListTest.AddCalendar(3, "Calendar 9", "calendar9-test", defaultColour, "Calendar Description 1");
2002 calendarList = getEventsListTest.GetCalendarList(3);
2004 EXPECT_EQ(7, calendarList.calendarList.at(0));
2005 EXPECT_EQ(8, calendarList.calendarList.at(1));
2006 EXPECT_EQ(9, calendarList.calendarList.at(2));
2008 EXPECT_EQ("calendar7-test", calendarList.calendarListTextID.at(0));
2009 EXPECT_EQ("calendar8-test", calendarList.calendarListTextID.at(1));
2010 EXPECT_EQ("calendar9-test", calendarList.calendarListTextID.at(2));
2014 TEST(CalendarDataStorage, Add_One_Checksum){
2016 CalendarDataStorage checksumTest;
2018 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2020 // Get the checksum.
2022 //EXPECT_EQ("checksumYay", checksumTest.GetChecksum("firstChecksum"));
2026 TEST(CalendarDataStorage, Add_Two_Checksus){
2028 CalendarDataStorage checksumTest;
2030 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2031 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2035 TEST(CalendarDataStorage, Add_Three_Checksus){
2037 CalendarDataStorage checksumTest;
2039 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2040 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2041 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
2045 TEST(CalendarDataStorage, Add_One_Checksum_And_Get_One_Checksum){
2047 CalendarDataStorage checksumTest;
2049 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2051 // Get the checksum.
2053 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2055 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2056 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2060 TEST(CalendarDataStorage, Add_Two_Checksums_And_Get_Two_Checksums){
2062 CalendarDataStorage checksumTest;
2064 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2065 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2067 // Get the checksums.
2069 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2071 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2072 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2074 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2076 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2077 EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
2081 TEST(CalendarDataStorage, Add_Three_Checksums_And_Get_Three_Checksums){
2083 CalendarDataStorage checksumTest;
2085 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2086 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2087 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
2089 // Get the checksums.
2091 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2093 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2094 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2096 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2098 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2099 EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
2101 getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
2103 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2104 EXPECT_EQ("checksumThree", getChecksumResult.checksumValue);
2108 TEST(CalendarDataStorage, Add_One_Checksum_Update_One_Checksum_And_Get_One_Checksum){
2110 CalendarDataStorage checksumTest;
2112 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2114 // Get the checksum.
2116 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2118 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2119 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2121 // Update the checksum.
2123 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
2125 // Get the checksum again.
2127 getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2129 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2130 EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
2134 TEST(CalendarDataStorage, Add_Two_Checksums_Update_Two_Checksums_And_Get_Two_Checksums){
2136 CalendarDataStorage checksumTest;
2138 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2139 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2141 // Get the checksum.
2143 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2145 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2146 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2148 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2150 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2151 EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
2153 // Update the checksum.
2155 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
2156 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("secondChecksum", "updatedChecksum2"));
2158 // Get the checksum again.
2160 getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2162 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2163 EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
2165 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2167 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2168 EXPECT_EQ("updatedChecksum2", getChecksumResult.checksumValue);
2172 TEST(CalendarDataStorage, Add_Three_Checksums_Update_Three_Checksums_And_Get_Three_Checksums){
2174 CalendarDataStorage checksumTest;
2176 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("firstChecksum", "checksumYay"));
2177 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("secondChecksum", "checksumTwo"));
2178 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.AddChecksum("thirdChecksum", "checksumThree"));
2180 // Get the checksum.
2182 CDSGetChecksumResult getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2184 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2185 EXPECT_EQ("checksumYay", getChecksumResult.checksumValue);
2187 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2189 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2190 EXPECT_EQ("checksumTwo", getChecksumResult.checksumValue);
2192 getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
2194 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2195 EXPECT_EQ("checksumThree", getChecksumResult.checksumValue);
2197 // Update the checksum.
2199 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("firstChecksum", "updatedChecksum1"));
2200 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("secondChecksum", "updatedChecksum2"));
2201 EXPECT_EQ(CDSCHECKSUM_OK, checksumTest.UpdateChecksum("thirdChecksum", "updatedChecksum3"));
2203 // Get the checksum again.
2205 getChecksumResult = checksumTest.GetChecksum("firstChecksum");
2207 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2208 EXPECT_EQ("updatedChecksum1", getChecksumResult.checksumValue);
2210 getChecksumResult = checksumTest.GetChecksum("secondChecksum");
2212 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2213 EXPECT_EQ("updatedChecksum2", getChecksumResult.checksumValue);
2215 getChecksumResult = checksumTest.GetChecksum("thirdChecksum");
2217 EXPECT_EQ(CDSCHECKSUM_OK, getChecksumResult.getChecksumResult);
2218 EXPECT_EQ("updatedChecksum3", getChecksumResult.checksumValue);