#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