Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added more unit tests for saving data in CalendarEventObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 May 2016 06:31:35 +0000 (07:31 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 May 2016 06:31:35 +0000 (07:31 +0100)
First tests deal with iCalendarEvent-Load1.vcf

source/tests/xestiacalendar_icaleventsave.h

index bfe7caa..bd00909 100644 (file)
 
 #include "../objects/calendarevent/CalendarEvent.h"
 
-TEST(iCalendarSaveEvent, BasicTests){
+TEST(iCalendarSaveEvent, SaveEventTests){
 
        CalendarEventObject TestEvent;
        
        // Load the test event.
        
-       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load2.vcf"));
+       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load1.vcf"));
+       ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject());
        
        //ASSERT_EQ(CALENDAROBJECTSAVE_MISSING, TestEvent.LoadFile("iCalendarEvent-Missing.vcf"));
        //ASSERT_EQ(CALENDAROBJECTSAVE_CANNOTOPEN, TestEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
        //ASSERT_EQ(CALENDAROBJECTSAVE_OK, TestEvent.LoadFile("iCalendarEvent-Load1.vcf"));
+
+       ASSERT_EQ(CALENDAROBJECTSAVE_CANNOTOPEN, TestEvent.SaveFile("/stupidfilelocation/dontsavehere.ics"));
+       
+       // Save the data to a string and compare the data.
+
+       // First contact file.
+       
+       std::string SaveDataComparison = "BEGIN:VCARD\n"
+       "VERSION:2.0\n"
+       "METHOD;EXAMPLE=DATA:REQUEST\n"
+       "CALSCALE;MORE=YES:GREGORIAN\n"
+       "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+       "BEGIN:VEVENT\n"
+       "UID:329128-12939123-123123-13\n"
+       "DTSTAMP:20160116T190200Z\n"
+       "DTSTART:20160116T190200Z\n"
+       "DTEND:20160116T190200Z\n"
+       "SUMMARY:Unit Test Event 1 which has to be a really long summary as we don't k\n"
+       " now if multiple line processing is going to work without it. I mean seriousl\n"
+       " y, how annoying can this potentially be?\n"
+       "END:VEVENT\n"
+       "END:VCARD";
+       
+       std::string SaveData;
+       
+       TestEvent.SaveString(&SaveData);
+       
+       ASSERT_EQ(SaveDataComparison, SaveData);
        
 }
\ No newline at end of file
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