X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_icaleventload.h;h=8199ebfb0c0c1d16a23d7401886134ea268c829c;hb=2e304ff435c80c07daaf0d3fbe8a9ab7d1ae70b1;hp=cc451ff18dded1a1f6afa7869e3b8cb0c558092a;hpb=e0ba3fb175a235317e9e0aebbcd707616dca60dc;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index cc451ff..8199ebf 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -1,14 +1,14 @@ // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests // -// (c) 2016 Xestia Software Development. +// (c) 2016-2017 Xestia Software Development. // // This file is part of Xestia Calendar. // -// Xestia Address Book is free software: you can redistribute it and/or modify +// 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 Address Book is distributed in the hope that it will be useful, +// 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. @@ -20,696 +20,1689 @@ TEST(iCalendarEvent, BasicTests){ - CalendarEventObject TestEvent; + 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")); + 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()); + 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); + 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); + 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()); + 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); + 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); + 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); + 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); + 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); + 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; + 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.descriptionList.begin() != testEvent.descriptionList.end()){ + DescriptionData = testEvent.descriptionList[0]; } - if (TestEvent.DescriptionListAltRep.begin() != TestEvent.DescriptionListAltRep.end()){ - DescriptionAltRep = TestEvent.DescriptionListAltRep[0]; + if (testEvent.descriptionListAltRep.begin() != testEvent.descriptionListAltRep.end()){ + DescriptionAltRep = testEvent.descriptionListAltRep[0]; } - if (TestEvent.DescriptionListAltRep.begin() != TestEvent.DescriptionListAltRep.end()){ - DescriptionLanguage = TestEvent.DescriptionListLanguage[0]; + if (testEvent.descriptionListLanguage.begin() != testEvent.descriptionListLanguage.end()){ + DescriptionLanguage = testEvent.descriptionListLanguage[0]; } - if (TestEvent.DescriptionListTokens.begin() != TestEvent.DescriptionListTokens.end()){ - DescriptionTokens = TestEvent.DescriptionListTokens[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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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()); + 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); + 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; + std::string attachData; + std::string attachDataFormatType; + std::string attachDataValue; + std::string attachDataEncoding; + std::string attachDataTokens; - if (TestEvent.AttachList.begin() != TestEvent.AttachList.end()){ + if (testEvent.attachList.begin() != testEvent.attachList.end()){ - AttachData = TestEvent.AttachList[0]; + attachData = testEvent.attachList[0]; } - if (TestEvent.AttachListFormatType.begin() != TestEvent.AttachListFormatType.end()){ + if (testEvent.attachListFormatType.begin() != testEvent.attachListFormatType.end()){ - AttachDataFormatType = TestEvent.AttachListFormatType[0]; + attachDataFormatType = testEvent.attachListFormatType[0]; } - ASSERT_EQ("http://www.example.com/", AttachData); - ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); + ASSERT_EQ("http://www.example.com/", attachData); + ASSERT_EQ("application/internet-shortcut", attachDataFormatType); // Second ATTACH property. - AttachData.clear(); - AttachDataFormatType.clear(); - AttachDataValue.clear(); - AttachDataEncoding.clear(); + attachData.clear(); + attachDataFormatType.clear(); + attachDataValue.clear(); + attachDataEncoding.clear(); - if (TestEvent.AttachList.size() > 1){ + if (testEvent.attachList.size() > 1){ - AttachData = TestEvent.AttachList[1]; + attachData = testEvent.attachList[1]; } - if (TestEvent.AttachListFormatType.size() > 1){ + if (testEvent.attachListFormatType.size() > 1){ - AttachDataFormatType = TestEvent.AttachListFormatType[1]; + attachDataFormatType = testEvent.attachListFormatType[1]; } - ASSERT_EQ("http://www.example.com/page2.html", AttachData); - ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); + 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(); + attachData.clear(); + attachDataFormatType.clear(); + attachDataValue.clear(); + attachDataEncoding.clear(); + attachDataTokens.clear(); - if (TestEvent.AttachList.size() > 2){ + if (testEvent.attachList.size() > 2){ - AttachData = TestEvent.AttachList[2]; + attachData = testEvent.attachList[2]; } - if (TestEvent.AttachListFormatType.size() > 2){ + if (testEvent.attachListFormatType.size() > 2){ - AttachDataFormatType = TestEvent.AttachListFormatType[2]; + attachDataFormatType = testEvent.attachListFormatType[2]; } - if (TestEvent.AttachListValue.size() > 2){ + if (testEvent.AttachListValue.size() > 2){ - AttachDataValue = TestEvent.AttachListValue[2]; + attachDataValue = testEvent.attachListValue[2]; } - if (TestEvent.AttachListFormatType.size() > 2){ + if (testEvent.AttachListFormatType.size() > 2){ - AttachDataEncoding = TestEvent.AttachListEncoding[2]; + attachDataEncoding = testEvent.attachListEncoding[2]; } - if (TestEvent.AttachListTokens.size() > 2){ + if (testEvent.AttachListTokens.size() > 2){ - AttachDataTokens = TestEvent.AttachListTokens[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); + 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; + 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()){ + if (testEvent.attendeeList.begin() != testEvent.attendeeList.end()){ - AttendeeData = TestEvent.AttendeeList[0]; + attendeeData = testEvent.attendeeList[0]; } - ASSERT_EQ("Attendee One", AttendeeData); + ASSERT_EQ("Attendee One", attendeeData); // Second ATTENDEE property. - AttendeeData.clear(); + attendeeData.clear(); - if (TestEvent.AttendeeList.size() > 1){ + if (testEvent.attendeeList.size() > 1){ - AttendeeData = TestEvent.AttendeeList[1]; + attendeeData = testEvent.attendeeList[1]; } - if (TestEvent.AttendeeList.size() > 1){ + if (testEvent.attendeeList.size() > 1){ - AttendeeDataDelegatedFrom = TestEvent.AttendeeListDelegatedFrom[1]; + attendeeDataDelegatedFrom = testEvent.attendeeListDelegatedFrom[1]; } - if (TestEvent.AttendeeList.size() > 1){ + if (testEvent.attendeeList.size() > 1){ - AttendeeDataDelegatedTo = TestEvent.AttendeeListDelegatedTo[1]; + attendeeDataDelegatedTo = testEvent.attendeeListDelegatedTo[1]; } - if (TestEvent.AttendeeList.size() > 1){ + if (testEvent.attendeeList.size() > 1){ - AttendeeDataRole = TestEvent.AttendeeListRole[1]; + attendeeDataRole = testEvent.attendeeListRole[1]; } - if (TestEvent.AttendeeList.size() > 1){ + if (testEvent.attendeeList.size() > 1){ - AttendeeDataRSVP = TestEvent.AttendeeListRSVP[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); + 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(); + attendeeData.clear(); - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeData = TestEvent.AttendeeList[2]; + attendeeData = testEvent.attendeeList[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataDirectoryEntry = TestEvent.AttendeeListDirectoryEntry[2]; + attendeeDataDirectoryEntry = testEvent.attendeeListDirectoryEntry[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataSentBy = TestEvent.AttendeeListSentBy[2]; + attendeeDataSentBy = testEvent.attendeeListSentBy[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataCommonName = TestEvent.AttendeeListCommonName[2]; + attendeeDataCommonName = testEvent.attendeeListCommonName[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataCalendarUserType = TestEvent.AttendeeListCalendarUserType[2]; + attendeeDataCalendarUserType = testEvent.attendeeListCalendarUserType[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataParticipationStatus = TestEvent.AttendeeListParticipationStatus[2]; + attendeeDataParticipationStatus = testEvent.attendeeListParticipationStatus[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataLanguage = TestEvent.AttendeeListLanguage[2]; + attendeeDataLanguage = testEvent.attendeeListLanguage[2]; } - if (TestEvent.AttendeeList.size() > 2){ + if (testEvent.attendeeList.size() > 2){ - AttendeeDataTokens = TestEvent.AttendeeListTokens[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); + 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; + std::string categoryData; - if (TestEvent.CategoriesList.begin() != TestEvent.CategoriesList.end()){ + if (testEvent.categoriesList.begin() != testEvent.categoriesList.end()){ - CategoryData = TestEvent.CategoriesList[0]; + categoryData = testEvent.categoriesList[0]; } - ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData); + ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData); - CategoryData.clear(); + categoryData.clear(); - std::string CategoryLanguage; + std::string categoryLanguage; // Get the second CATEGORIES. - if (TestEvent.CategoriesList.size() > 1){ + if (testEvent.categoriesList.size() > 1){ - CategoryData = TestEvent.CategoriesList[1]; + categoryData = testEvent.categoriesList[1]; } - if (TestEvent.CategoriesList.size() > 1){ + if (testEvent.categoriesList.size() > 1){ - CategoryLanguage = TestEvent.CategoriesListLanguage[1]; + categoryLanguage = testEvent.categoriesListLanguage[1]; } - ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData); - ASSERT_EQ("en", CategoryLanguage); + ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData); + ASSERT_EQ("en", categoryLanguage); - CategoryData.clear(); - CategoryLanguage.clear(); + categoryData.clear(); + categoryLanguage.clear(); // Get the third CATEGORIES. - std::string CategoryTokens; + std::string categoryTokens; - if (TestEvent.CategoriesList.size() > 2){ + if (testEvent.CategoriesList.size() > 2){ - CategoryData = TestEvent.CategoriesList[2]; + categoryData = testEvent.CategoriesList[2]; } - if (TestEvent.CategoriesList.size() > 2){ + if (testEvent.CategoriesList.size() > 2){ - CategoryLanguage = TestEvent.CategoriesListLanguage[2]; + categoryLanguage = testEvent.CategoriesListLanguage[2]; } - if (TestEvent.CategoriesList.size() > 2){ + if (testEvent.CategoriesList.size() > 2){ - CategoryTokens = TestEvent.CategoriesListTokens[2]; + categoryTokens = testEvent.CategoriesListTokens[2]; } - ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData); - ASSERT_EQ("en-GB", CategoryLanguage); - ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens); + 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; + std::string commentData; - if (TestEvent.CommentList.begin() != TestEvent.CommentList.end()){ + if (testEvent.commentList.begin() != testEvent.commentList.end()){ - CommentData = TestEvent.CommentList[0]; + commentData = testEvent.commentList[0]; } - ASSERT_EQ("This is the first comment.", CommentData); + ASSERT_EQ("This is the first comment.", commentData); // Get the second COMMENT. - CommentData.clear(); + commentData.clear(); - std::string CommentDataAltRep; - std::string CommentDataLanguage; + std::string commentDataAltRep; + std::string commentDataLanguage; - if (TestEvent.CommentList.size() > 1){ + if (testEvent.commentList.size() > 1){ - CommentData = TestEvent.CommentList[1]; + commentData = testEvent.commentList[1]; } - if (TestEvent.CommentList.size() > 1){ + if (testEvent.commentList.size() > 1){ - CommentDataAltRep = TestEvent.CommentListAltRep[1]; + commentDataAltRep = testEvent.commentListAltRep[1]; } - if (TestEvent.CommentList.size() > 1){ + if (testEvent.commentList.size() > 1){ - CommentDataLanguage = TestEvent.CommentListLanguage[1]; + commentDataLanguage = testEvent.commentListLanguage[1]; } - ASSERT_EQ("This is the second comment.", CommentData); - ASSERT_EQ("null:nodata", CommentDataAltRep); - ASSERT_EQ("en", CommentDataLanguage); + ASSERT_EQ("This is the second comment.", commentData); + ASSERT_EQ("null:nodata", commentDataAltRep); + ASSERT_EQ("en", commentDataLanguage); // Get the third COMMENT. - CommentData.clear(); + commentData.clear(); - std::string CommentDataTokens; + std::string commentDataTokens; - if (TestEvent.CommentList.size() > 2){ + if (testEvent.commentList.size() > 2){ - CommentData = TestEvent.CommentList[2]; + commentData = testEvent.commentList[2]; } - if (TestEvent.CommentList.size() > 2){ + if (testEvent.commentList.size() > 2){ - CommentDataTokens = TestEvent.CommentListTokens[2]; + commentDataTokens = testEvent.commentListTokens[2]; } - ASSERT_EQ("This is the third comment.", CommentData); - ASSERT_EQ("ZEBRAS=YES", CommentDataTokens); + ASSERT_EQ("This is the third comment.", commentData); + ASSERT_EQ("ZEBRAS=YES", commentDataTokens); // Get the first CONTACT. - std::string ContactData; + std::string contactData; - if (TestEvent.ContactList.begin() != TestEvent.ContactList.end()){ + if (testEvent.contactList.begin() != testEvent.contactList.end()){ - ContactData = TestEvent.ContactList[0]; + contactData = testEvent.contactList[0]; } - ASSERT_EQ("First Contact", ContactData); + ASSERT_EQ("First Contact", contactData); // Get the second CONTACT. - ContactData.clear(); + contactData.clear(); - std::string ContactDataAltRep; - std::string ContactDataLanguage; + std::string contactDataAltRep; + std::string contactDataLanguage; - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ContactData = TestEvent.ContactList[1]; + contactData = testEvent.contactList[1]; } - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ContactDataAltRep = TestEvent.ContactListAltRep[1]; + contactDataAltRep = testEvent.contactListAltRep[1]; } - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ContactDataLanguage = TestEvent.ContactListLanguage[1]; + contactDataLanguage = testEvent.contactListLanguage[1]; } - ASSERT_EQ("Second Contact", ContactData); - ASSERT_EQ("null:nodata", ContactDataAltRep); - ASSERT_EQ("en-GB", ContactDataLanguage); + ASSERT_EQ("Second Contact", contactData); + ASSERT_EQ("null:nodata", contactDataAltRep); + ASSERT_EQ("en-GB", contactDataLanguage); // Get the third CONTACT. - ContactData.clear(); + contactData.clear(); - std::string ContactDataTokens; + std::string contactDataTokens; - if (TestEvent.ContactList.size() > 2){ + if (testEvent.contactList.size() > 2){ - ContactData = TestEvent.ContactList[2]; + contactData = testEvent.contactList[2]; } - if (TestEvent.ContactList.size() > 2){ + if (testEvent.contactList.size() > 2){ - ContactDataTokens = TestEvent.ContactListTokens[2]; + contactDataTokens = testEvent.contactListTokens[2]; } - ASSERT_EQ("Third Contact", ContactData); - ASSERT_EQ("ZEBRAS=NO", ContactDataTokens); + ASSERT_EQ("Third Contact", contactData); + ASSERT_EQ("ZEBRAS=NO", contactDataTokens); // Get the first EXDATE. - std::string ExcludeDate; + std::string excludeDate; - if (TestEvent.ExcludeDateData.begin() != TestEvent.ExcludeDateData.end()){ + if (testEvent.excludeDateData.begin() != testEvent.excludeDateData.end()){ - ExcludeDate = TestEvent.ExcludeDateData[0]; + excludeDate = testEvent.excludeDateData[0]; } - ASSERT_EQ("20160125T120000Z", ExcludeDate); + ASSERT_EQ("20160125T120000Z", excludeDate); // Get the second EXDATE. - ExcludeDate.clear(); + excludeDate.clear(); - std::string ExcludeDataTimeZoneParam; - std::string ExcludeDataValue; + std::string excludeDataTimeZoneParam; + std::string excludeDataValue; - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ExcludeDate = TestEvent.ExcludeDateData[1]; + excludeDate = testEvent.excludeDateData[1]; } - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ExcludeDataTimeZoneParam = TestEvent.ExcludeDateDataTimeZoneParam[1]; + excludeDataTimeZoneParam = testEvent.excludeDateDataTimeZoneParam[1]; } - if (TestEvent.ContactList.size() > 1){ + if (testEvent.contactList.size() > 1){ - ExcludeDataValue = TestEvent.ExcludeDateDataValue[1]; + excludeDataValue = testEvent.excludeDateDataValue[1]; } - ASSERT_EQ("20160125T130000Z", ExcludeDate); - ASSERT_EQ("DATE-TIME", ExcludeDataValue); - ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam); + ASSERT_EQ("20160125T130000Z", excludeDate); + ASSERT_EQ("DATE-TIME", excludeDataValue); + ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam); // Get the third EXDATE. - ExcludeDate.clear(); + excludeDate.clear(); - std::string ExcludeDataTokens; + std::string excludeDataTokens; - if (TestEvent.ContactList.size() > 2){ + if (testEvent.contactList.size() > 2){ - ExcludeDate = TestEvent.ExcludeDateData[2]; + excludeDate = testEvent.excludeDateData[2]; } - if (TestEvent.ContactList.size() > 2){ + if (testEvent.contactList.size() > 2){ - ExcludeDataTokens = TestEvent.ExcludeDateDataTokens[2]; + excludeDataTokens = testEvent.excludeDateDataTokens[2]; } - ASSERT_EQ("20160125T133000Z", ExcludeDate); - ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens); + ASSERT_EQ("20160125T133000Z", excludeDate); + ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens); // Get the first REQUEST-STATUS. - std::string RequestStatus; + std::string requestStatus; - if (TestEvent.RequestStatusData.begin() != TestEvent.RequestStatusData.end()){ + if (testEvent.requestStatusData.begin() != testEvent.requestStatusData.end()){ - RequestStatus = TestEvent.RequestStatusData[0]; + requestStatus = testEvent.requestStatusData[0]; } - ASSERT_EQ("2.0;Success", RequestStatus); + ASSERT_EQ("2.0;Success", requestStatus); // Get the second REQUEST-STATUS. - RequestStatus.clear(); + requestStatus.clear(); - std::string RequestLanguage; + std::string requestLanguage; - if (TestEvent.ContactList.size() > 1){ + if (testEvent.requestStatusData.size() > 1){ - RequestStatus = TestEvent.RequestStatusData[1]; + requestStatus = testEvent.requestStatusData[1]; } - if (TestEvent.ContactList.size() > 1){ + if (testEvent.requestStatusData.size() > 1){ - RequestLanguage = TestEvent.RequestStatusLanguage[1]; + requestLanguage = testEvent.requestStatusLanguage[1]; } - ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus); - ASSERT_EQ("en", RequestLanguage); + ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus); + ASSERT_EQ("en", requestLanguage); // Get the third REQUEST-STATUS. - RequestStatus.clear(); + requestStatus.clear(); - std::string RequestTokens; + std::string requestTokens; - if (TestEvent.ContactList.size() > 2){ + if (testEvent.requestStatusData.size() > 2){ - RequestStatus = TestEvent.RequestStatusData[2]; + requestStatus = testEvent.requestStatusData[2]; } - if (TestEvent.ContactList.size() > 2){ + if (testEvent.requestStatusData.size() > 2){ - RequestTokens = TestEvent.RequestStatusTokens[2]; + requestTokens = testEvent.requestStatusTokens[2]; } - ASSERT_EQ("3.7;Invalid calendar user", RequestStatus); - ASSERT_EQ("USER=MISSING", RequestTokens); + ASSERT_EQ("3.7;Invalid calendar user", requestStatus); + ASSERT_EQ("USER=MISSING", requestTokens); -} \ No newline at end of file + // 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); + +}