1 // xestiacalendar_icaltaskload.h - Xestia Calendar iCalendar Task Component Unit Tests
3 // (c) 2016 Xestia Software Development.
5 // This file is part of Xestia Calendar.
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.
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.
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;
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"));
31 TEST(iCalendarTask, ObjectDataTests){
33 CalendarTaskObject TestTask;
34 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load2.vcf"));
35 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
39 ASSERT_EQ("20160131T104500Z", TestTask.DateTimeStampData);
40 ASSERT_EQ("OTHER=PARAM", TestTask.DateTimeStampTokens);
44 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e1", TestTask.UniqueID);
45 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestTask.UniqueIDTokens);
49 ASSERT_EQ("PUBLIC", TestTask.ClassData);
50 ASSERT_EQ("CHOCOLATE=NONE", TestTask.ClassDataTokens);
52 // Tests for COMPLETED.
54 ASSERT_EQ("20160131T110100Z", TestTask.CompletedData);
55 ASSERT_EQ("LYING=NEVER", TestTask.CompletedDataTokens);
59 ASSERT_EQ("20160131T080000Z", TestTask.DateTimeCreatedData);
60 ASSERT_EQ("CARAMEL=PLEASE", TestTask.DateTimeCreatedTokens);
62 // Tests for DESCRIPTION.
64 std::string DescriptionData;
65 std::string DescriptionAltRep;
66 std::string DescriptionLanguage;
67 std::string DescriptionTokens;
69 if (TestTask.DescriptionList.begin() != TestTask.DescriptionList.end()){
70 DescriptionData = TestTask.DescriptionList[0];
73 if (TestTask.DescriptionListAltRep.begin() != TestTask.DescriptionListAltRep.end()){
74 DescriptionAltRep = TestTask.DescriptionListAltRep[0];
77 if (TestTask.DescriptionListLanguage.begin() != TestTask.DescriptionListLanguage.end()){
78 DescriptionLanguage = TestTask.DescriptionListLanguage[0];
81 if (TestTask.DescriptionListTokens.begin() != TestTask.DescriptionListTokens.end()){
82 DescriptionTokens = TestTask.DescriptionListTokens[0];
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);
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);
99 ASSERT_EQ("20.0;20.0", TestTask.GeographicData);
100 ASSERT_EQ("EXAMPLE=MOOP", TestTask.GeographicTokens);
102 // Tests for LAST-MODIFIED.
104 ASSERT_EQ("20160131T114200Z", TestTask.LastModifiedData);
105 ASSERT_EQ("FUTURE=EVEN", TestTask.LastModifiedTokens);
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);
114 // Tests for ORGANIZER.
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);
123 // Tests for PERCENT-COMPLETE.
125 ASSERT_EQ("42", TestTask.PercentCompleteData);
126 ASSERT_EQ("DEEP=THOUGHT", TestTask.PercentCompleteTokens);
128 // Tests for PRIORITY.
130 ASSERT_EQ(5, TestTask.PriorityData);
131 ASSERT_EQ("STATUS=DEFAULT", TestTask.PriorityTokens);
133 // Tests for RECURRENCE-ID.
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);
141 // Tests for SEQUENCE.
143 ASSERT_EQ(3, TestTask.SequenceData);
144 ASSERT_EQ("TEST=YAY", TestTask.SequenceTokens);
148 ASSERT_EQ("2.0;Success", TestTask.StatusData);
149 ASSERT_EQ("kw", TestTask.StatusLanguage);
150 ASSERT_EQ("FAVOURITE=BEANS;NOTLIKE=UNKNOWN", TestTask.StatusTokens);
152 // Tests for SUMMARY.
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);
161 ASSERT_EQ("http://www.example.com/", TestTask.URLData);
162 ASSERT_EQ("EXTERNAL=YES", TestTask.URLDataTokens);
166 ASSERT_EQ("FREQ=DAILY;COUNT=10", TestTask.RecurranceRuleData);
167 ASSERT_EQ("TEST=DATA", TestTask.RecurranceRuleDataTokens);
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);
176 // Tests for DURATION.
178 CalendarTaskObject TestTask2;
179 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask2.LoadFile("iCalendarTask-Load3.vcf"));
180 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask2.ValidBaseObject());
182 ASSERT_EQ("PT15M", TestTask2.DurationData);
183 ASSERT_EQ("TEST=YES", TestTask2.DurationDataTokens);
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()){
195 AttachData = TestTask.AttachList[0];
199 if (TestTask.AttachListFormatType.begin() != TestTask.AttachListFormatType.end()){
201 AttachDataFormatType = TestTask.AttachListFormatType[0];
205 ASSERT_EQ("http://www.example.com/", AttachData);
206 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
208 // Second ATTACH property.
211 AttachDataFormatType.clear();
212 AttachDataValue.clear();
213 AttachDataEncoding.clear();
215 if (TestTask.AttachList.size() > 1){
217 AttachData = TestTask.AttachList[1];
221 if (TestTask.AttachListFormatType.size() > 1){
223 AttachDataFormatType = TestTask.AttachListFormatType[1];
227 ASSERT_EQ("http://www.example.com/page2.html", AttachData);
228 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
230 // Third ATTACH property.
233 AttachDataFormatType.clear();
234 AttachDataValue.clear();
235 AttachDataEncoding.clear();
236 AttachDataTokens.clear();
238 if (TestTask.AttachList.size() > 2){
240 AttachData = TestTask.AttachList[2];
244 if (TestTask.AttachListFormatType.size() > 2){
246 AttachDataFormatType = TestTask.AttachListFormatType[2];
250 if (TestTask.AttachListValue.size() > 2){
252 AttachDataValue = TestTask.AttachListValue[2];
256 if (TestTask.AttachListFormatType.size() > 2){
258 AttachDataEncoding = TestTask.AttachListEncoding[2];
262 if (TestTask.AttachListTokens.size() > 2){
264 AttachDataTokens = TestTask.AttachListTokens[2];
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);
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()){
292 AttendeeData = TestTask.AttendeeList[0];
296 ASSERT_EQ("Attendee One", AttendeeData);
298 // Second ATTENDEE property.
300 AttendeeData.clear();
302 if (TestTask.AttendeeList.size() > 1){
304 AttendeeData = TestTask.AttendeeList[1];
308 if (TestTask.AttendeeList.size() > 1){
310 AttendeeDataDelegatedFrom = TestTask.AttendeeListDelegatedFrom[1];
314 if (TestTask.AttendeeList.size() > 1){
316 AttendeeDataDelegatedTo = TestTask.AttendeeListDelegatedTo[1];
320 if (TestTask.AttendeeList.size() > 1){
322 AttendeeDataRole = TestTask.AttendeeListRole[1];
326 if (TestTask.AttendeeList.size() > 1){
328 AttendeeDataRSVP = TestTask.AttendeeListRSVP[1];
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.
340 AttendeeData.clear();
342 if (TestTask.AttendeeList.size() > 2){
344 AttendeeData = TestTask.AttendeeList[2];
348 if (TestTask.AttendeeList.size() > 2){
350 AttendeeDataDirectoryEntry = TestTask.AttendeeListDirectoryEntry[2];
354 if (TestTask.AttendeeList.size() > 2){
356 AttendeeDataSentBy = TestTask.AttendeeListSentBy[2];
360 if (TestTask.AttendeeList.size() > 2){
362 AttendeeDataCommonName = TestTask.AttendeeListCommonName[2];
366 if (TestTask.AttendeeList.size() > 2){
368 AttendeeDataCalendarUserType = TestTask.AttendeeListCalendarUserType[2];
372 if (TestTask.AttendeeList.size() > 2){
374 AttendeeDataParticipationStatus = TestTask.AttendeeListParticipationStatus[2];
378 if (TestTask.AttendeeList.size() > 2){
380 AttendeeDataLanguage = TestTask.AttendeeListLanguage[2];
384 if (TestTask.AttendeeList.size() > 2){
386 AttendeeDataTokens = TestTask.AttendeeListTokens[2];
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);
399 // Get the first CATEGORIES.
401 std::string CategoryData;
403 if (TestTask.CategoriesList.begin() != TestTask.CategoriesList.end()){
405 CategoryData = TestTask.CategoriesList[0];
409 ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData);
411 CategoryData.clear();
413 std::string CategoryLanguage;
415 // Get the second CATEGORIES.
417 if (TestTask.CategoriesList.size() > 1){
419 CategoryData = TestTask.CategoriesList[1];
423 if (TestTask.CategoriesList.size() > 1){
425 CategoryLanguage = TestTask.CategoriesListLanguage[1];
429 ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData);
430 ASSERT_EQ("en", CategoryLanguage);
432 CategoryData.clear();
433 CategoryLanguage.clear();
435 // Get the third CATEGORIES.
437 std::string CategoryTokens;
439 if (TestTask.CategoriesList.size() > 2){
441 CategoryData = TestTask.CategoriesList[2];
445 if (TestTask.CategoriesList.size() > 2){
447 CategoryLanguage = TestTask.CategoriesListLanguage[2];
451 if (TestTask.CategoriesList.size() > 2){
453 CategoryTokens = TestTask.CategoriesListTokens[2];
457 ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData);
458 ASSERT_EQ("en-GB", CategoryLanguage);
459 ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens);
461 // Get the first COMMENT.
463 std::string CommentData;
465 if (TestTask.CommentList.begin() != TestTask.CommentList.end()){
467 CommentData = TestTask.CommentList[0];
471 ASSERT_EQ("This is the first comment.", CommentData);
473 // Get the second COMMENT.
477 std::string CommentDataAltRep;
478 std::string CommentDataLanguage;
480 if (TestTask.CommentList.size() > 1){
482 CommentData = TestTask.CommentList[1];
486 if (TestTask.CommentList.size() > 1){
488 CommentDataAltRep = TestTask.CommentListAltRep[1];
492 if (TestTask.CommentList.size() > 1){
494 CommentDataLanguage = TestTask.CommentListLanguage[1];
498 ASSERT_EQ("This is the second comment.", CommentData);
499 ASSERT_EQ("null:nodata", CommentDataAltRep);
500 ASSERT_EQ("en", CommentDataLanguage);
502 // Get the third COMMENT.
506 std::string CommentDataTokens;
508 if (TestTask.CommentList.size() > 2){
510 CommentData = TestTask.CommentList[2];
514 if (TestTask.CommentList.size() > 2){
516 CommentDataTokens = TestTask.CommentListTokens[2];
520 ASSERT_EQ("This is the third comment.", CommentData);
521 ASSERT_EQ("ZEBRAS=YES", CommentDataTokens);
523 // Get the first CONTACT.
525 std::string ContactData;
527 if (TestTask.ContactList.begin() != TestTask.ContactList.end()){
529 ContactData = TestTask.ContactList[0];
533 ASSERT_EQ("First Contact", ContactData);
535 // Get the second CONTACT.
539 std::string ContactDataAltRep;
540 std::string ContactDataLanguage;
542 if (TestTask.ContactList.size() > 1){
544 ContactData = TestTask.ContactList[1];
548 if (TestTask.ContactList.size() > 1){
550 ContactDataAltRep = TestTask.ContactListAltRep[1];
554 if (TestTask.ContactList.size() > 1){
556 ContactDataLanguage = TestTask.ContactListLanguage[1];
560 ASSERT_EQ("Second Contact", ContactData);
561 ASSERT_EQ("null:nodata", ContactDataAltRep);
562 ASSERT_EQ("en-GB", ContactDataLanguage);
564 // Get the third CONTACT.
568 std::string ContactDataTokens;
570 if (TestTask.ContactList.size() > 2){
572 ContactData = TestTask.ContactList[2];
576 if (TestTask.ContactList.size() > 2){
578 ContactDataTokens = TestTask.ContactListTokens[2];
582 ASSERT_EQ("Third Contact", ContactData);
583 ASSERT_EQ("ZEBRAS=NO", ContactDataTokens);
585 // Get the first EXDATE.
587 std::string ExcludeDate;
589 if (TestTask.ExcludeDateData.begin() != TestTask.ExcludeDateData.end()){
591 ExcludeDate = TestTask.ExcludeDateData[0];
595 ASSERT_EQ("20160125T120000Z", ExcludeDate);
597 // Get the second EXDATE.
601 std::string ExcludeDataTimeZoneParam;
602 std::string ExcludeDataValue;
604 if (TestTask.ContactList.size() > 1){
606 ExcludeDate = TestTask.ExcludeDateData[1];
610 if (TestTask.ContactList.size() > 1){
612 ExcludeDataTimeZoneParam = TestTask.ExcludeDateDataTimeZoneParam[1];
616 if (TestTask.ContactList.size() > 1){
618 ExcludeDataValue = TestTask.ExcludeDateDataValue[1];
622 ASSERT_EQ("20160125T130000Z", ExcludeDate);
623 ASSERT_EQ("DATE-TIME", ExcludeDataValue);
624 ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam);
626 // Get the third EXDATE.
630 std::string ExcludeDataTokens;
632 if (TestTask.ContactList.size() > 2){
634 ExcludeDate = TestTask.ExcludeDateData[2];
638 if (TestTask.ContactList.size() > 2){
640 ExcludeDataTokens = TestTask.ExcludeDateDataTokens[2];
644 ASSERT_EQ("20160125T133000Z", ExcludeDate);
645 ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens);
647 // Get the first REQUEST-STATUS.
649 std::string RequestStatus;
651 if (TestTask.RequestStatusData.begin() != TestTask.RequestStatusData.end()){
653 RequestStatus = TestTask.RequestStatusData[0];
657 ASSERT_EQ("2.0;Success", RequestStatus);
659 // Get the second REQUEST-STATUS.
661 RequestStatus.clear();
663 std::string RequestLanguage;
665 if (TestTask.ContactList.size() > 1){
667 RequestStatus = TestTask.RequestStatusData[1];
671 if (TestTask.ContactList.size() > 1){
673 RequestLanguage = TestTask.RequestStatusLanguage[1];
677 ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus);
678 ASSERT_EQ("en", RequestLanguage);
680 // Get the third REQUEST-STATUS.
682 RequestStatus.clear();
684 std::string RequestTokens;
686 if (TestTask.ContactList.size() > 2){
688 RequestStatus = TestTask.RequestStatusData[2];
692 if (TestTask.ContactList.size() > 2){
694 RequestTokens = TestTask.RequestStatusTokens[2];
698 ASSERT_EQ("3.7;Invalid calendar user", RequestStatus);
699 ASSERT_EQ("USER=MISSING", RequestTokens);
701 // Get the first RELATED-TO.
703 std::string RelatedTo;
705 if (TestTask.RelatedToData.begin() != TestTask.RelatedToData.end()){
707 RelatedTo = TestTask.RelatedToData[0];
711 ASSERT_EQ("person.1@example.com", RelatedTo);
713 // Get the second RELATED-TO.
717 std::string RelatedToType;
719 if (TestTask.RelatedToData.size() > 1){
721 RelatedTo = TestTask.RelatedToData[1];
725 if (TestTask.RelatedToData.size() > 1){
727 RelatedToType = TestTask.RelatedToDataRelationType[1];
731 ASSERT_EQ("person.2@example.com", RelatedTo);
732 ASSERT_EQ("PARENT", RelatedToType);
734 // Get the third RELATED-TO.
738 std::string RelatedToTokens;
740 if (TestTask.RelatedToData.size() > 2){
742 RelatedTo = TestTask.RelatedToData[2];
746 if (TestTask.RelatedToData.size() > 2){
748 RelatedToTokens = TestTask.RelatedToDataTokens[2];
752 ASSERT_EQ("person.3@example.com", RelatedTo);
753 ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens);
755 // Get the first RESOURCES.
757 std::string Resources;
759 if (TestTask.ResourcesData.begin() != TestTask.ResourcesData.end()){
761 Resources = TestTask.ResourcesData[0];
765 ASSERT_EQ("DMAC RECEIVER", Resources);
767 // Get the second RESOURCES.
771 std::string ResourcesLanguage;
773 if (TestTask.ResourcesData.size() > 1){
775 Resources = TestTask.ResourcesData[1];
779 if (TestTask.ResourcesData.size() > 1){
781 ResourcesLanguage = TestTask.ResourcesDataLanguage[1];
785 ASSERT_EQ("PAL-I TELEVISION SET", Resources);
786 ASSERT_EQ("en", ResourcesLanguage);
788 // Get the third RESOURCES.
792 std::string ResourcesAltRep;
793 std::string ResourcesTokens;
795 if (TestTask.ResourcesData.size() > 2){
797 Resources = TestTask.ResourcesData[2];
801 if (TestTask.ResourcesData.size() > 2){
803 ResourcesAltRep = TestTask.ResourcesDataAltRep[2];
807 if (TestTask.ResourcesData.size() > 2){
809 ResourcesTokens = TestTask.ResourcesDataTokens[2];
813 ASSERT_EQ("PAL/SECAM VCR", Resources);
814 ASSERT_EQ("null:nodata", ResourcesAltRep);
815 ASSERT_EQ("STATUS=BROKEN", ResourcesTokens);
817 // Get the first RDATE.
819 std::string RecurrenceDate;
821 if (TestTask.RecurranceDateData.begin() != TestTask.RecurranceDateData.end()){
823 RecurrenceDate = TestTask.RecurranceDateData[0];
827 ASSERT_EQ("20160120", RecurrenceDate);
829 // Get the second RDATE.
831 RecurrenceDate.clear();
833 std::string RecurrenceDateTimeZoneParam;
834 std::string RecurrenceDateValue;
836 if (TestTask.RecurranceDateData.size() > 1){
838 RecurrenceDate = TestTask.RecurranceDateData[1];
842 if (TestTask.RecurranceDateData.size() > 1){
844 RecurrenceDateTimeZoneParam = TestTask.RecurranceDateDataTimeZoneParam[1];
848 if (TestTask.RecurranceDateData.size() > 1){
850 RecurrenceDateValue = TestTask.RecurranceDateDataValue[1];
854 ASSERT_EQ("20160121", RecurrenceDate);
855 ASSERT_EQ("DATE", RecurrenceDateValue);
856 ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam);
858 // Get the third RDATE.
860 RecurrenceDate.clear();
862 std::string RecurrenceTokens;
864 if (TestTask.RecurranceDateData.size() > 2){
866 RecurrenceDate = TestTask.RecurranceDateData[2];
870 if (TestTask.RecurranceDateData.size() > 2){
872 RecurrenceTokens = TestTask.RecurranceDateDataTokens[2];
876 ASSERT_EQ("20160520", RecurrenceDate);
877 ASSERT_EQ("ZILCH=DATA", RecurrenceTokens);
879 // Get the first X-EXAMPLE1 token.
881 std::string XTokenName;
882 std::string XTokenData;
884 if (TestTask.XTokensData.size() != 0 ){
886 XTokenData = TestTask.XTokensData[0];
890 if (TestTask.XTokensData.size() != 0){
892 XTokenName = TestTask.XTokensDataTokens[0];
896 ASSERT_EQ("Moo", XTokenData);
897 ASSERT_EQ("X-EXAMPLE1", XTokenName);
899 // Get the second X-EXAMPLE1 token.
904 if (TestTask.XTokensData.size() > 1){
906 XTokenData = TestTask.XTokensData[1];
910 if (TestTask.XTokensData.size() > 1){
912 XTokenName = TestTask.XTokensDataTokens[1];
916 ASSERT_EQ("Meep", XTokenData);
917 ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName);
919 // Get the third X-EXAMPLE1 token.
924 if (TestTask.XTokensData.size() > 2){
926 XTokenData = TestTask.XTokensData[2];
930 if (TestTask.XTokensData.size() > 2){
932 XTokenName = TestTask.XTokensDataTokens[2];
936 ASSERT_EQ("Meow", XTokenData);
937 ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName);
939 // Get the first X-EXAMPLE2 token.
944 if (TestTask.XTokensData.size() > 3){
946 XTokenData = TestTask.XTokensData[3];
950 if (TestTask.XTokensData.size() > 3){
952 XTokenName = TestTask.XTokensDataTokens[3];
956 ASSERT_EQ("Dish", XTokenData);
957 ASSERT_EQ("X-EXAMPLE2", XTokenName);
959 // Get the second X-EXAMPLE2 token.
964 if (TestTask.XTokensData.size() > 4){
966 XTokenData = TestTask.XTokensData[4];
970 if (TestTask.XTokensData.size() > 4){
972 XTokenName = TestTask.XTokensDataTokens[4];
976 ASSERT_EQ("Fork", XTokenData);
977 ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName);
979 // Get the third X-EXAMPLE2 token.
984 if (TestTask.XTokensData.size() > 5){
986 XTokenData = TestTask.XTokensData[5];
990 if (TestTask.XTokensData.size() > 5){
992 XTokenName = TestTask.XTokensDataTokens[5];
996 ASSERT_EQ("Table", XTokenData);
997 ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName);
999 // Get the X-STATUS token.
1004 if (TestTask.XTokensData.size() > 6){
1006 XTokenData = TestTask.XTokensData[6];
1010 if (TestTask.XTokensData.size() > 6){
1012 XTokenName = TestTask.XTokensDataTokens[6];
1016 ASSERT_EQ("Idle", XTokenData);
1017 ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName);
1019 // Get the X-TRANSPORT token.
1024 if (TestTask.XTokensData.size() > 7){
1026 XTokenData = TestTask.XTokensData[7];
1030 if (TestTask.XTokensData.size() > 7){
1032 XTokenName = TestTask.XTokensDataTokens[7];
1036 ASSERT_EQ("Private Hire", XTokenData);
1037 ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName);
1039 // Get the X-PHANTOM-STATUS token.
1044 if (TestTask.XTokensData.size() > 8){
1046 XTokenData = TestTask.XTokensData[8];
1050 if (TestTask.XTokensData.size() > 8){
1052 XTokenName = TestTask.XTokensDataTokens[8];
1056 ASSERT_EQ("None", XTokenData);
1057 ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName);
1061 TEST(iCalendarTask, AlarmTests){
1063 CalendarTaskObject TestTask;
1064 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load2.vcf"));
1065 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
1067 // Tests for the first VALARM property.
1069 std::string ActionData;
1070 std::string ActionDataTokens;
1072 std::string TriggerData;
1073 std::string TriggerRelated;
1074 std::string TriggerValue;
1075 std::string TriggerTokens;
1077 std::string DurationData;
1078 std::string DurationTokens;
1080 std::string RepeatData;
1081 std::string RepeatTokens;
1083 std::string XTokenData;
1084 std::string XTokenName;
1086 if (TestTask.CalendarAlarmData.size() > 0){
1088 ActionData = TestTask.CalendarAlarmData[0].AlarmAction;
1089 ActionDataTokens = TestTask.CalendarAlarmData[0].AlarmActionTokens;
1091 TriggerData = TestTask.CalendarAlarmData[0].TriggerData;
1092 TriggerRelated = TestTask.CalendarAlarmData[0].TriggerRelated;
1093 TriggerValue = TestTask.CalendarAlarmData[0].TriggerValue;
1094 TriggerTokens = TestTask.CalendarAlarmData[0].TriggerTokens;
1096 DurationData = TestTask.CalendarAlarmData[0].DurationData;
1097 DurationTokens = TestTask.CalendarAlarmData[0].DurationTokens;
1099 RepeatData = TestTask.CalendarAlarmData[0].RepeatData;
1100 RepeatTokens = TestTask.CalendarAlarmData[0].RepeatTokens;
1104 ASSERT_EQ("AUDIO", ActionData);
1105 ASSERT_EQ("FUNKY=SOUNDS", ActionDataTokens);
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);
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()){
1128 AttachData = TestTask.AttachList[0];
1132 if (TestTask.CalendarAlarmData[0].AttachListFormatType.begin() != TestTask.CalendarAlarmData[0].AttachListFormatType.end()){
1134 AttachDataFormatType = TestTask.AttachListFormatType[0];
1138 ASSERT_EQ("http://www.example.com/", AttachData);
1139 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1141 // Second ATTACH property.
1144 AttachDataFormatType.clear();
1145 AttachDataValue.clear();
1146 AttachDataEncoding.clear();
1148 if (TestTask.CalendarAlarmData[0].AttachList.size() > 1){
1150 AttachData = TestTask.CalendarAlarmData[0].AttachList[1];
1154 if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 1){
1156 AttachDataFormatType = TestTask.CalendarAlarmData[0].AttachListFormatType[1];
1160 ASSERT_EQ("http://www.example.com/page2.html", AttachData);
1161 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1163 // Third ATTACH property.
1166 AttachDataFormatType.clear();
1167 AttachDataValue.clear();
1168 AttachDataEncoding.clear();
1169 AttachDataTokens.clear();
1171 if (TestTask.CalendarAlarmData[0].AttachList.size() > 2){
1173 AttachData = TestTask.CalendarAlarmData[0].AttachList[2];
1177 if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 2){
1179 AttachDataFormatType = TestTask.CalendarAlarmData[0].AttachListFormatType[2];
1183 if (TestTask.CalendarAlarmData[0].AttachListValue.size() > 2){
1185 AttachDataValue = TestTask.CalendarAlarmData[0].AttachListValue[2];
1189 if (TestTask.CalendarAlarmData[0].AttachListFormatType.size() > 2){
1191 AttachDataEncoding = TestTask.CalendarAlarmData[0].AttachListEncoding[2];
1195 if (TestTask.CalendarAlarmData[0].AttachListTokens.size() > 2){
1197 AttachDataTokens = TestTask.CalendarAlarmData[0].AttachListTokens[2];
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);
1207 // Test the first X-Token.
1209 if (TestTask.CalendarAlarmData[0].XTokensData.size() > 0){
1211 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[0];
1212 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[0];
1216 ASSERT_EQ("Example Data 1", XTokenData);
1217 ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1219 // Test the second X-Token.
1224 if (TestTask.CalendarAlarmData[0].XTokensData.size() > 1){
1226 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[1];
1227 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[1];
1231 ASSERT_EQ("Example Data 2", XTokenData);
1232 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1234 // Test the third X-Token.
1239 if (TestTask.CalendarAlarmData[0].XTokensData.size() > 2){
1241 XTokenData = TestTask.CalendarAlarmData[0].XTokensData[2];
1242 XTokenName = TestTask.CalendarAlarmData[0].XTokensDataTokens[2];
1246 ASSERT_EQ("Example Data 3", XTokenData);
1247 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
1249 // Tests for the second VALARM property.
1252 ActionDataTokens.clear();
1254 TriggerData.clear();
1255 TriggerRelated.clear();
1256 TriggerValue.clear();
1257 TriggerTokens.clear();
1259 DurationData.clear();
1260 DurationTokens.clear();
1263 RepeatTokens.clear();
1268 string DescriptionData;
1269 string DescriptionAltRep;
1270 string DescriptionLanguage;
1271 string DescriptionTokens;
1273 if (TestTask.CalendarAlarmData.size() > 1){
1275 ActionData = TestTask.CalendarAlarmData[1].AlarmAction;
1276 ActionDataTokens = TestTask.CalendarAlarmData[1].AlarmActionTokens;
1278 TriggerData = TestTask.CalendarAlarmData[1].TriggerData;
1279 TriggerRelated = TestTask.CalendarAlarmData[1].TriggerRelated;
1280 TriggerValue = TestTask.CalendarAlarmData[1].TriggerValue;
1281 TriggerTokens = TestTask.CalendarAlarmData[1].TriggerTokens;
1283 DurationData = TestTask.CalendarAlarmData[1].DurationData;
1284 DurationTokens = TestTask.CalendarAlarmData[1].DurationTokens;
1286 RepeatData = TestTask.CalendarAlarmData[1].RepeatData;
1287 RepeatTokens = TestTask.CalendarAlarmData[1].RepeatTokens;
1289 DescriptionData = TestTask.CalendarAlarmData[1].DescriptionData;
1290 DescriptionAltRep = TestTask.CalendarAlarmData[1].DescriptionAltRep;
1291 DescriptionLanguage = TestTask.CalendarAlarmData[1].DescriptionLanguage;
1292 DescriptionTokens = TestTask.CalendarAlarmData[1].DescriptionTokens;
1296 ASSERT_EQ("DISPLAY", ActionData);
1297 ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
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);
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);
1315 // Test the first X-Token.
1317 if (TestTask.CalendarAlarmData[1].XTokensData.size() > 0){
1319 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[0];
1320 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[0];
1324 ASSERT_EQ("Example Data 1", XTokenData);
1325 ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1327 // Test the second X-Token.
1332 if (TestTask.CalendarAlarmData[1].XTokensData.size() > 1){
1334 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[1];
1335 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[1];
1339 ASSERT_EQ("Example Data 2", XTokenData);
1340 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1342 // Test the third X-Token.
1347 if (TestTask.CalendarAlarmData[1].XTokensData.size() > 2){
1349 XTokenData = TestTask.CalendarAlarmData[1].XTokensData[2];
1350 XTokenName = TestTask.CalendarAlarmData[1].XTokensDataTokens[2];
1354 ASSERT_EQ("Example Data 3", XTokenData);
1355 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
1357 // Tests for the third VALARM property.
1360 ActionDataTokens.clear();
1362 TriggerData.clear();
1363 TriggerRelated.clear();
1364 TriggerValue.clear();
1365 TriggerTokens.clear();
1367 DurationData.clear();
1368 DurationTokens.clear();
1371 RepeatTokens.clear();
1376 DescriptionData.clear();
1377 DescriptionAltRep.clear();
1378 DescriptionLanguage.clear();
1379 DescriptionTokens.clear();
1382 string SummaryAltRep;
1383 string SummaryLanguage;
1384 string SummaryTokens;
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;
1401 AttachDataFormatType.clear();
1402 AttachDataValue.clear();
1403 AttachDataEncoding.clear();
1404 AttachDataTokens.clear();
1406 if (TestTask.CalendarAlarmData.size() > 2){
1408 ActionData = TestTask.CalendarAlarmData[2].AlarmAction;
1409 ActionDataTokens = TestTask.CalendarAlarmData[2].AlarmActionTokens;
1411 TriggerData = TestTask.CalendarAlarmData[2].TriggerData;
1412 TriggerRelated = TestTask.CalendarAlarmData[2].TriggerRelated;
1413 TriggerValue = TestTask.CalendarAlarmData[2].TriggerValue;
1414 TriggerTokens = TestTask.CalendarAlarmData[2].TriggerTokens;
1416 DurationData = TestTask.CalendarAlarmData[2].DurationData;
1417 DurationTokens = TestTask.CalendarAlarmData[2].DurationTokens;
1419 RepeatData = TestTask.CalendarAlarmData[2].RepeatData;
1420 RepeatTokens = TestTask.CalendarAlarmData[2].RepeatTokens;
1422 DescriptionData = TestTask.CalendarAlarmData[2].DescriptionData;
1423 DescriptionAltRep = TestTask.CalendarAlarmData[2].DescriptionAltRep;
1424 DescriptionLanguage = TestTask.CalendarAlarmData[2].DescriptionLanguage;
1425 DescriptionTokens = TestTask.CalendarAlarmData[2].DescriptionTokens;
1427 SummaryData = TestTask.CalendarAlarmData[2].SummaryData;
1428 SummaryAltRep = TestTask.CalendarAlarmData[2].SummaryAltRep;
1429 SummaryLanguage = TestTask.CalendarAlarmData[2].SummaryLanguage;
1430 SummaryTokens = TestTask.CalendarAlarmData[2].SummaryTokens;
1434 ASSERT_EQ("EMAIL", ActionData);
1435 ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
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);
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()){
1462 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[0];
1466 ASSERT_EQ("Attendee One", AttendeeData);
1468 // Second ATTENDEE property.
1470 AttendeeData.clear();
1472 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1474 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[1];
1478 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1480 AttendeeDataDelegatedFrom = TestTask.CalendarAlarmData[2].AttendeeListDelegatedFrom[1];
1484 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1486 AttendeeDataDelegatedTo = TestTask.CalendarAlarmData[2].AttendeeListDelegatedTo[1];
1490 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1492 AttendeeDataRole = TestTask.CalendarAlarmData[2].AttendeeListRole[1];
1496 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 1){
1498 AttendeeDataRSVP = TestTask.CalendarAlarmData[2].AttendeeListRSVP[1];
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.
1510 AttendeeData.clear();
1512 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1514 AttendeeData = TestTask.CalendarAlarmData[2].AttendeeList[2];
1518 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1520 AttendeeDataDirectoryEntry = TestTask.CalendarAlarmData[2].AttendeeListDirectoryEntry[2];
1524 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1526 AttendeeDataSentBy = TestTask.CalendarAlarmData[2].AttendeeListSentBy[2];
1530 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1532 AttendeeDataCommonName = TestTask.CalendarAlarmData[2].AttendeeListCommonName[2];
1536 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1538 AttendeeDataCalendarUserType = TestTask.CalendarAlarmData[2].AttendeeListCalendarUserType[2];
1542 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1544 AttendeeDataParticipationStatus = TestTask.CalendarAlarmData[2].AttendeeListParticipationStatus[2];
1548 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1550 AttendeeDataLanguage = TestTask.CalendarAlarmData[2].AttendeeListLanguage[2];
1554 if (TestTask.CalendarAlarmData[2].AttendeeList.size() > 2){
1556 AttendeeDataTokens = TestTask.CalendarAlarmData[2].AttendeeListTokens[2];
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()){
1573 AttachData = TestTask.CalendarAlarmData[2].AttachList[0];
1577 if (TestTask.CalendarAlarmData[2].AttachListFormatType.begin() != TestTask.CalendarAlarmData[2].AttachListFormatType.end()){
1579 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[0];
1583 ASSERT_EQ("http://www.example.com/", AttachData);
1584 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1586 // Second ATTACH property.
1589 AttachDataFormatType.clear();
1590 AttachDataValue.clear();
1591 AttachDataEncoding.clear();
1593 if (TestTask.CalendarAlarmData[2].AttachList.size() > 1){
1595 AttachData = TestTask.CalendarAlarmData[2].AttachList[1];
1599 if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 1){
1601 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[1];
1605 ASSERT_EQ("http://www.example.com/page2.html", AttachData);
1606 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
1608 // Third ATTACH property.
1611 AttachDataFormatType.clear();
1612 AttachDataValue.clear();
1613 AttachDataEncoding.clear();
1614 AttachDataTokens.clear();
1616 if (TestTask.CalendarAlarmData[2].AttachList.size() > 2){
1618 AttachData = TestTask.CalendarAlarmData[2].AttachList[2];
1622 if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 2){
1624 AttachDataFormatType = TestTask.CalendarAlarmData[2].AttachListFormatType[2];
1628 if (TestTask.CalendarAlarmData[2].AttachListValue.size() > 2){
1630 AttachDataValue = TestTask.CalendarAlarmData[2].AttachListValue[2];
1634 if (TestTask.CalendarAlarmData[2].AttachListFormatType.size() > 2){
1636 AttachDataEncoding = TestTask.CalendarAlarmData[2].AttachListEncoding[2];
1640 if (TestTask.CalendarAlarmData[2].AttachListTokens.size() > 2){
1642 AttachDataTokens = TestTask.CalendarAlarmData[2].AttachListTokens[2];
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);
1652 // Test the first X-Token.
1654 if (TestTask.CalendarAlarmData[2].XTokensData.size() > 0){
1656 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[0];
1657 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[0];
1661 ASSERT_EQ("Example Data 1", XTokenData);
1662 ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
1664 // Test the second X-Token.
1669 if (TestTask.CalendarAlarmData[2].XTokensData.size() > 1){
1671 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[1];
1672 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[1];
1676 ASSERT_EQ("Example Data 2", XTokenData);
1677 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
1679 // Test the third X-Token.
1684 if (TestTask.CalendarAlarmData[2].XTokensData.size() > 2){
1686 XTokenData = TestTask.CalendarAlarmData[2].XTokensData[2];
1687 XTokenName = TestTask.CalendarAlarmData[2].XTokensDataTokens[2];
1691 ASSERT_EQ("Example Data 3", XTokenData);
1692 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);