// xestiacalendar_icaleventload.h - Xestia Calendar iCalendar FreeBusy Component Unit Tests // // (c) 2016 Xestia Software Development. // // This file is part of Xestia Calendar. // // Xestia Address Book 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, // 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/calendarfreebusy/CalendarFreeBusy.h" TEST(iCalendarFreeBusy, BasicTests){ CalendarFreeBusyObject TestFreeBusy; ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestFreeBusy.LoadFile("iCalendarFreeBusy-Missing.vcf")); ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestFreeBusy.LoadFile("iCalendarFreeBusy-InvalidPermissions.vcf")); ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy.LoadFile("iCalendarFreeBusy-Load1.vcf")); } TEST(iCalendarFreeBusy, ObjectDataTests){ CalendarFreeBusyObject TestFreeBusy; ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy.LoadFile("iCalendarFreeBusy-Load2.vcf")); ASSERT_EQ(CALENDAROBJECTVALID_OK, TestFreeBusy.ValidBaseObject()); // Tests for DTSTAMP. ASSERT_EQ("20160131T173000Z", TestFreeBusy.DateTimeStampData); ASSERT_EQ("OTHER=PARAM", TestFreeBusy.DateTimeStampTokens); // Tests for UID. ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306ff", TestFreeBusy.UniqueID); ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestFreeBusy.UniqueIDTokens); // Tests for CONTACT. std::string ContactData; std::string ContactDataAltRep; std::string ContactDataLanguage; std::string ContactDataTokens; if (TestFreeBusy.ContactList.size() > 0){ ContactData = TestFreeBusy.ContactList[0]; } if (TestFreeBusy.ContactList.size() > 0){ ContactDataAltRep = TestFreeBusy.ContactListAltRep[0]; } if (TestFreeBusy.ContactList.size() > 0){ ContactDataLanguage = TestFreeBusy.ContactListLanguage[0]; } if (TestFreeBusy.ContactList.size() > 0){ ContactDataTokens = TestFreeBusy.ContactListTokens[0]; } ASSERT_EQ("Contact Person", ContactData); ASSERT_EQ("null:nodata", ContactDataAltRep); ASSERT_EQ("en-GB", ContactDataLanguage); ASSERT_EQ("EXAMPLE=TOKEN", ContactDataTokens); // Tests for DTSTART. ASSERT_EQ("20160131T103000Z", TestFreeBusy.DateTimeStartData); ASSERT_EQ("DATE-TIME", TestFreeBusy.DateTimeStartDataValue); ASSERT_EQ("Europe/Truro", TestFreeBusy.DateTimeStartDataTimeZoneID); ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestFreeBusy.DateTimeStartDataTokens); // Tests for DTEND. ASSERT_EQ("20160131T183000Z", TestFreeBusy.DateTimeEndData); ASSERT_EQ("DATE-TIME", TestFreeBusy.DateTimeEndDataValue); ASSERT_EQ("Europe/Truro", TestFreeBusy.DateTimeEndDataTimeZoneID); ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", TestFreeBusy.DateTimeEndDataTokens); }