Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit tests for the ORG vCard property for ContactDataO...
[xestiaab/.git] / source / tests / xestiaab_contactload.h
index ece3063..5746b9d 100644 (file)
@@ -1816,7 +1816,146 @@ TEST(ContactLoad, RoleTests){
        
        TestFileIter = TestFile.BusinessRoleListTokens.find(2);
        ASSERT_NE(TestFile.BusinessRoleListTokens.end(), TestFileIter);
-       ASSERT_EQ("HERE=Nope", TestFileIter->second);   
+       ASSERT_EQ("HERE=Nope", TestFileIter->second);
+
+}
+
+TEST(ContactLoad, OrganisationTests){
+
+       ContactDataObject TestFile;
+
+       // Check that the vCard 4.0 file loads OK.
+
+       ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
+
+       std::map<int,wxString>::iterator TestFileIter;
+       std::map<int,int>::iterator TestFileIntIter;
+
+       // Start with the general organisation.
+       
+       TestFileIter = TestFile.GeneralOrganisationsList.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsList.end(), TestFileIter);
+       ASSERT_EQ("Ordinary Organisation", TestFileIter->second);
+       
+       // Check the SORT-AS section.
+
+       TestFileIter = TestFile.GeneralOrganisationsListSortAs.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListSortAs.end(), TestFileIter);
+       ASSERT_EQ("Organisation, Ordinary", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.GeneralOrganisationsListAltID.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListAltID.end(), TestFileIter);
+       ASSERT_EQ("50", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.GeneralOrganisationsListPID.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListPID.end(), TestFileIter);
+       ASSERT_EQ("51", TestFileIter->second);
+       
+       // Check the LANGUAGE section.
+       
+       TestFileIter = TestFile.GeneralOrganisationsListLanguage.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListLanguage.end(), TestFileIter);
+       ASSERT_EQ("en", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.GeneralOrganisationsListPref.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListPref.end(), TestFileIntIter);
+       ASSERT_EQ(52, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.GeneralOrganisationsListTokens.find(0);
+       ASSERT_NE(TestFile.GeneralOrganisationsListTokens.end(), TestFileIter);
+       ASSERT_EQ("ASTERISK=None", TestFileIter->second);
+
+       // Start with the home Organisation.
+
+       TestFileIter = TestFile.HomeOrganisationsList.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsList.end(), TestFileIter);
+       ASSERT_EQ("Ordinary Lazy Person", TestFileIter->second);
+       
+       // Check the SORT-AS section.
+       
+       TestFileIter = TestFile.HomeOrganisationsListSortAs.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListSortAs.end(), TestFileIter);
+       ASSERT_EQ("Person, Ordinary Lazy", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.HomeOrganisationsListAltID.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListAltID.end(), TestFileIter);
+       ASSERT_EQ("60", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.HomeOrganisationsListPID.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListPID.end(), TestFileIter);
+       ASSERT_EQ("61", TestFileIter->second);
+       
+       // Check the LANGUAGE section.
+       
+       TestFileIter = TestFile.HomeOrganisationsListLanguage.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListLanguage.end(), TestFileIter);
+       ASSERT_EQ("en-GB", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.HomeOrganisationsListPref.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListPref.end(), TestFileIntIter);
+       ASSERT_EQ(62, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.HomeOrganisationsListTokens.find(1);
+       ASSERT_NE(TestFile.HomeOrganisationsListTokens.end(), TestFileIter);
+       ASSERT_EQ("SOMEWHERE=There", TestFileIter->second);
+       
+       // Start with the business Organisation.
+
+       TestFileIter = TestFile.BusinessOrganisationsList.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsList.end(), TestFileIter);
+       ASSERT_EQ("Company Owner", TestFileIter->second);
+       
+       // Check the SORT-AS section.
+       
+       TestFileIter = TestFile.BusinessOrganisationsListSortAs.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListSortAs.end(), TestFileIter);
+       ASSERT_EQ("Owner, Company", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.BusinessOrganisationsListAltID.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListAltID.end(), TestFileIter);
+       ASSERT_EQ("70", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.BusinessOrganisationsListPID.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListPID.end(), TestFileIter);
+       ASSERT_EQ("71", TestFileIter->second);
+       
+       // Check the LANGUAGE section.
+       
+       TestFileIter = TestFile.BusinessOrganisationsListLanguage.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListLanguage.end(), TestFileIter);
+       ASSERT_EQ("en-AU", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.BusinessOrganisationsListPref.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListPref.end(), TestFileIntIter);
+       ASSERT_EQ(72, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.BusinessOrganisationsListTokens.find(2);
+       ASSERT_NE(TestFile.BusinessOrganisationsListTokens.end(), TestFileIter);
+       ASSERT_EQ("HERE=Nope", TestFileIter->second);
 
 }
 
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