1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar FreeBusy Component Unit Tests
3 // (c) 2016 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "../objects/calendarfreebusy/CalendarFreeBusy.h"
21 TEST(iCalendarFreeBusy, BasicTests){
23 CalendarFreeBusyObject TestFreeBusy;
25 ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestFreeBusy.LoadFile("iCalendarFreeBusy-Missing.vcf"));
26 ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestFreeBusy.LoadFile("iCalendarFreeBusy-InvalidPermissions.vcf"));
27 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy.LoadFile("iCalendarFreeBusy-Load1.vcf"));
31 TEST(iCalendarFreeBusy, ObjectDataTests){
33 CalendarFreeBusyObject TestFreeBusy;
34 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy.LoadFile("iCalendarFreeBusy-Load2.vcf"));
35 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestFreeBusy.ValidBaseObject());
39 ASSERT_EQ("20160131T173000Z", TestFreeBusy.DateTimeStampData);
40 ASSERT_EQ("OTHER=PARAM", TestFreeBusy.DateTimeStampTokens);
44 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306ff", TestFreeBusy.UniqueID);
45 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestFreeBusy.UniqueIDTokens);
49 std::string ContactData;
50 std::string ContactDataAltRep;
51 std::string ContactDataLanguage;
52 std::string ContactDataTokens;
54 if (TestFreeBusy.ContactList.size() > 0){
56 ContactData = TestFreeBusy.ContactList[0];
60 if (TestFreeBusy.ContactList.size() > 0){
62 ContactDataAltRep = TestFreeBusy.ContactListAltRep[0];
66 if (TestFreeBusy.ContactList.size() > 0){
68 ContactDataLanguage = TestFreeBusy.ContactListLanguage[0];
72 if (TestFreeBusy.ContactList.size() > 0){
74 ContactDataTokens = TestFreeBusy.ContactListTokens[0];
78 ASSERT_EQ("Contact Person", ContactData);
79 ASSERT_EQ("null:nodata", ContactDataAltRep);
80 ASSERT_EQ("en-GB", ContactDataLanguage);
81 ASSERT_EQ("EXAMPLE=TOKEN", ContactDataTokens);
85 ASSERT_EQ("20160131T103000Z", TestFreeBusy.DateTimeStartData);
86 ASSERT_EQ("DATE-TIME", TestFreeBusy.DateTimeStartDataValue);
87 ASSERT_EQ("Europe/Truro", TestFreeBusy.DateTimeStartDataTimeZoneID);
88 ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestFreeBusy.DateTimeStartDataTokens);
92 ASSERT_EQ("20160131T183000Z", TestFreeBusy.DateTimeEndData);
93 ASSERT_EQ("DATE-TIME", TestFreeBusy.DateTimeEndDataValue);
94 ASSERT_EQ("Europe/Truro", TestFreeBusy.DateTimeEndDataTimeZoneID);
95 ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", TestFreeBusy.DateTimeEndDataTokens);
97 // Tests for ORGANIZER.
99 ASSERT_EQ("mailto:organiser@example.com", TestFreeBusy.OrganiserData);
100 ASSERT_EQ("ExampleOrganiser", TestFreeBusy.OrganiserDataCommonName);
101 ASSERT_EQ("null:nodata", TestFreeBusy.OrganiserDataDirectoryEntry);
102 ASSERT_EQ("mailto:organiser.noreply@example.com", TestFreeBusy.OrganiserDataSentByParam);
103 ASSERT_EQ("kw", TestFreeBusy.OrganiserDataLanguage);
104 ASSERT_EQ("HAPPY=DAYS", TestFreeBusy.OrganiserDataTokens);
108 ASSERT_EQ("http://www.example.com/", TestFreeBusy.URLData);
109 ASSERT_EQ("EXTERNAL=YES", TestFreeBusy.URLDataTokens);