ContactSaveStatus SaveDataStatus = CONTACTSAVE_UNITTESTFAIL;
+ // Write the header for the vCard data file.
+ SaveData->Append("BEGIN:VCARD\n");
+ SaveData->Append("VERSION:4.0\n");
+
+ // Write the product ID.
+
+#ifdef XAB_UNITTEST
+
+ SaveData->Append("PRODID:-//Xestia//Address Book Unit Testing//KW\n");
+
+#else
+
+ SaveData->Append(wxT("-//Xestia//Address Book Version "));
+ SaveData->Append(wxT(XSDAB_VERSION));
+ SaveData->Append(wxT("//KW\n"));
+
+#endif
+
+ // Process FN.
+
+ for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
+ FNIter != FullNamesList.end(); FNIter++){
+
+ SaveData->Append("FN:");
+ SaveData->Append(FNIter->second);
+ SaveData->Append("\n");
+
+ }
+
+ // Process TITLE.
+
+ for (std::map<int, wxString>::iterator TitleIter = GeneralTitleList.begin();
+ TitleIter != GeneralTitleList.end(); TitleIter++){
+
+ SaveData->Append("TITLE:");
+ SaveData->Append(TitleIter->second);
+ SaveData->Append("\n");
+
+ }
+
+ // Write the end part of the vCard data file.
+
+ SaveData->Append("END:VCARD");
+
+ SaveDataStatus = CONTACTSAVE_OK;
return SaveDataStatus;
ContactDataObject TestFile1;
wxString SaveData;
+ wxString SaveDataCompare = "BEGIN:VCARD\n"
+ "VERSION:4.0\n"
+ "PRODID:-//Xestia//Address Book Unit Testing//KW\n"
+ "FN:Test vCard\n"
+ "TITLE:Knight of the Tests\n"
+ "TITLE:The Tester of Cornwall\n"
+ "END:VCARD";
ASSERT_EQ(CONTACTLOAD_OK, TestFile1.LoadFile("LoadCheck-Load1.vcf"));
ASSERT_EQ(CONTACTSAVE_OK, TestFile1.SaveString(&SaveData));
+ ASSERT_EQ(SaveDataCompare, SaveData);
}
\ No newline at end of file