Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code and unit tests for BDAY and ANNIVERSARY in the ContactDataObject.
[xestiaab/.git] / source / tests / xestiaab_contactload.h
index 6ace86f..10d10b0 100644 (file)
@@ -154,7 +154,20 @@ TEST(ContactLoad, ContactLoadTests){
        // Check the extra tokens parameter.
        
        ASSERT_EQ("TEST=Yes", TestFile.NameTokens);
-       
+
+}
+
+TEST(ContactLoad, NicknameTests){
+
+       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;
+
        // Check that the nickname has been read (NICKNAME). General.
        
        TestFileIter = TestFile.GeneralNicknamesList.find(0);
@@ -265,4 +278,104 @@ TEST(ContactLoad, ContactLoadTests){
 
 }
 
+TEST(ContactLoad, GenderTests){
+
+       // Check that the gender has been read.
+
+       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;
+       
+       ASSERT_NE("", TestFile.Gender);
+       ASSERT_EQ("F", TestFile.Gender);
+       ASSERT_EQ("Example Text", TestFile.GenderDetails);
+       ASSERT_EQ("BEEP=Boop", TestFile.GenderTokens);
+
+}
+
+TEST(ContactLoad, BirthdayTests){
+
+       // Check that the birthday has been read.
+
+       // Check that the gender has been read.
+
+       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;
+       
+       ASSERT_NE("", TestFile.Birthday);
+       ASSERT_EQ("20040101", TestFile.Birthday);
+       
+       // Check the ALTID parameter.
+       
+       ASSERT_EQ("35", TestFile.BirthdayAltID);
+       
+       // Check the CALSCALE parameter.
+       
+       ASSERT_EQ("georgian", TestFile.BirthdayCalScale);
+       
+       // Check the extra tokens parameter.
+
+       ASSERT_EQ("HAPPY=Days", TestFile.BirthdayTokens);
+       
+       // Check the VALUE parameter. (Note have to use a different file
+       // due to the *1 rule in RFC6350.
+       
+       ContactDataObject TestFileValue;
+       ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf"));
+       
+       ASSERT_EQ("Circa 2000s", TestFile.Birthday);
+       
+}
+
+TEST(ContactLoad, AnniversaryTests){
+
+       // Check that the birthday has been read.
+
+       // Check that the gender has been read.
+
+       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;
+       
+       ASSERT_NE("", TestFile.Anniversary);
+       ASSERT_EQ("20200516", TestFile.Anniversary);
+       
+       // Check the ALTID parameter.
+       
+       ASSERT_EQ("70", TestFile.AnniversaryAltID);
+       
+       // Check the CALSCALE parameter.
+       
+       ASSERT_EQ("georgian", TestFile.AnniversaryCalScale);
+       
+       // Check the extra tokens parameter.
+
+       ASSERT_EQ("WONDERFUL=Day", TestFile.AnniversaryTokens);
+       
+       // Check the VALUE parameter. (Note have to use a different file
+       // due to the *1 rule in RFC6350.
+       
+       ContactDataObject TestFileValue;
+       ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf"));
+       
+       ASSERT_EQ("Circa 2020s", TestFile.Anniversary); 
+
+}
+
 // TODO: Add tests for the Contact Loading process.
\ 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