// xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests // // (c) 2016-2017 Xestia Software Development. // // This file is part of Xestia Calendar. // // Xestia Calendar is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation, version 3 of the license. // // Xestia Calendar is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see #include "../objects/calendarevent/CalendarEvent.h" TEST(iCalendarEvent, BasicTests){ CalendarEventObject TestEvent; ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestEvent.LoadFile("iCalendarEvent-Missing.vcf")); ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf")); ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load1.vcf")); } TEST(iCalendarEvent, BaseObjectVerifyTests){ CalendarEventObject TestEvent; TestEvent.LoadFile("iCalendarEvent-Load1.vcf"); ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject()); // Tests for METHOD. ASSERT_EQ("REQUEST", TestEvent.MethodData); ASSERT_EQ("EXAMPLE=DATA", TestEvent.MethodTokens); // Tests for CALSCALE. ASSERT_EQ("GREGORIAN", TestEvent.CalendarScaleData); ASSERT_EQ("MORE=YES", TestEvent.CalendarScaleTokens); } TEST(iCalendarEvent, ObjectDataTests){ CalendarEventObject TestEvent; ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load2.vcf")); ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject()); // Tests for DTSTAMP. ASSERT_EQ("20160122T124100Z", TestEvent.DateTimeStampData); ASSERT_EQ("OTHER=PARAM", TestEvent.DateTimeStampTokens); // Tests for UID. ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", TestEvent.UniqueID); ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestEvent.UniqueIDTokens); // Tests for DTSTART. ASSERT_EQ("20160122T183000Z", TestEvent.DateTimeStartData); ASSERT_EQ("DATE-TIME", TestEvent.DateTimeStartDataValue); ASSERT_EQ("Europe/Truro", TestEvent.DateTimeStartDataTimeZoneID); ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestEvent.DateTimeStartDataTokens); // Tests for CLASS. ASSERT_EQ("PUBLIC", TestEvent.ClassData); ASSERT_EQ("CHOCOLATE=BAR", TestEvent.ClassDataTokens); // Tests for CREATED. ASSERT_EQ("20160123T081100Z", TestEvent.DateTimeCreatedData); ASSERT_EQ("CARAMEL=PLEASE", TestEvent.DateTimeCreatedTokens); // Tests for DESCRIPTION. std::string DescriptionData; std::string DescriptionAltRep; std::string DescriptionLanguage; std::string DescriptionTokens; if (TestEvent.DescriptionList.begin() != TestEvent.DescriptionList.end()){ DescriptionData = TestEvent.DescriptionList[0]; } if (TestEvent.DescriptionListAltRep.begin() != TestEvent.DescriptionListAltRep.end()){ DescriptionAltRep = TestEvent.DescriptionListAltRep[0]; } if (TestEvent.DescriptionListLanguage.begin() != TestEvent.DescriptionListLanguage.end()){ DescriptionLanguage = TestEvent.DescriptionListLanguage[0]; } if (TestEvent.DescriptionListTokens.begin() != TestEvent.DescriptionListTokens.end()){ DescriptionTokens = TestEvent.DescriptionListTokens[0]; } ASSERT_EQ("This is a description of the event.", DescriptionData); ASSERT_EQ("null:nodata", DescriptionAltRep); ASSERT_EQ("kw", DescriptionLanguage); ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", DescriptionTokens); // Tests for GEO. ASSERT_EQ("5.0;5.0", TestEvent.GeographicData); ASSERT_EQ("EXAMPLE=MEEP", TestEvent.GeographicTokens); // Tests for LAST-MODIFIED. ASSERT_EQ("20160124T093000Z", TestEvent.LastModifiedData); ASSERT_EQ("FUTURE=ODD", TestEvent.LastModifiedTokens); // Tests for LOCATION. ASSERT_EQ("The Basement, Truro", TestEvent.LocationData); ASSERT_EQ("null:nodata", TestEvent.LocationDataAltRep); ASSERT_EQ("kw", TestEvent.LocationDataLanguage); ASSERT_EQ("EXACT=NO", TestEvent.LocationDataTokens); // Tests for ORGANIZER. ASSERT_EQ("mailto:organiser@example.com", TestEvent.OrganiserData); ASSERT_EQ("ExampleOrganiser", TestEvent.OrganiserDataCommonName); ASSERT_EQ("null:nodata", TestEvent.OrganiserDataDirectoryEntry); ASSERT_EQ("mailto:organiser.noreply@example.com", TestEvent.OrganiserDataSentByParam); ASSERT_EQ("kw", TestEvent.OrganiserDataLanguage); ASSERT_EQ("HAPPY=DAYS", TestEvent.OrganiserDataTokens); // Tests for PRIORITY. ASSERT_EQ(5, TestEvent.PriorityData); ASSERT_EQ("STATUS=DEFAULT", TestEvent.PriorityTokens); // Tests for SEQUENCE. ASSERT_EQ(3, TestEvent.SequenceData); ASSERT_EQ("TEST=YAY", TestEvent.SequenceTokens); // Tests for STATUS. ASSERT_EQ("2.0;Success", TestEvent.StatusData); ASSERT_EQ("kw", TestEvent.StatusLanguage); ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", TestEvent.StatusTokens); // Tests for SUMMARY. ASSERT_EQ("A summary of the event.", TestEvent.SummaryData); ASSERT_EQ("null:nodata", TestEvent.SummaryDataAltRep); ASSERT_EQ("kw", TestEvent.SummaryDataLanguage); ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", TestEvent.SummaryDataTokens); // Tests for TRANSP. ASSERT_EQ("TRANSPARENT", TestEvent.TimeTransparencyData); ASSERT_EQ("OPAQUE=NOTYET", TestEvent.TimeTransparencyDataTokens); // Tests for URL. ASSERT_EQ("http://www.example.com/", TestEvent.URLData); ASSERT_EQ("EXTERNAL=YES", TestEvent.URLDataTokens); // Tests for RECURRENCE-ID. ASSERT_EQ("20160124", TestEvent.RecurranceIDData); ASSERT_EQ("Europe/Truro", TestEvent.RecurranceIDDataTimeZoneParam); ASSERT_EQ("THISANDFUTURE", TestEvent.RecurranceIDDataRangeParam); ASSERT_EQ("DATE", TestEvent.RecurranceIDDataValue); ASSERT_EQ("EXAMPLE=DATA", TestEvent.RecurranceIDDataTokens); // Tests for RRULE. ASSERT_EQ("FREQ=DAILY;COUNT=10", TestEvent.RecurranceRuleData); ASSERT_EQ("TEST=DATA", TestEvent.RecurranceRuleDataTokens); // Tests for DTEND. ASSERT_EQ("20160124T183000Z", TestEvent.DateTimeEndData); ASSERT_EQ("DATE-TIME", TestEvent.DateTimeEndDataValue); ASSERT_EQ("Europe/Truro", TestEvent.DateTimeEndDataTimeZoneID); ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", TestEvent.DateTimeEndDataTokens); // Tests for DURATION. (Done in another file called // iCalendarEvent-Load3.vcf). CalendarEventObject TestEvent2; ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent2.LoadFile("iCalendarEvent-Load3.vcf")); ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent2.ValidBaseObject()); ASSERT_EQ("PT1H", TestEvent2.DurationData); ASSERT_EQ("TEST=EXAMPLE", TestEvent2.DurationDataTokens); // Tests for ATTACH. First ATTACH property. std::string AttachData; std::string AttachDataFormatType; std::string AttachDataValue; std::string AttachDataEncoding; std::string AttachDataTokens; if (TestEvent.AttachList.begin() != TestEvent.AttachList.end()){ AttachData = TestEvent.AttachList[0]; } if (TestEvent.AttachListFormatType.begin() != TestEvent.AttachListFormatType.end()){ AttachDataFormatType = TestEvent.AttachListFormatType[0]; } ASSERT_EQ("http://www.example.com/", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Second ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); if (TestEvent.AttachList.size() > 1){ AttachData = TestEvent.AttachList[1]; } if (TestEvent.AttachListFormatType.size() > 1){ AttachDataFormatType = TestEvent.AttachListFormatType[1]; } ASSERT_EQ("http://www.example.com/page2.html", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Third ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); AttachDataTokens.clear(); if (TestEvent.AttachList.size() > 2){ AttachData = TestEvent.AttachList[2]; } if (TestEvent.AttachListFormatType.size() > 2){ AttachDataFormatType = TestEvent.AttachListFormatType[2]; } if (TestEvent.AttachListValue.size() > 2){ AttachDataValue = TestEvent.AttachListValue[2]; } if (TestEvent.AttachListFormatType.size() > 2){ AttachDataEncoding = TestEvent.AttachListEncoding[2]; } if (TestEvent.AttachListTokens.size() > 2){ AttachDataTokens = TestEvent.AttachListTokens[2]; } ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); ASSERT_EQ("text/plain", AttachDataFormatType); ASSERT_EQ("BASE64", AttachDataEncoding); ASSERT_EQ("BINARY", AttachDataValue); ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); // Tests for ATTENDEE. First ATTENDEE property. std::string AttendeeDataMember; std::string AttendeeDataDelegatedFrom; std::string AttendeeDataDelegatedTo; std::string AttendeeDataRole; std::string AttendeeDataRSVP; std::string AttendeeDataDirectoryEntry; std::string AttendeeDataSentBy; std::string AttendeeDataCommonName; std::string AttendeeDataCalendarUserType; std::string AttendeeDataParticipationStatus; std::string AttendeeDataLanguage; std::string AttendeeDataTokens; std::string AttendeeData; if (TestEvent.AttendeeList.begin() != TestEvent.AttendeeList.end()){ AttendeeData = TestEvent.AttendeeList[0]; } ASSERT_EQ("Attendee One", AttendeeData); // Second ATTENDEE property. AttendeeData.clear(); if (TestEvent.AttendeeList.size() > 1){ AttendeeData = TestEvent.AttendeeList[1]; } if (TestEvent.AttendeeList.size() > 1){ AttendeeDataDelegatedFrom = TestEvent.AttendeeListDelegatedFrom[1]; } if (TestEvent.AttendeeList.size() > 1){ AttendeeDataDelegatedTo = TestEvent.AttendeeListDelegatedTo[1]; } if (TestEvent.AttendeeList.size() > 1){ AttendeeDataRole = TestEvent.AttendeeListRole[1]; } if (TestEvent.AttendeeList.size() > 1){ AttendeeDataRSVP = TestEvent.AttendeeListRSVP[1]; } ASSERT_EQ("Attendee Two", AttendeeData); ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom); ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo); ASSERT_EQ("CHAIR", AttendeeDataRole); ASSERT_EQ("TRUE", AttendeeDataRSVP); // Third ATTENDEE property. AttendeeData.clear(); if (TestEvent.AttendeeList.size() > 2){ AttendeeData = TestEvent.AttendeeList[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataDirectoryEntry = TestEvent.AttendeeListDirectoryEntry[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataSentBy = TestEvent.AttendeeListSentBy[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataCommonName = TestEvent.AttendeeListCommonName[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataCalendarUserType = TestEvent.AttendeeListCalendarUserType[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataParticipationStatus = TestEvent.AttendeeListParticipationStatus[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataLanguage = TestEvent.AttendeeListLanguage[2]; } if (TestEvent.AttendeeList.size() > 2){ AttendeeDataTokens = TestEvent.AttendeeListTokens[2]; } ASSERT_EQ("Attendee Three", AttendeeData); ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry); ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy); ASSERT_EQ("Attendee The Third", AttendeeDataCommonName); ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType); ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus); ASSERT_EQ("kw", AttendeeDataLanguage); ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens); // Get the first CATEGORIES. std::string CategoryData; if (TestEvent.CategoriesList.begin() != TestEvent.CategoriesList.end()){ CategoryData = TestEvent.CategoriesList[0]; } ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData); CategoryData.clear(); std::string CategoryLanguage; // Get the second CATEGORIES. if (TestEvent.CategoriesList.size() > 1){ CategoryData = TestEvent.CategoriesList[1]; } if (TestEvent.CategoriesList.size() > 1){ CategoryLanguage = TestEvent.CategoriesListLanguage[1]; } ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData); ASSERT_EQ("en", CategoryLanguage); CategoryData.clear(); CategoryLanguage.clear(); // Get the third CATEGORIES. std::string CategoryTokens; if (TestEvent.CategoriesList.size() > 2){ CategoryData = TestEvent.CategoriesList[2]; } if (TestEvent.CategoriesList.size() > 2){ CategoryLanguage = TestEvent.CategoriesListLanguage[2]; } if (TestEvent.CategoriesList.size() > 2){ CategoryTokens = TestEvent.CategoriesListTokens[2]; } ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData); ASSERT_EQ("en-GB", CategoryLanguage); ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens); // Get the first COMMENT. std::string CommentData; if (TestEvent.CommentList.begin() != TestEvent.CommentList.end()){ CommentData = TestEvent.CommentList[0]; } ASSERT_EQ("This is the first comment.", CommentData); // Get the second COMMENT. CommentData.clear(); std::string CommentDataAltRep; std::string CommentDataLanguage; if (TestEvent.CommentList.size() > 1){ CommentData = TestEvent.CommentList[1]; } if (TestEvent.CommentList.size() > 1){ CommentDataAltRep = TestEvent.CommentListAltRep[1]; } if (TestEvent.CommentList.size() > 1){ CommentDataLanguage = TestEvent.CommentListLanguage[1]; } ASSERT_EQ("This is the second comment.", CommentData); ASSERT_EQ("null:nodata", CommentDataAltRep); ASSERT_EQ("en", CommentDataLanguage); // Get the third COMMENT. CommentData.clear(); std::string CommentDataTokens; if (TestEvent.CommentList.size() > 2){ CommentData = TestEvent.CommentList[2]; } if (TestEvent.CommentList.size() > 2){ CommentDataTokens = TestEvent.CommentListTokens[2]; } ASSERT_EQ("This is the third comment.", CommentData); ASSERT_EQ("ZEBRAS=YES", CommentDataTokens); // Get the first CONTACT. std::string ContactData; if (TestEvent.ContactList.begin() != TestEvent.ContactList.end()){ ContactData = TestEvent.ContactList[0]; } ASSERT_EQ("First Contact", ContactData); // Get the second CONTACT. ContactData.clear(); std::string ContactDataAltRep; std::string ContactDataLanguage; if (TestEvent.ContactList.size() > 1){ ContactData = TestEvent.ContactList[1]; } if (TestEvent.ContactList.size() > 1){ ContactDataAltRep = TestEvent.ContactListAltRep[1]; } if (TestEvent.ContactList.size() > 1){ ContactDataLanguage = TestEvent.ContactListLanguage[1]; } ASSERT_EQ("Second Contact", ContactData); ASSERT_EQ("null:nodata", ContactDataAltRep); ASSERT_EQ("en-GB", ContactDataLanguage); // Get the third CONTACT. ContactData.clear(); std::string ContactDataTokens; if (TestEvent.ContactList.size() > 2){ ContactData = TestEvent.ContactList[2]; } if (TestEvent.ContactList.size() > 2){ ContactDataTokens = TestEvent.ContactListTokens[2]; } ASSERT_EQ("Third Contact", ContactData); ASSERT_EQ("ZEBRAS=NO", ContactDataTokens); // Get the first EXDATE. std::string ExcludeDate; if (TestEvent.ExcludeDateData.begin() != TestEvent.ExcludeDateData.end()){ ExcludeDate = TestEvent.ExcludeDateData[0]; } ASSERT_EQ("20160125T120000Z", ExcludeDate); // Get the second EXDATE. ExcludeDate.clear(); std::string ExcludeDataTimeZoneParam; std::string ExcludeDataValue; if (TestEvent.ContactList.size() > 1){ ExcludeDate = TestEvent.ExcludeDateData[1]; } if (TestEvent.ContactList.size() > 1){ ExcludeDataTimeZoneParam = TestEvent.ExcludeDateDataTimeZoneParam[1]; } if (TestEvent.ContactList.size() > 1){ ExcludeDataValue = TestEvent.ExcludeDateDataValue[1]; } ASSERT_EQ("20160125T130000Z", ExcludeDate); ASSERT_EQ("DATE-TIME", ExcludeDataValue); ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam); // Get the third EXDATE. ExcludeDate.clear(); std::string ExcludeDataTokens; if (TestEvent.ContactList.size() > 2){ ExcludeDate = TestEvent.ExcludeDateData[2]; } if (TestEvent.ContactList.size() > 2){ ExcludeDataTokens = TestEvent.ExcludeDateDataTokens[2]; } ASSERT_EQ("20160125T133000Z", ExcludeDate); ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens); // Get the first REQUEST-STATUS. std::string RequestStatus; if (TestEvent.RequestStatusData.begin() != TestEvent.RequestStatusData.end()){ RequestStatus = TestEvent.RequestStatusData[0]; } ASSERT_EQ("2.0;Success", RequestStatus); // Get the second REQUEST-STATUS. RequestStatus.clear(); std::string RequestLanguage; if (TestEvent.RequestStatusData.size() > 1){ RequestStatus = TestEvent.RequestStatusData[1]; } if (TestEvent.RequestStatusData.size() > 1){ RequestLanguage = TestEvent.RequestStatusLanguage[1]; } ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus); ASSERT_EQ("en", RequestLanguage); // Get the third REQUEST-STATUS. RequestStatus.clear(); std::string RequestTokens; if (TestEvent.RequestStatusData.size() > 2){ RequestStatus = TestEvent.RequestStatusData[2]; } if (TestEvent.RequestStatusData.size() > 2){ RequestTokens = TestEvent.RequestStatusTokens[2]; } ASSERT_EQ("3.7;Invalid calendar user", RequestStatus); ASSERT_EQ("USER=MISSING", RequestTokens); // Get the first RELATED-TO. std::string RelatedTo; if (TestEvent.RelatedToData.begin() != TestEvent.RelatedToData.end()){ RelatedTo = TestEvent.RelatedToData[0]; } ASSERT_EQ("person.1@example.com", RelatedTo); // Get the second RELATED-TO. RelatedTo.clear(); std::string RelatedToType; if (TestEvent.RelatedToData.size() > 1){ RelatedTo = TestEvent.RelatedToData[1]; } if (TestEvent.RelatedToData.size() > 1){ RelatedToType = TestEvent.RelatedToDataRelationType[1]; } ASSERT_EQ("person.2@example.com", RelatedTo); ASSERT_EQ("PARENT", RelatedToType); // Get the third RELATED-TO. RelatedTo.clear(); std::string RelatedToTokens; if (TestEvent.RelatedToData.size() > 2){ RelatedTo = TestEvent.RelatedToData[2]; } if (TestEvent.RelatedToData.size() > 2){ RelatedToTokens = TestEvent.RelatedToDataTokens[2]; } ASSERT_EQ("person.3@example.com", RelatedTo); ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens); // Get the first RESOURCES. std::string Resources; if (TestEvent.ResourcesData.begin() != TestEvent.ResourcesData.end()){ Resources = TestEvent.ResourcesData[0]; } ASSERT_EQ("DMAC RECEIVER", Resources); // Get the second RESOURCES. Resources.clear(); std::string ResourcesLanguage; if (TestEvent.ResourcesData.size() > 1){ Resources = TestEvent.ResourcesData[1]; } if (TestEvent.ResourcesData.size() > 1){ ResourcesLanguage = TestEvent.ResourcesDataLanguage[1]; } ASSERT_EQ("PAL-I TELEVISION SET", Resources); ASSERT_EQ("en", ResourcesLanguage); // Get the third RESOURCES. Resources.clear(); std::string ResourcesAltRep; std::string ResourcesTokens; if (TestEvent.ResourcesData.size() > 2){ Resources = TestEvent.ResourcesData[2]; } if (TestEvent.ResourcesData.size() > 2){ ResourcesAltRep = TestEvent.ResourcesDataAltRep[2]; } if (TestEvent.ResourcesData.size() > 2){ ResourcesTokens = TestEvent.ResourcesDataTokens[2]; } ASSERT_EQ("PAL/SECAM VCR", Resources); ASSERT_EQ("null:nodata", ResourcesAltRep); ASSERT_EQ("STATUS=BROKEN", ResourcesTokens); // Get the first RDATE. std::string RecurrenceDate; if (TestEvent.RecurranceDateData.begin() != TestEvent.RecurranceDateData.end()){ RecurrenceDate = TestEvent.RecurranceDateData[0]; } ASSERT_EQ("20160120", RecurrenceDate); // Get the second RDATE. RecurrenceDate.clear(); std::string RecurrenceDateTimeZoneParam; std::string RecurrenceDateValue; if (TestEvent.RecurranceDateData.size() > 1){ RecurrenceDate = TestEvent.RecurranceDateData[1]; } if (TestEvent.RecurranceDateData.size() > 1){ RecurrenceDateTimeZoneParam = TestEvent.RecurranceDateDataTimeZoneParam[1]; } if (TestEvent.RecurranceDateData.size() > 1){ RecurrenceDateValue = TestEvent.RecurranceDateDataValue[1]; } ASSERT_EQ("20160121", RecurrenceDate); ASSERT_EQ("DATE", RecurrenceDateValue); ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam); // Get the third RDATE. RecurrenceDate.clear(); std::string RecurrenceTokens; if (TestEvent.RecurranceDateData.size() > 2){ RecurrenceDate = TestEvent.RecurranceDateData[2]; } if (TestEvent.RecurranceDateData.size() > 2){ RecurrenceTokens = TestEvent.RecurranceDateDataTokens[2]; } ASSERT_EQ("20160520", RecurrenceDate); ASSERT_EQ("ZILCH=DATA", RecurrenceTokens); // Get the first X-EXAMPLE1 token. std::string XTokenName; std::string XTokenData; if (TestEvent.XTokensData.size() != 0 ){ XTokenData = TestEvent.XTokensData[0]; } if (TestEvent.XTokensData.size() != 0){ XTokenName = TestEvent.XTokensDataTokens[0]; } ASSERT_EQ("Moo", XTokenData); ASSERT_EQ("X-EXAMPLE1", XTokenName); // Get the second X-EXAMPLE1 token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 1){ XTokenData = TestEvent.XTokensData[1]; } if (TestEvent.XTokensData.size() > 1){ XTokenName = TestEvent.XTokensDataTokens[1]; } ASSERT_EQ("Meep", XTokenData); ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName); // Get the third X-EXAMPLE1 token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 2){ XTokenData = TestEvent.XTokensData[2]; } if (TestEvent.XTokensData.size() > 2){ XTokenName = TestEvent.XTokensDataTokens[2]; } ASSERT_EQ("Meow", XTokenData); ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName); // Get the first X-EXAMPLE2 token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 3){ XTokenData = TestEvent.XTokensData[3]; } if (TestEvent.XTokensData.size() > 3){ XTokenName = TestEvent.XTokensDataTokens[3]; } ASSERT_EQ("Dish", XTokenData); ASSERT_EQ("X-EXAMPLE2", XTokenName); // Get the second X-EXAMPLE2 token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 4){ XTokenData = TestEvent.XTokensData[4]; } if (TestEvent.XTokensData.size() > 4){ XTokenName = TestEvent.XTokensDataTokens[4]; } ASSERT_EQ("Fork", XTokenData); ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName); // Get the third X-EXAMPLE2 token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 5){ XTokenData = TestEvent.XTokensData[5]; } if (TestEvent.XTokensData.size() > 5){ XTokenName = TestEvent.XTokensDataTokens[5]; } ASSERT_EQ("Table", XTokenData); ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName); // Get the X-STATUS token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 6){ XTokenData = TestEvent.XTokensData[6]; } if (TestEvent.XTokensData.size() > 6){ XTokenName = TestEvent.XTokensDataTokens[6]; } ASSERT_EQ("Idle", XTokenData); ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName); // Get the X-TRANSPORT token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 7){ XTokenData = TestEvent.XTokensData[7]; } if (TestEvent.XTokensData.size() > 7){ XTokenName = TestEvent.XTokensDataTokens[7]; } ASSERT_EQ("Private Hire", XTokenData); ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName); // Get the X-PHANTOM-STATUS token. XTokenName.clear(); XTokenData.clear(); if (TestEvent.XTokensData.size() > 8){ XTokenData = TestEvent.XTokensData[8]; } if (TestEvent.XTokensData.size() > 8){ XTokenName = TestEvent.XTokensDataTokens[8]; } ASSERT_EQ("None", XTokenData); ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName); } TEST(iCalendarEvent, AlarmTests){ CalendarEventObject TestEvent; ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load2.vcf")); ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject()); // Tests for the first VALARM property. std::string ActionData; std::string ActionDataTokens; std::string TriggerData; std::string TriggerRelated; std::string TriggerValue; std::string TriggerTokens; std::string DurationData; std::string DurationTokens; std::string RepeatData; std::string RepeatTokens; std::string XTokenData; std::string XTokenName; if (TestEvent.CalendarAlarmData.size() > 0){ ActionData = TestEvent.CalendarAlarmData[0].AlarmAction; ActionDataTokens = TestEvent.CalendarAlarmData[0].AlarmActionTokens; TriggerData = TestEvent.CalendarAlarmData[0].TriggerData; TriggerRelated = TestEvent.CalendarAlarmData[0].TriggerRelated; TriggerValue = TestEvent.CalendarAlarmData[0].TriggerValue; TriggerTokens = TestEvent.CalendarAlarmData[0].TriggerTokens; DurationData = TestEvent.CalendarAlarmData[0].DurationData; DurationTokens = TestEvent.CalendarAlarmData[0].DurationTokens; RepeatData = TestEvent.CalendarAlarmData[0].RepeatData; RepeatTokens = TestEvent.CalendarAlarmData[0].RepeatTokens; } ASSERT_EQ("AUDIO", ActionData); ASSERT_EQ("FUNKY=SOUNDS", ActionDataTokens); ASSERT_EQ("20160220T160000Z", TriggerData); ASSERT_EQ("END", TriggerRelated); ASSERT_EQ("DATE-TIME", TriggerValue); ASSERT_EQ("PUSH=BUTTON", TriggerTokens); ASSERT_EQ("PT5H", DurationData); ASSERT_EQ("FLYING=NO", DurationTokens); ASSERT_EQ("PT5M", RepeatData); ASSERT_EQ("NEVER=SLEEP", RepeatTokens); // Tests for ATTACH. First ATTACH property. std::string AttachData; std::string AttachDataFormatType; std::string AttachDataValue; std::string AttachDataEncoding; std::string AttachDataTokens; if (TestEvent.CalendarAlarmData[0].AttachList.begin() != TestEvent.CalendarAlarmData[0].AttachList.end()){ AttachData = TestEvent.AttachList[0]; } if (TestEvent.CalendarAlarmData[0].AttachListFormatType.begin() != TestEvent.CalendarAlarmData[0].AttachListFormatType.end()){ AttachDataFormatType = TestEvent.AttachListFormatType[0]; } ASSERT_EQ("http://www.example.com/", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Second ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); if (TestEvent.CalendarAlarmData[0].AttachList.size() > 1){ AttachData = TestEvent.CalendarAlarmData[0].AttachList[1]; } if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 1){ AttachDataFormatType = TestEvent.CalendarAlarmData[0].AttachListFormatType[1]; } ASSERT_EQ("http://www.example.com/page2.html", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Third ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); AttachDataTokens.clear(); if (TestEvent.CalendarAlarmData[0].AttachList.size() > 2){ AttachData = TestEvent.CalendarAlarmData[0].AttachList[2]; } if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 2){ AttachDataFormatType = TestEvent.CalendarAlarmData[0].AttachListFormatType[2]; } if (TestEvent.CalendarAlarmData[0].AttachListValue.size() > 2){ AttachDataValue = TestEvent.CalendarAlarmData[0].AttachListValue[2]; } if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 2){ AttachDataEncoding = TestEvent.CalendarAlarmData[0].AttachListEncoding[2]; } if (TestEvent.CalendarAlarmData[0].AttachListTokens.size() > 2){ AttachDataTokens = TestEvent.CalendarAlarmData[0].AttachListTokens[2]; } ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); ASSERT_EQ("text/plain", AttachDataFormatType); ASSERT_EQ("BASE64", AttachDataEncoding); ASSERT_EQ("BINARY", AttachDataValue); ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); // Test the first X-Token. if (TestEvent.CalendarAlarmData[0].XTokensData.size() > 0){ XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[0]; XTokenName = TestEvent.CalendarAlarmData[0].XTokensDataTokens[0]; } ASSERT_EQ("Example Data 1", XTokenData); ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName); // Test the second X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[0].XTokensData.size() > 1){ XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[1]; XTokenName = TestEvent.CalendarAlarmData[0].XTokensDataTokens[1]; } ASSERT_EQ("Example Data 2", XTokenData); ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName); // Test the third X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[0].XTokensData.size() > 2){ XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[2]; XTokenName = TestEvent.CalendarAlarmData[0].XTokensDataTokens[2]; } ASSERT_EQ("Example Data 3", XTokenData); ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName); // Tests for the second VALARM property. ActionData.clear(); ActionDataTokens.clear(); TriggerData.clear(); TriggerRelated.clear(); TriggerValue.clear(); TriggerTokens.clear(); DurationData.clear(); DurationTokens.clear(); RepeatData.clear(); RepeatTokens.clear(); XTokenData.clear(); XTokenName.clear(); string DescriptionData; string DescriptionAltRep; string DescriptionLanguage; string DescriptionTokens; if (TestEvent.CalendarAlarmData.size() > 1){ ActionData = TestEvent.CalendarAlarmData[1].AlarmAction; ActionDataTokens = TestEvent.CalendarAlarmData[1].AlarmActionTokens; TriggerData = TestEvent.CalendarAlarmData[1].TriggerData; TriggerRelated = TestEvent.CalendarAlarmData[1].TriggerRelated; TriggerValue = TestEvent.CalendarAlarmData[1].TriggerValue; TriggerTokens = TestEvent.CalendarAlarmData[1].TriggerTokens; DurationData = TestEvent.CalendarAlarmData[1].DurationData; DurationTokens = TestEvent.CalendarAlarmData[1].DurationTokens; RepeatData = TestEvent.CalendarAlarmData[1].RepeatData; RepeatTokens = TestEvent.CalendarAlarmData[1].RepeatTokens; DescriptionData = TestEvent.CalendarAlarmData[1].DescriptionData; DescriptionAltRep = TestEvent.CalendarAlarmData[1].DescriptionAltRep; DescriptionLanguage = TestEvent.CalendarAlarmData[1].DescriptionLanguage; DescriptionTokens = TestEvent.CalendarAlarmData[1].DescriptionTokens; } ASSERT_EQ("DISPLAY", ActionData); ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens); ASSERT_EQ("20160230T110000Z", TriggerData); ASSERT_EQ("END", TriggerRelated); ASSERT_EQ("DATE-TIME", TriggerValue); ASSERT_EQ("PUSH=BUTTON", TriggerTokens); ASSERT_EQ("PT7H", DurationData); ASSERT_EQ("FLYING=YES", DurationTokens); ASSERT_EQ("PT3M", RepeatData); ASSERT_EQ("SLEEP=ALWAYS", RepeatTokens); ASSERT_EQ("This is the second alarm.", DescriptionData); ASSERT_EQ("null:nodata", DescriptionAltRep); ASSERT_EQ("kw", DescriptionLanguage); ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens); // Test the first X-Token. if (TestEvent.CalendarAlarmData[1].XTokensData.size() > 0){ XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[0]; XTokenName = TestEvent.CalendarAlarmData[1].XTokensDataTokens[0]; } ASSERT_EQ("Example Data 1", XTokenData); ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName); // Test the second X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[1].XTokensData.size() > 1){ XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[1]; XTokenName = TestEvent.CalendarAlarmData[1].XTokensDataTokens[1]; } ASSERT_EQ("Example Data 2", XTokenData); ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName); // Test the third X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[1].XTokensData.size() > 2){ XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[2]; XTokenName = TestEvent.CalendarAlarmData[1].XTokensDataTokens[2]; } ASSERT_EQ("Example Data 3", XTokenData); ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName); // Tests for the third VALARM property. ActionData.clear(); ActionDataTokens.clear(); TriggerData.clear(); TriggerRelated.clear(); TriggerValue.clear(); TriggerTokens.clear(); DurationData.clear(); DurationTokens.clear(); RepeatData.clear(); RepeatTokens.clear(); XTokenData.clear(); XTokenName.clear(); DescriptionData.clear(); DescriptionAltRep.clear(); DescriptionLanguage.clear(); DescriptionTokens.clear(); string SummaryData; string SummaryAltRep; string SummaryLanguage; string SummaryTokens; string AttendeeDataMember; string AttendeeDataDelegatedFrom; string AttendeeDataDelegatedTo; string AttendeeDataRole; string AttendeeDataRSVP; string AttendeeDataDirectoryEntry; string AttendeeDataSentBy; string AttendeeDataCommonName; string AttendeeDataCalendarUserType; string AttendeeDataParticipationStatus; string AttendeeDataLanguage; string AttendeeDataTokens; string AttendeeData; AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); AttachDataTokens.clear(); if (TestEvent.CalendarAlarmData.size() > 2){ ActionData = TestEvent.CalendarAlarmData[2].AlarmAction; ActionDataTokens = TestEvent.CalendarAlarmData[2].AlarmActionTokens; TriggerData = TestEvent.CalendarAlarmData[2].TriggerData; TriggerRelated = TestEvent.CalendarAlarmData[2].TriggerRelated; TriggerValue = TestEvent.CalendarAlarmData[2].TriggerValue; TriggerTokens = TestEvent.CalendarAlarmData[2].TriggerTokens; DurationData = TestEvent.CalendarAlarmData[2].DurationData; DurationTokens = TestEvent.CalendarAlarmData[2].DurationTokens; RepeatData = TestEvent.CalendarAlarmData[2].RepeatData; RepeatTokens = TestEvent.CalendarAlarmData[2].RepeatTokens; DescriptionData = TestEvent.CalendarAlarmData[2].DescriptionData; DescriptionAltRep = TestEvent.CalendarAlarmData[2].DescriptionAltRep; DescriptionLanguage = TestEvent.CalendarAlarmData[2].DescriptionLanguage; DescriptionTokens = TestEvent.CalendarAlarmData[2].DescriptionTokens; SummaryData = TestEvent.CalendarAlarmData[2].SummaryData; SummaryAltRep = TestEvent.CalendarAlarmData[2].SummaryAltRep; SummaryLanguage = TestEvent.CalendarAlarmData[2].SummaryLanguage; SummaryTokens = TestEvent.CalendarAlarmData[2].SummaryTokens; } ASSERT_EQ("EMAIL", ActionData); ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens); ASSERT_EQ("20160230T120000Z", TriggerData); ASSERT_EQ("END", TriggerRelated); ASSERT_EQ("DATE-TIME", TriggerValue); ASSERT_EQ("PUSH=BUTTON", TriggerTokens); ASSERT_EQ("PT7H", DurationData); ASSERT_EQ("FLYING=YES", DurationTokens); ASSERT_EQ("PT3M", RepeatData); ASSERT_EQ("SLEEP=ALWAYS", RepeatTokens); ASSERT_EQ("This is the third alarm.", DescriptionData); ASSERT_EQ("null:nodata", DescriptionAltRep); ASSERT_EQ("kw", DescriptionLanguage); ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens); ASSERT_EQ("This is the summary of the third alarm.", SummaryData); ASSERT_EQ("null:nodata", SummaryAltRep); ASSERT_EQ("en", SummaryLanguage); ASSERT_EQ("MEEP=MOOP", SummaryTokens); // Tests for ATTENDEE. First ATTENDEE property. if (TestEvent.CalendarAlarmData[2].AttendeeList.begin() != TestEvent.CalendarAlarmData[2].AttendeeList.end()){ AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[0]; } ASSERT_EQ("Attendee One", AttendeeData); // Second ATTENDEE property. AttendeeData.clear(); if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){ AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[1]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){ AttendeeDataDelegatedFrom = TestEvent.CalendarAlarmData[2].AttendeeListDelegatedFrom[1]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){ AttendeeDataDelegatedTo = TestEvent.CalendarAlarmData[2].AttendeeListDelegatedTo[1]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){ AttendeeDataRole = TestEvent.CalendarAlarmData[2].AttendeeListRole[1]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){ AttendeeDataRSVP = TestEvent.CalendarAlarmData[2].AttendeeListRSVP[1]; } ASSERT_EQ("Attendee Two", AttendeeData); ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom); ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo); ASSERT_EQ("CHAIR", AttendeeDataRole); ASSERT_EQ("TRUE", AttendeeDataRSVP); // Third ATTENDEE property. AttendeeData.clear(); if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataDirectoryEntry = TestEvent.CalendarAlarmData[2].AttendeeListDirectoryEntry[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataSentBy = TestEvent.CalendarAlarmData[2].AttendeeListSentBy[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataCommonName = TestEvent.CalendarAlarmData[2].AttendeeListCommonName[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataCalendarUserType = TestEvent.CalendarAlarmData[2].AttendeeListCalendarUserType[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataParticipationStatus = TestEvent.CalendarAlarmData[2].AttendeeListParticipationStatus[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataLanguage = TestEvent.CalendarAlarmData[2].AttendeeListLanguage[2]; } if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){ AttendeeDataTokens = TestEvent.CalendarAlarmData[2].AttendeeListTokens[2]; } ASSERT_EQ("Attendee Three", AttendeeData); ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry); ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy); ASSERT_EQ("Attendee The Third", AttendeeDataCommonName); ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType); ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus); ASSERT_EQ("kw", AttendeeDataLanguage); ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens); // Tests for ATTACH. First ATTACH property. if (TestEvent.CalendarAlarmData[2].AttachList.begin() != TestEvent.CalendarAlarmData[2].AttachList.end()){ AttachData = TestEvent.CalendarAlarmData[2].AttachList[0]; } if (TestEvent.CalendarAlarmData[2].AttachListFormatType.begin() != TestEvent.CalendarAlarmData[2].AttachListFormatType.end()){ AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[0]; } ASSERT_EQ("http://www.example.com/", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Second ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); if (TestEvent.CalendarAlarmData[2].AttachList.size() > 1){ AttachData = TestEvent.CalendarAlarmData[2].AttachList[1]; } if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 1){ AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[1]; } ASSERT_EQ("http://www.example.com/page2.html", AttachData); ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); // Third ATTACH property. AttachData.clear(); AttachDataFormatType.clear(); AttachDataValue.clear(); AttachDataEncoding.clear(); AttachDataTokens.clear(); if (TestEvent.CalendarAlarmData[2].AttachList.size() > 2){ AttachData = TestEvent.CalendarAlarmData[2].AttachList[2]; } if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 2){ AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[2]; } if (TestEvent.CalendarAlarmData[2].AttachListValue.size() > 2){ AttachDataValue = TestEvent.CalendarAlarmData[2].AttachListValue[2]; } if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 2){ AttachDataEncoding = TestEvent.CalendarAlarmData[2].AttachListEncoding[2]; } if (TestEvent.CalendarAlarmData[2].AttachListTokens.size() > 2){ AttachDataTokens = TestEvent.CalendarAlarmData[2].AttachListTokens[2]; } ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); ASSERT_EQ("text/plain", AttachDataFormatType); ASSERT_EQ("BASE64", AttachDataEncoding); ASSERT_EQ("BINARY", AttachDataValue); ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); // Test the first X-Token. if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 0){ XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[0]; XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[0]; } ASSERT_EQ("Example Data 1", XTokenData); ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName); // Test the second X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 1){ XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[1]; XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[1]; } ASSERT_EQ("Example Data 2", XTokenData); ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName); // Test the third X-Token. XTokenData.clear(); XTokenName.clear(); if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 2){ XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[2]; XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[2]; } ASSERT_EQ("Example Data 3", XTokenData); ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName); }