Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added menu option for unit testing saving Free/Busy information
[xestiacalendar/.git] / source / tests / xestiacalendar_icaltaskload.h
1 // xestiacalendar_icaltaskload.h - Xestia Calendar iCalendar Task Component Unit Tests
2 //
3 // (c) 2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Address Book 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.
10 //
11 // Xestia Address Book 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.
15 //
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 "../objects/calendartask/CalendarTask.h"
21 TEST(iCalendarTask, BasicTests){
23         CalendarTaskObject TestTask;
24         
25         ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestTask.LoadFile("iCalendarTask-Missing.vcf"));
26         ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestTask.LoadFile("iCalendarTask-InvalidPermissions.vcf"));
27         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load1.vcf"));
28         
29 }
31 TEST(iCalendarTask, ObjectDataTests){
33         CalendarTaskObject TestTask;
34         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load2.vcf"));
35         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
36         
37         // Tests for DTSTAMP.
38         
39         ASSERT_EQ("20160131T104500Z", TestTask.DateTimeStampData);
40         ASSERT_EQ("OTHER=PARAM", TestTask.DateTimeStampTokens);
41         
42         // Tests for UID.
43         
44         ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e1", TestTask.UniqueID);
45         ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestTask.UniqueIDTokens);
46         
47         // Tests for CLASS.
48         
49         ASSERT_EQ("PUBLIC", TestTask.ClassData);
50         ASSERT_EQ("CHOCOLATE=NONE", TestTask.ClassDataTokens);
51         
52         // Tests for COMPLETED.
53         
54         ASSERT_EQ("20160131T110100Z", TestTask.CompletedData);
55         ASSERT_EQ("LYING=NEVER", TestTask.CompletedDataTokens);
56         
57         // Tests for CREATED.
59         ASSERT_EQ("20160131T080000Z", TestTask.DateTimeCreatedData);
60         ASSERT_EQ("CARAMEL=PLEASE", TestTask.DateTimeCreatedTokens);
61         
62         // Tests for DESCRIPTION.
63         
64         std::string DescriptionData;
65         std::string DescriptionAltRep;
66         std::string DescriptionLanguage;
67         std::string DescriptionTokens;
68         
69         if (TestTask.DescriptionList.begin() != TestTask.DescriptionList.end()){
70                 DescriptionData = TestTask.DescriptionList[0];
71         }
73         if (TestTask.DescriptionListAltRep.begin() != TestTask.DescriptionListAltRep.end()){
74                 DescriptionAltRep = TestTask.DescriptionListAltRep[0];
75         }
77         if (TestTask.DescriptionListLanguage.begin() != TestTask.DescriptionListLanguage.end()){
78                 DescriptionLanguage = TestTask.DescriptionListLanguage[0];
79         }
81         if (TestTask.DescriptionListTokens.begin() != TestTask.DescriptionListTokens.end()){
82                 DescriptionTokens = TestTask.DescriptionListTokens[0];
83         }
84         
85         ASSERT_EQ("This is a description of the todo.", DescriptionData);
86         ASSERT_EQ("null:nodata", DescriptionAltRep);
87         ASSERT_EQ("kw", DescriptionLanguage);
88         ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", DescriptionTokens);
89         
90         // Tests for DTSTART.
91         
92         ASSERT_EQ("20160131T103000Z", TestTask.DateTimeStartData);
93         ASSERT_EQ("DATE-TIME", TestTask.DateTimeStartDataValue);
94         ASSERT_EQ("Europe/Truro", TestTask.DateTimeStartDataTimeZoneID);
95         ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestTask.DateTimeStartDataTokens);
96         
97         // Tests for GEO.
98         
99         ASSERT_EQ("20.0;20.0", TestTask.GeographicData);
100         ASSERT_EQ("EXAMPLE=MOOP", TestTask.GeographicTokens);
101         
102         // Tests for LAST-MODIFIED.
103         
104         ASSERT_EQ("20160131T114200Z", TestTask.LastModifiedData);
105         ASSERT_EQ("FUTURE=EVEN", TestTask.LastModifiedTokens);
106         
107         // Tests for LOCATION.
109         ASSERT_EQ("The Crystal Ceiling, Truro", TestTask.LocationData);
110         ASSERT_EQ("null:nodata", TestTask.LocationDataAltRep);
111         ASSERT_EQ("kw", TestTask.LocationDataLanguage);
112         ASSERT_EQ("EXACT=YES", TestTask.LocationDataTokens);
113         
114         // Tests for ORGANIZER.
115         
116         ASSERT_EQ("mailto:organiser@example.com", TestTask.OrganiserData);
117         ASSERT_EQ("ExampleOrganiser", TestTask.OrganiserDataCommonName);
118         ASSERT_EQ("null:nodata", TestTask.OrganiserDataDirectoryEntry);
119         ASSERT_EQ("mailto:organiser.noreply@example.com", TestTask.OrganiserDataSentByParam);
120         ASSERT_EQ("kw", TestTask.OrganiserDataLanguage);
121         ASSERT_EQ("HAPPY=WEEKS", TestTask.OrganiserDataTokens);
122         
123         // Tests for PERCENT-COMPLETE.
124         
125         ASSERT_EQ("42", TestTask.PercentCompleteData);
126         ASSERT_EQ("DEEP=THOUGHT", TestTask.PercentCompleteTokens);
127         
128         // Tests for PRIORITY.
129         
130         ASSERT_EQ(5, TestTask.PriorityData);
131         ASSERT_EQ("STATUS=DEFAULT", TestTask.PriorityTokens);
132         
133         // Tests for RECURRENCE-ID.
134         
135         ASSERT_EQ("20160131", TestTask.RecurranceIDData);
136         ASSERT_EQ("Europe/Truro", TestTask.RecurranceIDDataTimeZoneParam);
137         ASSERT_EQ("THISANDFUTURE", TestTask.RecurranceIDDataRangeParam);
138         ASSERT_EQ("DATE", TestTask.RecurranceIDDataValue);
139         ASSERT_EQ("EXAMPLE=DATA", TestTask.RecurranceIDDataTokens);
140         
141         // Tests for SEQUENCE.
142         
143         ASSERT_EQ(3, TestTask.SequenceData);
144         ASSERT_EQ("TEST=YAY", TestTask.SequenceTokens);
145         
146         // Tests for STATUS.
147         
148         ASSERT_EQ("2.0;Success", TestTask.StatusData);
149         ASSERT_EQ("kw", TestTask.StatusLanguage);
150         ASSERT_EQ("FAVOURITE=BEANS;NOTLIKE=UNKNOWN", TestTask.StatusTokens);
151         
152         // Tests for SUMMARY.
153         
154         ASSERT_EQ("A summary of the todo.", TestTask.SummaryData);
155         ASSERT_EQ("null:nodata", TestTask.SummaryDataAltRep);
156         ASSERT_EQ("kw", TestTask.SummaryDataLanguage);
157         ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", TestTask.SummaryDataTokens);
158         
159         // Tests for URL.
161         ASSERT_EQ("http://www.example.com/", TestTask.URLData);
162         ASSERT_EQ("EXTERNAL=YES", TestTask.URLDataTokens);
163         
164         // Tests for RRULE.
165         
166         ASSERT_EQ("FREQ=DAILY;COUNT=10", TestTask.RecurranceRuleData);
167         ASSERT_EQ("TEST=DATA", TestTask.RecurranceRuleDataTokens);
168         
169         // Tests for DUE.
170         
171         ASSERT_EQ("20160131T150000Z", TestTask.DueData);
172         ASSERT_EQ("Europe/Truro", TestTask.DueDataTimeZoneID);
173         ASSERT_EQ("DATE-TIME", TestTask.DueDataValue);
174         ASSERT_EQ("TEST=YES", TestTask.DueDataTokens);
175         
176         // Tests for DURATION.
177         
178         CalendarTaskObject TestTask2;
179         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask2.LoadFile("iCalendarTask-Load3.vcf"));
180         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask2.ValidBaseObject());
181         
182         ASSERT_EQ("PT15M", TestTask2.DurationData);
183         ASSERT_EQ("TEST=YES", TestTask2.DurationDataTokens);
184         
185         // Tests for ATTACH. First ATTACH property.
187         std::string AttachData;
188         std::string AttachDataFormatType;
189         std::string AttachDataValue;
190         std::string AttachDataEncoding;
191         std::string AttachDataTokens;
193         if (TestTask.AttachList.begin() != TestTask.AttachList.end()){
194                 
195                 AttachData = TestTask.AttachList[0];
196                 
197         }
198         
199         if (TestTask.AttachListFormatType.begin() != TestTask.AttachListFormatType.end()){
200                 
201                 AttachDataFormatType = TestTask.AttachListFormatType[0];
202                 
203         }
205         ASSERT_EQ("http://www.example.com/", AttachData);
206         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
207         
208         // Second ATTACH property.
209         
210         AttachData.clear();
211         AttachDataFormatType.clear();
212         AttachDataValue.clear();
213         AttachDataEncoding.clear();
214         
215         if (TestTask.AttachList.size() > 1){
216                 
217                 AttachData = TestTask.AttachList[1];
218                 
219         }
220         
221         if (TestTask.AttachListFormatType.size() > 1){
222                 
223                 AttachDataFormatType = TestTask.AttachListFormatType[1];
224                 
225         }
227         ASSERT_EQ("http://www.example.com/page2.html", AttachData);
228         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
229         
230         // Third ATTACH property.
232         AttachData.clear();
233         AttachDataFormatType.clear();
234         AttachDataValue.clear();
235         AttachDataEncoding.clear();
236         AttachDataTokens.clear();
237         
238         if (TestTask.AttachList.size() > 2){
239                 
240                 AttachData = TestTask.AttachList[2];
241                 
242         }
243         
244         if (TestTask.AttachListFormatType.size() > 2){
245                 
246                 AttachDataFormatType = TestTask.AttachListFormatType[2];
247                 
248         }
249         
250         if (TestTask.AttachListValue.size() > 2){
251                 
252                 AttachDataValue = TestTask.AttachListValue[2];
253                 
254         }
255         
256         if (TestTask.AttachListFormatType.size() > 2){
257                 
258                 AttachDataEncoding = TestTask.AttachListEncoding[2];
259                 
260         }
262         if (TestTask.AttachListTokens.size() > 2){
263                 
264                 AttachDataTokens = TestTask.AttachListTokens[2];
265                 
266         }
267         
268         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
269         ASSERT_EQ("text/plain", AttachDataFormatType);
270         ASSERT_EQ("BASE64", AttachDataEncoding);
271         ASSERT_EQ("BINARY", AttachDataValue);
272         ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
273         
274         // Tests for ATTENDEE. First ATTENDEE property.
276         std::string AttendeeDataMember;
277         std::string AttendeeDataDelegatedFrom;
278         std::string AttendeeDataDelegatedTo;
279         std::string AttendeeDataRole;
280         std::string AttendeeDataRSVP;
281         std::string AttendeeDataDirectoryEntry;
282         std::string AttendeeDataSentBy;
283         std::string AttendeeDataCommonName;
284         std::string AttendeeDataCalendarUserType;
285         std::string AttendeeDataParticipationStatus;
286         std::string AttendeeDataLanguage;
287         std::string AttendeeDataTokens;
288         std::string AttendeeData;
290         if (TestTask.AttendeeList.begin() != TestTask.AttendeeList.end()){
291                 
292                 AttendeeData = TestTask.AttendeeList[0];
293                 
294         }
295         
296         ASSERT_EQ("Attendee One", AttendeeData);
297         
298         // Second ATTENDEE property.
299         
300         AttendeeData.clear();
301         
302         if (TestTask.AttendeeList.size() > 1){
303                 
304                 AttendeeData = TestTask.AttendeeList[1];
305                 
306         }
308         if (TestTask.AttendeeList.size() > 1){
309                 
310                 AttendeeDataDelegatedFrom = TestTask.AttendeeListDelegatedFrom[1];
311                 
312         }
313         
314         if (TestTask.AttendeeList.size() > 1){
315                 
316                 AttendeeDataDelegatedTo = TestTask.AttendeeListDelegatedTo[1];
317                 
318         }
320         if (TestTask.AttendeeList.size() > 1){
321                 
322                 AttendeeDataRole = TestTask.AttendeeListRole[1];
323                 
324         }
325         
326         if (TestTask.AttendeeList.size() > 1){
327                 
328                 AttendeeDataRSVP = TestTask.AttendeeListRSVP[1];
329                 
330         }
331         
332         ASSERT_EQ("Attendee Two", AttendeeData);
333         ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom);
334         ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo);
335         ASSERT_EQ("CHAIR", AttendeeDataRole);
336         ASSERT_EQ("TRUE", AttendeeDataRSVP);
338         // Third ATTENDEE property.
339         
340         AttendeeData.clear();
341         
342         if (TestTask.AttendeeList.size() > 2){
343                 
344                 AttendeeData = TestTask.AttendeeList[2];
345                 
346         }
348         if (TestTask.AttendeeList.size() > 2){
349                 
350                 AttendeeDataDirectoryEntry = TestTask.AttendeeListDirectoryEntry[2];
351                 
352         }
353         
354         if (TestTask.AttendeeList.size() > 2){
355                 
356                 AttendeeDataSentBy = TestTask.AttendeeListSentBy[2];
357                 
358         }
360         if (TestTask.AttendeeList.size() > 2){
361                 
362                 AttendeeDataCommonName = TestTask.AttendeeListCommonName[2];
363                 
364         }
365         
366         if (TestTask.AttendeeList.size() > 2){
367                 
368                 AttendeeDataCalendarUserType = TestTask.AttendeeListCalendarUserType[2];
369                 
370         }
372         if (TestTask.AttendeeList.size() > 2){
373                 
374                 AttendeeDataParticipationStatus = TestTask.AttendeeListParticipationStatus[2];
375                 
376         }
378         if (TestTask.AttendeeList.size() > 2){
379                 
380                 AttendeeDataLanguage = TestTask.AttendeeListLanguage[2];
381                 
382         }
383         
384         if (TestTask.AttendeeList.size() > 2){
385                 
386                 AttendeeDataTokens = TestTask.AttendeeListTokens[2];
387                 
388         }
389         
390         ASSERT_EQ("Attendee Three", AttendeeData);
391         ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry);
392         ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy);
393         ASSERT_EQ("Attendee The Third", AttendeeDataCommonName);
394         ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType);
395         ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus);
396         ASSERT_EQ("kw", AttendeeDataLanguage);
397         ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens);
398         
399         // Get the first CATEGORIES.
400         
401         std::string CategoryData;
402         
403         if (TestTask.CategoriesList.begin() != TestTask.CategoriesList.end()){
404                 
405                 CategoryData = TestTask.CategoriesList[0];
406                 
407         }
408         
409         ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData);
410         
411         CategoryData.clear();
413         std::string CategoryLanguage;
414         
415         // Get the second CATEGORIES.
416         
417         if (TestTask.CategoriesList.size() > 1){
418                 
419                 CategoryData = TestTask.CategoriesList[1];
420                 
421         }
422         
423         if (TestTask.CategoriesList.size() > 1){
424                 
425                 CategoryLanguage = TestTask.CategoriesListLanguage[1];
426                 
427         }
428                 
429         ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData);
430         ASSERT_EQ("en", CategoryLanguage);
431         
432         CategoryData.clear();
433         CategoryLanguage.clear();
434         
435         // Get the third CATEGORIES.
436         
437         std::string CategoryTokens;
438         
439         if (TestTask.CategoriesList.size() > 2){
440                 
441                 CategoryData = TestTask.CategoriesList[2];
442                 
443         }
444         
445         if (TestTask.CategoriesList.size() > 2){
446                 
447                 CategoryLanguage = TestTask.CategoriesListLanguage[2];
448                 
449         }
450         
451         if (TestTask.CategoriesList.size() > 2){
452                 
453                 CategoryTokens = TestTask.CategoriesListTokens[2];
454                 
455         }
456                 
457         ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData);
458         ASSERT_EQ("en-GB", CategoryLanguage);
459         ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens);
460         
461         // Get the first COMMENT.
462         
463         std::string CommentData;
464         
465         if (TestTask.CommentList.begin() != TestTask.CommentList.end()){
466                 
467                 CommentData = TestTask.CommentList[0];
468                 
469         }
470         
471         ASSERT_EQ("This is the first comment.", CommentData);
472         
473         // Get the second COMMENT.
474         
475         CommentData.clear();
476         
477         std::string CommentDataAltRep;
478         std::string CommentDataLanguage;
479         
480         if (TestTask.CommentList.size() > 1){
481                 
482                 CommentData = TestTask.CommentList[1];
483                 
484         }
485         
486         if (TestTask.CommentList.size() > 1){
487                 
488                 CommentDataAltRep = TestTask.CommentListAltRep[1];
489                 
490         }
491         
492         if (TestTask.CommentList.size() > 1){
493                 
494                 CommentDataLanguage = TestTask.CommentListLanguage[1];
495                 
496         }
497         
498         ASSERT_EQ("This is the second comment.", CommentData);
499         ASSERT_EQ("null:nodata", CommentDataAltRep);
500         ASSERT_EQ("en", CommentDataLanguage);
501         
502         // Get the third COMMENT.
503         
504         CommentData.clear();
505         
506         std::string CommentDataTokens;
507         
508         if (TestTask.CommentList.size() > 2){
509                 
510                 CommentData = TestTask.CommentList[2];
511                 
512         }
513         
514         if (TestTask.CommentList.size() > 2){
515                 
516                 CommentDataTokens = TestTask.CommentListTokens[2];
517                 
518         }
519         
520         ASSERT_EQ("This is the third comment.", CommentData);
521         ASSERT_EQ("ZEBRAS=YES", CommentDataTokens);
523         // Get the first CONTACT.
524         
525         std::string ContactData;
526         
527         if (TestTask.ContactList.begin() != TestTask.ContactList.end()){
528                 
529                 ContactData = TestTask.ContactList[0];
530                 
531         }
532         
533         ASSERT_EQ("First Contact", ContactData);
534         
535         // Get the second CONTACT.
536         
537         ContactData.clear();
538         
539         std::string ContactDataAltRep;
540         std::string ContactDataLanguage;
541         
542         if (TestTask.ContactList.size() > 1){
543                 
544                 ContactData = TestTask.ContactList[1];
545                 
546         }
547         
548         if (TestTask.ContactList.size() > 1){
549                 
550                 ContactDataAltRep = TestTask.ContactListAltRep[1];
551                 
552         }
553         
554         if (TestTask.ContactList.size() > 1){
555                 
556                 ContactDataLanguage = TestTask.ContactListLanguage[1];
557                 
558         }
559         
560         ASSERT_EQ("Second Contact", ContactData);
561         ASSERT_EQ("null:nodata", ContactDataAltRep);
562         ASSERT_EQ("en-GB", ContactDataLanguage);
563         
564         // Get the third CONTACT.
565         
566         ContactData.clear();
567         
568         std::string ContactDataTokens;
569         
570         if (TestTask.ContactList.size() > 2){
571                 
572                 ContactData = TestTask.ContactList[2];
573                 
574         }
575         
576         if (TestTask.ContactList.size() > 2){
577                 
578                 ContactDataTokens = TestTask.ContactListTokens[2];
579                 
580         }
581         
582         ASSERT_EQ("Third Contact", ContactData);
583         ASSERT_EQ("ZEBRAS=NO", ContactDataTokens);
585         // Get the first EXDATE.
586         
587         std::string ExcludeDate;
588         
589         if (TestTask.ExcludeDateData.begin() != TestTask.ExcludeDateData.end()){
590                 
591                 ExcludeDate = TestTask.ExcludeDateData[0];
592                 
593         }
594         
595         ASSERT_EQ("20160125T120000Z", ExcludeDate);
596         
597         // Get the second EXDATE.
599         ExcludeDate.clear();
600         
601         std::string ExcludeDataTimeZoneParam;
602         std::string ExcludeDataValue;
603         
604         if (TestTask.ContactList.size() > 1){
605                 
606                 ExcludeDate = TestTask.ExcludeDateData[1];
607                 
608         }
609         
610         if (TestTask.ContactList.size() > 1){
611                 
612                 ExcludeDataTimeZoneParam = TestTask.ExcludeDateDataTimeZoneParam[1];
613                 
614         }
615         
616         if (TestTask.ContactList.size() > 1){
617                 
618                 ExcludeDataValue = TestTask.ExcludeDateDataValue[1];
619                 
620         }
621         
622         ASSERT_EQ("20160125T130000Z", ExcludeDate);
623         ASSERT_EQ("DATE-TIME", ExcludeDataValue);
624         ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam);
625         
626         // Get the third EXDATE.
627         
628         ExcludeDate.clear();
629         
630         std::string ExcludeDataTokens;
631         
632         if (TestTask.ContactList.size() > 2){
633                 
634                 ExcludeDate = TestTask.ExcludeDateData[2];
635                 
636         }
637         
638         if (TestTask.ContactList.size() > 2){
639                 
640                 ExcludeDataTokens = TestTask.ExcludeDateDataTokens[2];
641                 
642         }
643         
644         ASSERT_EQ("20160125T133000Z", ExcludeDate);
645         ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens);
646         
647         // Get the first REQUEST-STATUS.
649         std::string RequestStatus;
650         
651         if (TestTask.RequestStatusData.begin() != TestTask.RequestStatusData.end()){
652                 
653                 RequestStatus = TestTask.RequestStatusData[0];
654                 
655         }
656         
657         ASSERT_EQ("2.0;Success", RequestStatus);
658         
659         // Get the second REQUEST-STATUS.
660         
661         RequestStatus.clear();
662         
663         std::string RequestLanguage;
664         
665         if (TestTask.ContactList.size() > 1){
666                 
667                 RequestStatus = TestTask.RequestStatusData[1];
668                 
669         }
670         
671         if (TestTask.ContactList.size() > 1){
672                 
673                 RequestLanguage = TestTask.RequestStatusLanguage[1];
674                 
675         }
676         
677         ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus);
678         ASSERT_EQ("en", RequestLanguage);
679         
680         // Get the third REQUEST-STATUS.
681         
682         RequestStatus.clear();
683         
684         std::string RequestTokens;
685         
686         if (TestTask.ContactList.size() > 2){
687                 
688                 RequestStatus = TestTask.RequestStatusData[2];
689                 
690         }
691         
692         if (TestTask.ContactList.size() > 2){
693                 
694                 RequestTokens = TestTask.RequestStatusTokens[2];
695                 
696         }
697         
698         ASSERT_EQ("3.7;Invalid calendar user", RequestStatus);
699         ASSERT_EQ("USER=MISSING", RequestTokens);
700         
701         // Get the first RELATED-TO.
702         
703         std::string RelatedTo;
704         
705         if (TestTask.RelatedToData.begin() != TestTask.RelatedToData.end()){
706                 
707                 RelatedTo = TestTask.RelatedToData[0];
708                 
709         }
710         
711         ASSERT_EQ("person.1@example.com", RelatedTo);
712         
713         // Get the second RELATED-TO.
714         
715         RelatedTo.clear();
716         
717         std::string RelatedToType;
718         
719         if (TestTask.RelatedToData.size() > 1){
720                 
721                 RelatedTo = TestTask.RelatedToData[1];
722                 
723         }
724         
725         if (TestTask.RelatedToData.size() > 1){
726                 
727                 RelatedToType = TestTask.RelatedToDataRelationType[1];
728                 
729         }
730         
731         ASSERT_EQ("person.2@example.com", RelatedTo);
732         ASSERT_EQ("PARENT", RelatedToType);
733         
734         // Get the third RELATED-TO.
735         
736         RelatedTo.clear();
737         
738         std::string RelatedToTokens;
739         
740         if (TestTask.RelatedToData.size() > 2){
741                 
742                 RelatedTo = TestTask.RelatedToData[2];
743                 
744         }
745         
746         if (TestTask.RelatedToData.size() > 2){
747                 
748                 RelatedToTokens = TestTask.RelatedToDataTokens[2];
749                 
750         }
751         
752         ASSERT_EQ("person.3@example.com", RelatedTo);
753         ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens);
754         
755         // Get the first RESOURCES.
757         std::string Resources;
758         
759         if (TestTask.ResourcesData.begin() != TestTask.ResourcesData.end()){
760                 
761                 Resources = TestTask.ResourcesData[0];
762                 
763         }
764         
765         ASSERT_EQ("DMAC RECEIVER", Resources);
766         
767         // Get the second RESOURCES.
768         
769         Resources.clear();
770         
771         std::string ResourcesLanguage;
772         
773         if (TestTask.ResourcesData.size() > 1){
774                 
775                 Resources = TestTask.ResourcesData[1];
776                 
777         }
778         
779         if (TestTask.ResourcesData.size() > 1){
780                 
781                 ResourcesLanguage = TestTask.ResourcesDataLanguage[1];
782                 
783         }
784         
785         ASSERT_EQ("PAL-I TELEVISION SET", Resources);
786         ASSERT_EQ("en", ResourcesLanguage);
787         
788         // Get the third RESOURCES.
789         
790         Resources.clear();
791         
792         std::string ResourcesAltRep;
793         std::string ResourcesTokens;
794         
795         if (TestTask.ResourcesData.size() > 2){
796                 
797                 Resources = TestTask.ResourcesData[2];
798                 
799         }
800                 
801         if (TestTask.ResourcesData.size() > 2){
802                 
803                 ResourcesAltRep = TestTask.ResourcesDataAltRep[2];
804                 
805         }
806         
807         if (TestTask.ResourcesData.size() > 2){
808                 
809                 ResourcesTokens = TestTask.ResourcesDataTokens[2];
810                 
811         }
812         
813         ASSERT_EQ("PAL/SECAM VCR", Resources);
814         ASSERT_EQ("null:nodata", ResourcesAltRep);
815         ASSERT_EQ("STATUS=BROKEN", ResourcesTokens);
816         
817         // Get the first RDATE.
819         std::string RecurrenceDate;
820         
821         if (TestTask.RecurranceDateData.begin() != TestTask.RecurranceDateData.end()){
822                 
823                 RecurrenceDate = TestTask.RecurranceDateData[0];
824                 
825         }
826         
827         ASSERT_EQ("20160120", RecurrenceDate);
828         
829         // Get the second RDATE.
830         
831         RecurrenceDate.clear();
832         
833         std::string RecurrenceDateTimeZoneParam;
834         std::string RecurrenceDateValue;
835         
836         if (TestTask.RecurranceDateData.size() > 1){
837                 
838                 RecurrenceDate = TestTask.RecurranceDateData[1];
839                 
840         }
841         
842         if (TestTask.RecurranceDateData.size() > 1){
843                 
844                 RecurrenceDateTimeZoneParam = TestTask.RecurranceDateDataTimeZoneParam[1];
845                 
846         }
847         
848         if (TestTask.RecurranceDateData.size() > 1){
849                 
850                 RecurrenceDateValue = TestTask.RecurranceDateDataValue[1];
851                 
852         }
853         
854         ASSERT_EQ("20160121", RecurrenceDate);
855         ASSERT_EQ("DATE", RecurrenceDateValue);
856         ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam);
857         
858         // Get the third RDATE.
859         
860         RecurrenceDate.clear();
861         
862         std::string RecurrenceTokens;
863         
864         if (TestTask.RecurranceDateData.size() > 2){
865                 
866                 RecurrenceDate = TestTask.RecurranceDateData[2];
867                 
868         }
869         
870         if (TestTask.RecurranceDateData.size() > 2){
871                 
872                 RecurrenceTokens = TestTask.RecurranceDateDataTokens[2];
873                 
874         }
875         
876         ASSERT_EQ("20160520", RecurrenceDate);
877         ASSERT_EQ("ZILCH=DATA", RecurrenceTokens);
878         
879         // Get the first X-EXAMPLE1 token.
880         
881         std::string XTokenName;
882         std::string XTokenData;
883         
884         if (TestTask.XTokensData.size() != 0 ){
885         
886                 XTokenData = TestTask.XTokensData[0];
887                 
888         }
890         if (TestTask.XTokensData.size() != 0){
891         
892                 XTokenName = TestTask.XTokensDataTokens[0];
893                 
894         }
895         
896         ASSERT_EQ("Moo", XTokenData);
897         ASSERT_EQ("X-EXAMPLE1", XTokenName);
898         
899         // Get the second X-EXAMPLE1 token.
901         XTokenName.clear();
902         XTokenData.clear();
903         
904         if (TestTask.XTokensData.size() > 1){
905         
906                 XTokenData = TestTask.XTokensData[1];
907                 
908         }
910         if (TestTask.XTokensData.size() > 1){
911         
912                 XTokenName = TestTask.XTokensDataTokens[1];
913                 
914         }
915         
916         ASSERT_EQ("Meep", XTokenData);
917         ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName);
918         
919         // Get the third X-EXAMPLE1 token.
921         XTokenName.clear();
922         XTokenData.clear();
923         
924         if (TestTask.XTokensData.size() > 2){
925         
926                 XTokenData = TestTask.XTokensData[2];
927                 
928         }
930         if (TestTask.XTokensData.size() > 2){
931         
932                 XTokenName = TestTask.XTokensDataTokens[2];
933                 
934         }
935         
936         ASSERT_EQ("Meow", XTokenData);
937         ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName);
938         
939         // Get the first X-EXAMPLE2 token.
940         
941         XTokenName.clear();
942         XTokenData.clear();
943         
944         if (TestTask.XTokensData.size() > 3){
945         
946                 XTokenData = TestTask.XTokensData[3];
947                 
948         }
950         if (TestTask.XTokensData.size() > 3){
951         
952                 XTokenName = TestTask.XTokensDataTokens[3];
953                 
954         }
955         
956         ASSERT_EQ("Dish", XTokenData);
957         ASSERT_EQ("X-EXAMPLE2", XTokenName);
958         
959         // Get the second X-EXAMPLE2 token.
960         
961         XTokenName.clear();
962         XTokenData.clear();
963         
964         if (TestTask.XTokensData.size() > 4){
965         
966                 XTokenData = TestTask.XTokensData[4];
967                 
968         }
970         if (TestTask.XTokensData.size() > 4){
971         
972                 XTokenName = TestTask.XTokensDataTokens[4];
973                 
974         }
975         
976         ASSERT_EQ("Fork", XTokenData);
977         ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName);
978         
979         // Get the third X-EXAMPLE2 token.
980         
981         XTokenName.clear();
982         XTokenData.clear();
983         
984         if (TestTask.XTokensData.size() > 5){
985         
986                 XTokenData = TestTask.XTokensData[5];
987                 
988         }
990         if (TestTask.XTokensData.size() > 5){
991         
992                 XTokenName = TestTask.XTokensDataTokens[5];
993                 
994         }
995         
996         ASSERT_EQ("Table", XTokenData);
997         ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName);
998         
999         // Get the X-STATUS token.
1000         
1001         XTokenName.clear();
1002         XTokenData.clear();
1003         
1004         if (TestTask.XTokensData.size() > 6){
1005         
1006                 XTokenData = TestTask.XTokensData[6];
1007                 
1008         }
1010         if (TestTask.XTokensData.size() > 6){
1011         
1012                 XTokenName = TestTask.XTokensDataTokens[6];
1013                 
1014         }
1015         
1016         ASSERT_EQ("Idle", XTokenData);
1017         ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName);
1018         
1019         // Get the X-TRANSPORT token.
1020         
1021         XTokenName.clear();
1022         XTokenData.clear();
1023         
1024         if (TestTask.XTokensData.size() > 7){
1025         
1026                 XTokenData = TestTask.XTokensData[7];
1027                 
1028         }
1030         if (TestTask.XTokensData.size() > 7){
1031         
1032                 XTokenName = TestTask.XTokensDataTokens[7];
1033                 
1034         }
1035         
1036         ASSERT_EQ("Private Hire", XTokenData);
1037         ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName);
1038         
1039         // Get the X-PHANTOM-STATUS token.
1040         
1041         XTokenName.clear();
1042         XTokenData.clear();
1043         
1044         if (TestTask.XTokensData.size() > 8){
1045         
1046                 XTokenData = TestTask.XTokensData[8];
1047                 
1048         }
1050         if (TestTask.XTokensData.size() > 8){
1051         
1052                 XTokenName = TestTask.XTokensDataTokens[8];
1053                 
1054         }
1055         
1056         ASSERT_EQ("None", XTokenData);
1057         ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName);
1058         
1061 TEST(iCalendarTask, AlarmTests){
1063         CalendarTaskObject TestTask;
1064         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load2.vcf"));
1065         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
1066         
1067         // Tests for the first VALARM property.
1068         
1069         std::string ActionData;
1070         std::string ActionDataTokens;
1071         
1072         std::string TriggerData;
1073         std::string TriggerRelated;
1074         std::string TriggerValue;
1075         std::string TriggerTokens;
1076         
1077         std::string DurationData;
1078         std::string DurationTokens;
1079         
1080         std::string RepeatData;
1081         std::string RepeatTokens;
1082         
1083         std::string XTokenData;
1084         std::string XTokenName;
1085         
1086         if (TestTask.CalendarAlarmData.size() > 0){
1087         
1088                 ActionData = TestTask.CalendarAlarmData[0].AlarmAction;
1089                 ActionDataTokens = TestTask.CalendarAlarmData[0].AlarmActionTokens;
1090                 
1091                 TriggerData = TestTask.CalendarAlarmData[0].TriggerData;
1092                 TriggerRelated = TestTask.CalendarAlarmData[0].TriggerRelated;
1093                 TriggerValue = TestTask.CalendarAlarmData[0].TriggerValue;
1094                 TriggerTokens = TestTask.CalendarAlarmData[0].TriggerTokens;
1095                 
1096                 DurationData = TestTask.CalendarAlarmData[0].DurationData;
1097                 DurationTokens = TestTask.CalendarAlarmData[0].DurationTokens;
1098                 
1099                 RepeatData = TestTask.CalendarAlarmData[0].RepeatData;
1100                 RepeatTokens = TestTask.CalendarAlarmData[0].RepeatTokens;
1101                 
1102         }
1103         
1104         ASSERT_EQ("AUDIO", ActionData);
1105         ASSERT_EQ("FUNKY=SOUNDS", ActionDataTokens);
1106         
1107         ASSERT_EQ("20160220T160000Z", TriggerData);
1108         ASSERT_EQ("END", TriggerRelated);
1109         ASSERT_EQ("DATE-TIME", TriggerValue);
1110         ASSERT_EQ("PUSH=BUTTON", TriggerTokens);
1112         ASSERT_EQ("PT5H", DurationData);
1113         ASSERT_EQ("FLYING=NO", DurationTokens);
1115         ASSERT_EQ("PT5M", RepeatData);
1116         ASSERT_EQ("NEVER=SLEEP", RepeatTokens);
1117         
1118         // Tests for ATTACH. First ATTACH property.
1120         std::string AttachData;
1121         std::string AttachDataFormatType;
1122         std::string AttachDataValue;
1123         std::string AttachDataEncoding;
1124         std::string AttachDataTokens;
1126         if (TestTask.CalendarAlarmData[0].AttachList.begin() != TestTask.CalendarAlarmData[0].AttachList.end()){
1127                 
1128                 AttachData = TestTask.AttachList[0];
1129                 
1130         }
1131         
1132         if (TestTask.CalendarAlarmData[0].AttachListFormatType.begin() != TestTask.CalendarAlarmData[0].AttachListFormatType.end()){
1133                 
1134                 AttachDataFormatType = TestTask.AttachListFormatType[0];
1135                 
1136         }
1138         ASSERT_EQ("http://www.example.com/", AttachData);
1139         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1140         
1141         // Second ATTACH property.
1142         
1143         AttachData.clear();
1144         AttachDataFormatType.clear();
1145         AttachDataValue.clear();
1146         AttachDataEncoding.clear();
1147         
1148         if (TestTask.CalendarAlarmData[0].AttachList.size() > 1){
1149                 
1150                 AttachData = TestTask.CalendarAlarmData[0].AttachList[1];
1151                 
1152         }
1153         
1154         if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 1){
1155                 
1156                 AttachDataFormatType = TestTask.CalendarAlarmData[0].AttachListFormatType[1];
1157                 
1158         }
1160         ASSERT_EQ("http://www.example.com/page2.html", AttachData);
1161         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1162         
1163         // Third ATTACH property.
1165         AttachData.clear();
1166         AttachDataFormatType.clear();
1167         AttachDataValue.clear();
1168         AttachDataEncoding.clear();
1169         AttachDataTokens.clear();
1170         
1171         if (TestTask.CalendarAlarmData[0].AttachList.size() > 2){
1172                 
1173                 AttachData = TestTask.CalendarAlarmData[0].AttachList[2];
1174                 
1175         }
1176         
1177         if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 2){
1178                 
1179                 AttachDataFormatType = TestTask.CalendarAlarmData[0].AttachListFormatType[2];
1180                 
1181         }
1182         
1183         if (TestTask.CalendarAlarmData[0].AttachListValue.size() > 2){
1184                 
1185                 AttachDataValue = TestTask.CalendarAlarmData[0].AttachListValue[2];
1186                 
1187         }
1188         
1189         if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 2){
1190                 
1191                 AttachDataEncoding = TestTask.CalendarAlarmData[0].AttachListEncoding[2];
1192                 
1193         }
1195         if (TestTask.CalendarAlarmData[0].AttachListTokens.size() > 2){
1196                 
1197                 AttachDataTokens = TestTask.CalendarAlarmData[0].AttachListTokens[2];
1198                 
1199         }
1200         
1201         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
1202         ASSERT_EQ("text/plain", AttachDataFormatType);
1203         ASSERT_EQ("BASE64", AttachDataEncoding);
1204         ASSERT_EQ("BINARY", AttachDataValue);
1205         ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
1206         
1207         // Test the first X-Token.
1208         
1209         if (TestTask.CalendarAlarmData[0].XTokensData.size() > 0){
1210                 
1211                 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[0];
1212                 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[0];
1213                 
1214         }
1215         
1216         ASSERT_EQ("Example Data 1", XTokenData);
1217         ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1218         
1219         // Test the second X-Token.
1220         
1221         XTokenData.clear();
1222         XTokenName.clear();
1223         
1224         if (TestTask.CalendarAlarmData[0].XTokensData.size() > 1){
1225                 
1226                 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[1];
1227                 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[1];
1228                 
1229         }
1230         
1231         ASSERT_EQ("Example Data 2", XTokenData);
1232         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1233         
1234         // Test the third X-Token.
1236         XTokenData.clear();
1237         XTokenName.clear();
1238         
1239         if (TestTask.CalendarAlarmData[0].XTokensData.size() > 2){
1240                 
1241                 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[2];
1242                 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[2];
1243                 
1244         }
1245         
1246         ASSERT_EQ("Example Data 3", XTokenData);
1247         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
1248         
1249         // Tests for the second VALARM property.
1250         
1251         ActionData.clear();
1252         ActionDataTokens.clear();
1253         
1254         TriggerData.clear();
1255         TriggerRelated.clear();
1256         TriggerValue.clear();
1257         TriggerTokens.clear();
1258         
1259         DurationData.clear();
1260         DurationTokens.clear();
1261         
1262         RepeatData.clear();
1263         RepeatTokens.clear();
1264         
1265         XTokenData.clear();
1266         XTokenName.clear();
1267         
1268         string DescriptionData;
1269         string DescriptionAltRep;
1270         string DescriptionLanguage;
1271         string DescriptionTokens;
1272         
1273         if (TestTask.CalendarAlarmData.size() > 1){
1274                 
1275                 ActionData = TestTask.CalendarAlarmData[1].AlarmAction;
1276                 ActionDataTokens = TestTask.CalendarAlarmData[1].AlarmActionTokens;
1277                 
1278                 TriggerData = TestTask.CalendarAlarmData[1].TriggerData;
1279                 TriggerRelated = TestTask.CalendarAlarmData[1].TriggerRelated;
1280                 TriggerValue = TestTask.CalendarAlarmData[1].TriggerValue;
1281                 TriggerTokens = TestTask.CalendarAlarmData[1].TriggerTokens;
1282                 
1283                 DurationData = TestTask.CalendarAlarmData[1].DurationData;
1284                 DurationTokens = TestTask.CalendarAlarmData[1].DurationTokens;
1285                 
1286                 RepeatData = TestTask.CalendarAlarmData[1].RepeatData;
1287                 RepeatTokens = TestTask.CalendarAlarmData[1].RepeatTokens;
1288                 
1289                 DescriptionData = TestTask.CalendarAlarmData[1].DescriptionData;
1290                 DescriptionAltRep = TestTask.CalendarAlarmData[1].DescriptionAltRep;
1291                 DescriptionLanguage = TestTask.CalendarAlarmData[1].DescriptionLanguage;
1292                 DescriptionTokens = TestTask.CalendarAlarmData[1].DescriptionTokens;
1293                 
1294         }
1295         
1296         ASSERT_EQ("DISPLAY", ActionData);
1297         ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
1298         
1299         ASSERT_EQ("20160230T110000Z", TriggerData);
1300         ASSERT_EQ("END", TriggerRelated);
1301         ASSERT_EQ("DATE-TIME", TriggerValue);
1302         ASSERT_EQ("PUSH=BUTTON", TriggerTokens);
1304         ASSERT_EQ("PT7H", DurationData);
1305         ASSERT_EQ("FLYING=YES", DurationTokens);
1307         ASSERT_EQ("PT3M", RepeatData);
1308         ASSERT_EQ("SLEEP=ALWAYS", RepeatTokens);
1309         
1310         ASSERT_EQ("This is the second alarm.", DescriptionData);
1311         ASSERT_EQ("null:nodata", DescriptionAltRep);
1312         ASSERT_EQ("kw", DescriptionLanguage);
1313         ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens);
1314         
1315         // Test the first X-Token.
1316         
1317         if (TestTask.CalendarAlarmData[1].XTokensData.size() > 0){
1318                 
1319                 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[0];
1320                 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[0];
1321                 
1322         }
1323         
1324         ASSERT_EQ("Example Data 1", XTokenData);
1325         ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1326         
1327         // Test the second X-Token.
1328         
1329         XTokenData.clear();
1330         XTokenName.clear();
1331         
1332         if (TestTask.CalendarAlarmData[1].XTokensData.size() > 1){
1333                 
1334                 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[1];
1335                 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[1];
1336                 
1337         }
1338         
1339         ASSERT_EQ("Example Data 2", XTokenData);
1340         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1341         
1342         // Test the third X-Token.
1344         XTokenData.clear();
1345         XTokenName.clear();
1346         
1347         if (TestTask.CalendarAlarmData[1].XTokensData.size() > 2){
1348                 
1349                 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[2];
1350                 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[2];
1351                 
1352         }
1353         
1354         ASSERT_EQ("Example Data 3", XTokenData);
1355         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
1356         
1357         // Tests for the third VALARM property.
1358         
1359         ActionData.clear();
1360         ActionDataTokens.clear();
1361         
1362         TriggerData.clear();
1363         TriggerRelated.clear();
1364         TriggerValue.clear();
1365         TriggerTokens.clear();
1366         
1367         DurationData.clear();
1368         DurationTokens.clear();
1369         
1370         RepeatData.clear();
1371         RepeatTokens.clear();
1372         
1373         XTokenData.clear();
1374         XTokenName.clear();
1375         
1376         DescriptionData.clear();
1377         DescriptionAltRep.clear();
1378         DescriptionLanguage.clear();
1379         DescriptionTokens.clear();
1381         string SummaryData;
1382         string SummaryAltRep;
1383         string SummaryLanguage;
1384         string SummaryTokens;
1385         
1386         string AttendeeDataMember;
1387         string AttendeeDataDelegatedFrom;
1388         string AttendeeDataDelegatedTo;
1389         string AttendeeDataRole;
1390         string AttendeeDataRSVP;
1391         string AttendeeDataDirectoryEntry;
1392         string AttendeeDataSentBy;
1393         string AttendeeDataCommonName;
1394         string AttendeeDataCalendarUserType;
1395         string AttendeeDataParticipationStatus;
1396         string AttendeeDataLanguage;
1397         string AttendeeDataTokens;
1398         string AttendeeData;
1399         
1400         AttachData.clear();
1401         AttachDataFormatType.clear();
1402         AttachDataValue.clear();
1403         AttachDataEncoding.clear();
1404         AttachDataTokens.clear();
1405         
1406         if (TestTask.CalendarAlarmData.size() > 2){
1407                 
1408                 ActionData = TestTask.CalendarAlarmData[2].AlarmAction;
1409                 ActionDataTokens = TestTask.CalendarAlarmData[2].AlarmActionTokens;
1410                 
1411                 TriggerData = TestTask.CalendarAlarmData[2].TriggerData;
1412                 TriggerRelated = TestTask.CalendarAlarmData[2].TriggerRelated;
1413                 TriggerValue = TestTask.CalendarAlarmData[2].TriggerValue;
1414                 TriggerTokens = TestTask.CalendarAlarmData[2].TriggerTokens;
1415                 
1416                 DurationData = TestTask.CalendarAlarmData[2].DurationData;
1417                 DurationTokens = TestTask.CalendarAlarmData[2].DurationTokens;
1418                 
1419                 RepeatData = TestTask.CalendarAlarmData[2].RepeatData;
1420                 RepeatTokens = TestTask.CalendarAlarmData[2].RepeatTokens;
1421                 
1422                 DescriptionData = TestTask.CalendarAlarmData[2].DescriptionData;
1423                 DescriptionAltRep = TestTask.CalendarAlarmData[2].DescriptionAltRep;
1424                 DescriptionLanguage = TestTask.CalendarAlarmData[2].DescriptionLanguage;
1425                 DescriptionTokens = TestTask.CalendarAlarmData[2].DescriptionTokens;
1426                 
1427                 SummaryData = TestTask.CalendarAlarmData[2].SummaryData;
1428                 SummaryAltRep = TestTask.CalendarAlarmData[2].SummaryAltRep;
1429                 SummaryLanguage = TestTask.CalendarAlarmData[2].SummaryLanguage;
1430                 SummaryTokens = TestTask.CalendarAlarmData[2].SummaryTokens;
1431                 
1432         }
1433         
1434         ASSERT_EQ("EMAIL", ActionData);
1435         ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
1436         
1437         ASSERT_EQ("20160230T120000Z", TriggerData);
1438         ASSERT_EQ("END", TriggerRelated);
1439         ASSERT_EQ("DATE-TIME", TriggerValue);
1440         ASSERT_EQ("PUSH=BUTTON", TriggerTokens);
1442         ASSERT_EQ("PT7H", DurationData);
1443         ASSERT_EQ("FLYING=YES", DurationTokens);
1445         ASSERT_EQ("PT3M", RepeatData);
1446         ASSERT_EQ("SLEEP=ALWAYS", RepeatTokens);
1447         
1448         ASSERT_EQ("This is the third alarm.", DescriptionData);
1449         ASSERT_EQ("null:nodata", DescriptionAltRep);
1450         ASSERT_EQ("kw", DescriptionLanguage);
1451         ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens);
1453         ASSERT_EQ("This is the summary of the third alarm.", SummaryData);
1454         ASSERT_EQ("null:nodata", SummaryAltRep);
1455         ASSERT_EQ("en", SummaryLanguage);
1456         ASSERT_EQ("MEEP=MOOP", SummaryTokens);
1458         // Tests for ATTENDEE. First ATTENDEE property.
1460         if (TestTask.CalendarAlarmData[2].AttendeeList.begin() != TestTask.CalendarAlarmData[2].AttendeeList.end()){
1461                 
1462                 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[0];
1463                 
1464         }
1465         
1466         ASSERT_EQ("Attendee One", AttendeeData);
1467         
1468         // Second ATTENDEE property.
1469         
1470         AttendeeData.clear();
1471         
1472         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1473                 
1474                 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[1];
1475                 
1476         }
1478         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1479                 
1480                 AttendeeDataDelegatedFrom = TestTask.CalendarAlarmData[2].AttendeeListDelegatedFrom[1];
1481                 
1482         }
1483         
1484         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1485                 
1486                 AttendeeDataDelegatedTo = TestTask.CalendarAlarmData[2].AttendeeListDelegatedTo[1];
1487                 
1488         }
1490         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1491                 
1492                 AttendeeDataRole = TestTask.CalendarAlarmData[2].AttendeeListRole[1];
1493                 
1494         }
1495         
1496         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1497                 
1498                 AttendeeDataRSVP = TestTask.CalendarAlarmData[2].AttendeeListRSVP[1];
1499                 
1500         }
1501         
1502         ASSERT_EQ("Attendee Two", AttendeeData);
1503         ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom);
1504         ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo);
1505         ASSERT_EQ("CHAIR", AttendeeDataRole);
1506         ASSERT_EQ("TRUE", AttendeeDataRSVP);
1508         // Third ATTENDEE property.
1509         
1510         AttendeeData.clear();
1511         
1512         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1513                 
1514                 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[2];
1515                 
1516         }
1518         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1519                 
1520                 AttendeeDataDirectoryEntry = TestTask.CalendarAlarmData[2].AttendeeListDirectoryEntry[2];
1521                 
1522         }
1523         
1524         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1525                 
1526                 AttendeeDataSentBy = TestTask.CalendarAlarmData[2].AttendeeListSentBy[2];
1527                 
1528         }
1530         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1531                 
1532                 AttendeeDataCommonName = TestTask.CalendarAlarmData[2].AttendeeListCommonName[2];
1533                 
1534         }
1535         
1536         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1537                 
1538                 AttendeeDataCalendarUserType = TestTask.CalendarAlarmData[2].AttendeeListCalendarUserType[2];
1539                 
1540         }
1542         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1543                 
1544                 AttendeeDataParticipationStatus = TestTask.CalendarAlarmData[2].AttendeeListParticipationStatus[2];
1545                 
1546         }
1548         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1549                 
1550                 AttendeeDataLanguage = TestTask.CalendarAlarmData[2].AttendeeListLanguage[2];
1551                 
1552         }
1553         
1554         if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1555                 
1556                 AttendeeDataTokens = TestTask.CalendarAlarmData[2].AttendeeListTokens[2];
1557                 
1558         }
1559         
1560         ASSERT_EQ("Attendee Three", AttendeeData);
1561         ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry);
1562         ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy);
1563         ASSERT_EQ("Attendee The Third", AttendeeDataCommonName);
1564         ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType);
1565         ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus);
1566         ASSERT_EQ("kw", AttendeeDataLanguage);
1567         ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens);
1569         // Tests for ATTACH. First ATTACH property.
1571         if (TestTask.CalendarAlarmData[2].AttachList.begin() != TestTask.CalendarAlarmData[2].AttachList.end()){
1572                 
1573                 AttachData = TestTask.CalendarAlarmData[2].AttachList[0];
1574                 
1575         }
1576         
1577         if (TestTask.CalendarAlarmData[2].AttachListFormatType.begin() != TestTask.CalendarAlarmData[2].AttachListFormatType.end()){
1578                 
1579                 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[0];
1580                 
1581         }
1583         ASSERT_EQ("http://www.example.com/", AttachData);
1584         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1585         
1586         // Second ATTACH property.
1587         
1588         AttachData.clear();
1589         AttachDataFormatType.clear();
1590         AttachDataValue.clear();
1591         AttachDataEncoding.clear();
1592         
1593         if (TestTask.CalendarAlarmData[2].AttachList.size() > 1){
1594                 
1595                 AttachData = TestTask.CalendarAlarmData[2].AttachList[1];
1596                 
1597         }
1598         
1599         if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 1){
1600                 
1601                 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[1];
1602                 
1603         }
1605         ASSERT_EQ("http://www.example.com/page2.html", AttachData);
1606         ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1607         
1608         // Third ATTACH property.
1610         AttachData.clear();
1611         AttachDataFormatType.clear();
1612         AttachDataValue.clear();
1613         AttachDataEncoding.clear();
1614         AttachDataTokens.clear();
1615         
1616         if (TestTask.CalendarAlarmData[2].AttachList.size() > 2){
1617                 
1618                 AttachData = TestTask.CalendarAlarmData[2].AttachList[2];
1619                 
1620         }
1621         
1622         if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 2){
1623                 
1624                 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[2];
1625                 
1626         }
1627         
1628         if (TestTask.CalendarAlarmData[2].AttachListValue.size() > 2){
1629                 
1630                 AttachDataValue = TestTask.CalendarAlarmData[2].AttachListValue[2];
1631                 
1632         }
1633         
1634         if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 2){
1635                 
1636                 AttachDataEncoding = TestTask.CalendarAlarmData[2].AttachListEncoding[2];
1637                 
1638         }
1640         if (TestTask.CalendarAlarmData[2].AttachListTokens.size() > 2){
1641                 
1642                 AttachDataTokens = TestTask.CalendarAlarmData[2].AttachListTokens[2];
1643                 
1644         }
1645         
1646         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
1647         ASSERT_EQ("text/plain", AttachDataFormatType);
1648         ASSERT_EQ("BASE64", AttachDataEncoding);
1649         ASSERT_EQ("BINARY", AttachDataValue);
1650         ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
1651         
1652         // Test the first X-Token.
1653         
1654         if (TestTask.CalendarAlarmData[2].XTokensData.size() > 0){
1655                 
1656                 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[0];
1657                 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[0];
1658                 
1659         }
1660         
1661         ASSERT_EQ("Example Data 1", XTokenData);
1662         ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1663         
1664         // Test the second X-Token.
1665         
1666         XTokenData.clear();
1667         XTokenName.clear();
1668         
1669         if (TestTask.CalendarAlarmData[2].XTokensData.size() > 1){
1670                 
1671                 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[1];
1672                 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[1];
1673                 
1674         }
1675         
1676         ASSERT_EQ("Example Data 2", XTokenData);
1677         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1678         
1679         // Test the third X-Token.
1681         XTokenData.clear();
1682         XTokenName.clear();
1683         
1684         if (TestTask.CalendarAlarmData[2].XTokensData.size() > 2){
1685                 
1686                 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[2];
1687                 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[2];
1688                 
1689         }
1690         
1691         ASSERT_EQ("Example Data 3", XTokenData);
1692         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
1693         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy