Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added unit tests for UID, CONTACT and DTSTART in iCalendarJournal/ObjectDataTests.
[xestiacalendar/.git] / source / tests / xestiacalendar_icalfreebusyload.h
1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar FreeBusy Component Unit Tests
2 //
3 // (c) 2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
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.
10 //
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.
15 //
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;
24         
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"));
28         
29 }
31 TEST(iCalendarFreeBusy, ObjectDataTests){
32         
33         CalendarFreeBusyObject TestFreeBusy;
34         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy.LoadFile("iCalendarFreeBusy-Load2.vcf"));
35         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestFreeBusy.ValidBaseObject());
36         
37         // Tests for DTSTAMP.
38         
39         ASSERT_EQ("20160131T173000Z", TestFreeBusy.DateTimeStampData);
40         ASSERT_EQ("OTHER=PARAM", TestFreeBusy.DateTimeStampTokens);
41         
42         // Tests for UID.
43         
44         ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306ff", TestFreeBusy.UniqueID);
45         ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestFreeBusy.UniqueIDTokens);
46         
47         // Tests for CONTACT.
48         
49         std::string ContactData;
50         std::string ContactDataAltRep;
51         std::string ContactDataLanguage;
52         std::string ContactDataTokens;
53         
54         if (TestFreeBusy.ContactList.size() > 0){
55                 
56                 ContactData = TestFreeBusy.ContactList[0];
57                 
58         }
59         
60         if (TestFreeBusy.ContactList.size() > 0){
61                 
62                 ContactDataAltRep = TestFreeBusy.ContactListAltRep[0];
63                 
64         }
65         
66         if (TestFreeBusy.ContactList.size() > 0){
67                 
68                 ContactDataLanguage = TestFreeBusy.ContactListLanguage[0];
69                 
70         }
71         
72         if (TestFreeBusy.ContactList.size() > 0){
73                 
74                 ContactDataTokens = TestFreeBusy.ContactListTokens[0];
75                 
76         }
77         
78         ASSERT_EQ("Contact Person", ContactData);
79         ASSERT_EQ("null:nodata", ContactDataAltRep);
80         ASSERT_EQ("en-GB", ContactDataLanguage);
81         ASSERT_EQ("EXAMPLE=TOKEN", ContactDataTokens);
82         
83         // Tests for DTSTART.
84         
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);
89         
90 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy