X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Ftests%2Fxestiaab_contactload.h;h=9239d5e96395e8af73fcb16b1bce370ae80fcfd2;hp=07160e05537e2bf4ff36b0aff6254bd25a13cf2e;hb=134b7476fefe9440a5120b15e3d913afc9c48f04;hpb=17d33f5a39d1b64be75d308a78467290e96b7e38 diff --git a/source/tests/xestiaab_contactload.h b/source/tests/xestiaab_contactload.h index 07160e0..9239d5e 100644 --- a/source/tests/xestiaab_contactload.h +++ b/source/tests/xestiaab_contactload.h @@ -1,6 +1,6 @@ // xestiaab_contactload.h - Xestia Address Book Contact Load Unit Tests. // -// (c) 2012-2015 Xestia Software Development. +// (c) 2012-2017 Xestia Software Development. // // This file is part of Xestia Address Book. // @@ -17,146 +17,593 @@ // with Xestia Address Book. If not, see #include -#include "../contacteditor/ContactDataObject.h" +#include "../contacteditor/cdo/ContactDataObject.h" -TEST(ContactLoad, ContactLoadTests){ +TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledWithMissingFileThenReturnFileMissingError) +{ - ContactDataObject TestFile; + // Given + + ContactDataObject testFile; + + // When + + ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL; + testFile.LoadFile("MissingFile.vcf"); + + // Then + + ASSERT_EQ(CONTACTLOAD_FILEMISSING, testFileLoadStatus); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledWithInvalidPermissionsSetThenReturnInvalidPermissionsError) +{ - // Check that the file given is not missing. + // Given - ASSERT_EQ(CONTACTLOAD_FILEMISSING, TestFile.LoadFile("MissingFile.vcf")); + ContactDataObject testFile; - // Check that the file given does not have an error when attempting to - // open it. + // When + + ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL; + testFileLoadStatus = testFile.LoadFile("InvalidPermissions.vcf"); - ASSERT_EQ(CONTACTLOAD_FILEERROR, TestFile.LoadFile("InvalidPermissions.vcf")); + // Then + + ASSERT_EQ(CONTACTLOAD_FILEERROR, testFileLoadStatus); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledWithInvalidFormatThenReturnInvalidFormatError) +{ + + // Given - // Check that the file is a valid vCard 4.0 file. + ContactDataObject testFile; - ASSERT_EQ(CONTACTLOAD_FILEINVALIDFORMAT, TestFile.LoadFile("LoadCheck-Load1-v3.vcf")); + // When - // Check that the vCard 4.0 file meets the base specification. + ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL; + testFileLoadStatus = testFile.LoadFile("LoadCheck-Load1-v3.vcf"); - ASSERT_EQ(CONTACTLOAD_FILEBASESPECFAIL, TestFile.LoadFile("LoadCheck-Load3.vcf")); + // Then - // Check that the vCard 4.0 file loads OK. + ASSERT_EQ(CONTACTLOAD_FILEINVALIDFORMAT, testFileLoadStatus); - ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); +} + +TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledWithNonMeetingBaseSpecificationThenReturnFileBaseSpecificationError) +{ + + // Given + + ContactDataObject testFile; + + // When + + ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL; + testFileLoadStatus = testFile.LoadFile("LoadCheck-Load3.vcf"); + + // Then + + ASSERT_EQ(CONTACTLOAD_FILEBASESPECFAIL, testFileLoadStatus); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledThenContactLoadedOK) +{ + + // Given + + ContactDataObject testFile; + + // When + + ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL; + testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + + // Then + + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + +} + +TEST(ContactLoad, GivenLoadedContactDataObjectWhenContactKindIsCheckedThenContactKindIsIndividual) +{ + + // Check that the kind status has been set. (KIND). + + // Given + ContactDataObject testFile; + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + ContactKindType testFileContactKindStatus = TestFile.ContactKind; + + // Then // Check that the kind status has been set. (KIND). - ASSERT_NE(CONTACTKIND_NONE, TestFile.ContactKind); - ASSERT_EQ(CONTACTKIND_INDIVIDUAL, TestFile.ContactKind); + ASSERT_NE(CONTACTKIND_NONE, testFileContactKindStatus); + ASSERT_EQ(CONTACTKIND_INDIVIDUAL, testFileContactKindStatus); +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListForFirstGroupThenOnlyFirstGroupIsReturned) +{ + // Check that the groups have been read (MEMBER). + + std::map::iterator testFileIter; + + // Given + + ContactDataObject testFile; + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - std::map::iterator TestFileIter; - std::map::iterator TestFileIntIter; + // When + + testFileIter = testFile.GroupsList.find(0); - TestFileIter = TestFile.GroupsList.find(0); + // Then - ASSERT_NE(TestFile.GroupsList.end(), TestFileIter); - ASSERT_EQ("7a2af44d-6431-4797-a55f-d86d56304fda", TestFileIter->second); + ASSERT_NE(testFile.GroupsList.end(), testFileIter); + ASSERT_EQ("7a2af44d-6431-4797-a55f-d86d56304fda", testFileIter->second); - // Check the ALTID parameter. +} - TestFileIter = TestFile.GroupsListAltID.find(0); - ASSERT_NE(TestFile.GroupsListAltID.end(), TestFileIter); - ASSERT_EQ("35", TestFileIter->second); +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListAltIDForFirstGroupThenOnlyFirstGroupAltIDIsReturned) +{ - // Check the PID parameter. + // Check the ALTID parameter for MEMBER. + + std::map::iterator testFileIter; + + // Given - TestFileIter = TestFile.GroupsListPID.find(0); - ASSERT_NE(TestFile.GroupsListPID.end(), TestFileIter); - ASSERT_EQ("40", TestFileIter->second); + ContactDataObject testFile; + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check the PREF parameter. + // When - TestFileIntIter = TestFile.GroupsListPref.find(0); - ASSERT_NE(TestFile.GroupsListPref.end(), TestFileIntIter); - ASSERT_EQ(45, TestFileIntIter->second); + testFileIter = testFile.GroupsListAltID.find(0); - // Check the MEDIATYPE parameter. + // Then + + ASSERT_NE(testFile.GroupsListAltID.end(), testFileIter); + ASSERT_EQ("35", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListPIDForFirstGroupThenOnlyFirstGroupPIDIsReturned) +{ + + // Check the PID parameter for MEMBER. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + + // Given - TestFileIter = TestFile.GroupsListMediaType.find(0); - ASSERT_NE(TestFile.GroupsListMediaType.end(), TestFileIter); - ASSERT_EQ("text/plain", TestFileIter->second); + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check the extra tokens parameter. + // When + + testFileIter = testFile.GroupsListPID.find(0); - TestFileIter = TestFile.GroupsListTokens.find(0); - ASSERT_NE(TestFile.GroupsListTokens.end(), TestFileIter); - ASSERT_EQ("EXAMPLE=Meep", TestFileIter->second); + // Then + + ASSERT_NE(testFile.GroupsListPID.end(), testFileIter); + ASSERT_EQ("40", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListPreferenceForFirstGroupThenOnlyFirstGroupPreferenceIsReturned) +{ + + // Check the PREF parameter for MEMBER. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + testFileIntIter = testFile.GroupsListPref.find(0); + // Then + + ASSERT_NE(testFile.GroupsListPref.end(), testFileIntIter); + ASSERT_EQ(45, testFileIntIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListMediatypeForFirstGroupThenOnlyFirstGroupMediatypeIsReturned) +{ + + // Check the MEDIATYPE parameter for MEMBER. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + testFileIter = testFile.GroupsListMediaType.find(0); + + // Then + + ASSERT_NE(testFile.GroupsListMediaType.end(), testFileIter); + ASSERT_EQ("text/plain", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnGroupsListExtraTokensForFirstGroupThenOnlyFirstGroupExtraTokensIsReturned) +{ + + // Check the extra tokens parameter for MEMBER. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + TestFileIter = testFile.GroupsListTokens.find(0); + + // Then + + ASSERT_NE(testFile.GroupsListTokens.end(), testFileIter); + ASSERT_EQ("EXAMPLE=Meep", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNameForFirstFullNameThenOnlyFirstFullNameIsReturned) +{ + // Check that the formatted name has been read (FN). + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - TestFileIter = TestFile.FullNamesList.find(0); - ASSERT_NE(TestFile.FullNamesList.end(), TestFileIter); - ASSERT_EQ("Test Contact", TestFileIter->second); + // When - // Check the TYPE parameter. + testFileIter = testFile.FullNamesList.find(0); - TestFileIter = TestFile.FullNamesListType.find(0); - ASSERT_NE(TestFile.FullNamesListType.end(), TestFileIter); - ASSERT_EQ("work", TestFileIter->second); + // Then + + ASSERT_NE(testFile.FullNamesList.end(), testFileIter); + ASSERT_EQ("Test Contact", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNameTypeForFirstFullNameThenOnlyFirstFullNameTypeIsReturned) +{ + + // Check the TYPE parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + testFileIter = testFile.FullNamesListType.find(0); + + // Then + + ASSERT_NE(testFile.FullNamesListType.end(), testFileIter); + ASSERT_EQ("work", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNameLanguageForFirstFullNameThenOnlyFirstFullNameLanguageIsReturned) +{ + + // Check the LANGUAGE parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check the LANGUAGE parameter. + // When + + testFileIter = testFile.FullNamesListLanguage.find(0); + + // Then + + ASSERT_NE(testFile.FullNamesListLanguage.end(), testFileIter); + ASSERT_EQ("kw", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNameAltIDForFirstFullNameThenOnlyFirstFullNameAltIDIsReturned) +{ + + // Check the ALTID parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - TestFileIter = TestFile.FullNamesListLanguage.find(0); - ASSERT_NE(TestFile.FullNamesListLanguage.end(), TestFileIter); - ASSERT_EQ("kw", TestFileIter->second); + // When - // Check the ALTID parameter. + testFileIter = testFile.FullNamesListAltID.find(0); + + // Then - TestFileIter = TestFile.FullNamesListAltID.find(0); - ASSERT_NE(TestFile.FullNamesListAltID.end(), TestFileIter); - ASSERT_EQ("500", TestFileIter->second); + ASSERT_NE(testFile.FullNamesListAltID.end(), testFileIter); + ASSERT_EQ("500", testFileIter->second); - // Check the PID parameter. +} - TestFileIter = TestFile.FullNamesListPID.find(0); - ASSERT_NE(TestFile.FullNamesListPID.end(), TestFileIter); - ASSERT_EQ("40", TestFileIter->second); +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNamePIDForFirstFullNameThenOnlyFirstFullNamePIDIsReturned) +{ + + // Check the PID parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check the PREF parameter. + // When - TestFileIntIter = TestFile.FullNamesListPref.find(0); - ASSERT_NE(TestFile.FullNamesListPref.end(), TestFileIntIter); - ASSERT_EQ(45, TestFileIntIter->second); + testFileIter = testFile.FullNamesListPID.find(0); + + // Then + + ASSERT_NE(testFile.FullNamesListPID.end(), testFileIter); + ASSERT_EQ("40", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNamePrefForFirstFullNameThenOnlyFirstFullNamePrefIsReturned) +{ + + // Check the PREF parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check for the extra tokens parameter. + // When + + testFileIntIter = testFile.FullNamesListPref.find(0); - TestFileIter = TestFile.FullNamesListTokens.find(0); - ASSERT_NE(TestFile.FullNamesListTokens.end(), TestFileIter); - ASSERT_EQ("EXAMPLE=Baaa", TestFileIter->second); + // Then + + ASSERT_NE(testFile.FullNamesListPref.end(), testFileIntIter); + ASSERT_EQ(45, testFileIntIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenFindIsCalledOnFullNameExtraTokensForFirstFullNameThenOnlyFirstFullNameExtraTokensIsReturned) +{ + + // Check for the extra tokens parameter for FN. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check that the name has been read (N). + // When - ASSERT_EQ("Contact", TestFile.NameSurname); - ASSERT_EQ("Test", TestFile.NameForename); - ASSERT_EQ("Example", TestFile.NameOtherNames); - ASSERT_EQ("Robot", TestFile.NameTitle); - ASSERT_EQ("LOONY", TestFile.NameSuffix); + testFileIter = testFile.FullNamesListTokens.find(0); - // Check the ALTID parameter. + // Then + + ASSERT_NE(testFile.FullNamesListTokens.end(), testFileIter); + ASSERT_EQ("EXAMPLE=Baaa", testFileIter->second); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenNameValuesAreRetrievedThenValuesForNameIsReturned) +{ + + // Check that the name has been read for N. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + wxString nameSurname = testFile.NameSurname; + wxString nameForename = testFile.NameForename; + wxString nameOtherNames = testFile.NameOtherNames; + wxString nameTitle = testFile.NameTitle; + wxString nameSuffix = testFile.NameSuffix; + + // Then + + ASSERT_EQ("Contact", nameSurname); + ASSERT_EQ("Test", nameForename); + ASSERT_EQ("Example", nameOtherNames); + ASSERT_EQ("Robot", nameTitle); + ASSERT_EQ("LOONY", nameSuffix); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenNameAltIDIsRetrievedThenValueforNameAltIDIsReturned) +{ + + // Check the ALTID parameter for N. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - ASSERT_EQ("3", TestFile.NameAltID); + // When + + wxString nameAltID = TestFile.NameAltID; - // Check the LANGUAGE parameter. + // Then - ASSERT_EQ("kw", TestFile.NameLanguage); + ASSERT_EQ("3", nameAltID); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenNameAltIDIsRetrievedThenValueforNameAltIDIsReturned) +{ + + // Check the LANGUAGE parameter for N. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + wxString nameLanguage = TestFile.NameLanguage; + + // Then + + ASSERT_EQ("kw", nameLanguage); + +} + +TEST(ContactLoad, GivenContactDataObjectWhenNameDisplayAsIsRetrievedThenValueforNameDisplayAsIsReturned) +{ + + // Check the SORT-AS parameter for N. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - // Check the SORT-AS parameter. + // When + + wxString nameDisplayAs = TestFile.NameDisplayAs; + + // Then - ASSERT_EQ("Contact,Test", TestFile.NameDisplayAs); + ASSERT_EQ("Contact,Test", nameDisplayAs); - // Check the extra tokens parameter. +} + +TEST(ContactLoad, GivenContactDataObjectWhenNameExtraTokensIsRetrievedThenValueforNameExtraTokensIsReturned) +{ + + // Check the extra tokens parameter for N. + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); - ASSERT_EQ("TEST=Yes", TestFile.NameTokens); + // When + + wxString nameTokens = testFile.NameTokens; + + // Then + + ASSERT_EQ("TEST=Yes", nameTokens); } +/* TEMPLATE: PLEASE COPY BEFORE USING IT. */ + +TEST(ContactLoad, GivenWhenThen) +{ + + std::map::iterator testFileIter; + std::map::iterator testFileIntIter; + ContactDataObject testFile; + + // Given + + ContactLoadStatus testFileLoadStatus = testFile.LoadFile("LoadCheck-Load4.vcf"); + ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus); + + // When + + // Then + +} + +/* END OF TEMPLATE: LOOK UP */ + TEST(ContactLoad, UIDTest){ ContactDataObject TestFile; @@ -169,6 +616,44 @@ TEST(ContactLoad, UIDTest){ } +TEST(ContactLoad, ClientPIDMapTests){ + + ContactDataObject TestFile; + + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); + + std::map::iterator TestFileIter; + + // Test the first Client PID Map. + + TestFileIter = TestFile.ClientPIDList.find(0); + ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter); + ASSERT_EQ("1;urn;uuid:aaaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", TestFileIter->second); + + TestFileIter = TestFile.ClientPIDListTokens.find(0); + ASSERT_EQ(TestFile.ClientPIDListTokens.end(), TestFileIter); + + // Test the second Client PID Map. + + TestFileIter = TestFile.ClientPIDList.find(1); + ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter); + ASSERT_EQ("2;urn;uuid:ccccccccc-cccc-cccc-cccc-cccccccccccc", TestFileIter->second); + + TestFileIter = TestFile.ClientPIDListTokens.find(1); + ASSERT_EQ(TestFile.ClientPIDListTokens.end(), TestFileIter); + + // Test the third Client PID Map. + + TestFileIter = TestFile.ClientPIDListTokens.find(2); + ASSERT_NE(TestFile.ClientPIDListTokens.end(), TestFileIter); + ASSERT_EQ("MEEP=MOO;WOOP=WOO", TestFileIter->second); + + TestFileIter = TestFile.ClientPIDList.find(2); + ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter); + ASSERT_EQ("3;urn;uuid:bbbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", TestFileIter->second); + +} + TEST(ContactLoad, RevisionTests){ ContactDataObject TestFile; @@ -759,7 +1244,7 @@ TEST(ContactLoad, AddressTests){ TestFileIter = TestFile.GeneralAddressListGeo.find(0); ASSERT_NE(TestFile.GeneralAddressListGeo.end(), TestFileIter); - ASSERT_EQ("\"geo:1.0, 1.0\"", TestFileIter->second); + ASSERT_EQ("geo:1.0, 1.0", TestFileIter->second); // Check the TZ section. @@ -845,7 +1330,7 @@ TEST(ContactLoad, AddressTests){ TestFileIter = TestFile.HomeAddressListGeo.find(1); ASSERT_NE(TestFile.HomeAddressListGeo.end(), TestFileIter); - ASSERT_EQ("\"geo:4.0, 4.0\"", TestFileIter->second); + ASSERT_EQ("geo:4.0, 4.0", TestFileIter->second); // Check the TZ section. @@ -931,7 +1416,7 @@ TEST(ContactLoad, AddressTests){ TestFileIter = TestFile.BusinessAddressListGeo.find(2); ASSERT_NE(TestFile.BusinessAddressListGeo.end(), TestFileIter); - ASSERT_EQ("\"geo:7.0, 7.0\"", TestFileIter->second); + ASSERT_EQ("geo:7.0, 7.0", TestFileIter->second); // Check the TZ section. @@ -1199,13 +1684,19 @@ TEST(ContactLoad, TelephoneTests){ TestFileIter = TestFile.GeneralTelephoneList.find(0); ASSERT_NE(TestFile.GeneralTelephoneList.end(), TestFileIter); - ASSERT_EQ("tel:00000000", TestFileIter->second); + ASSERT_EQ("00000000", TestFileIter->second); + + // Check the data type section. + + TestFileIter = TestFile.GeneralTelephoneListDataType.find(0); + ASSERT_NE(TestFile.GeneralTelephoneListDataType.end(), TestFileIter); + ASSERT_EQ("tel", TestFileIter->second); // Check the type section. TestFileIter = TestFile.GeneralTelephoneListTypeInfo.find(0); ASSERT_NE(TestFile.GeneralTelephoneListTypeInfo.end(), TestFileIter); - ASSERT_EQ("fax,mobile", TestFileIter->second); + ASSERT_EQ("fax,cell", TestFileIter->second.ToStdString()); // Check the ALTID section. @@ -1235,7 +1726,13 @@ TEST(ContactLoad, TelephoneTests){ TestFileIter = TestFile.HomeTelephoneList.find(1); ASSERT_NE(TestFile.HomeTelephoneList.end(), TestFileIter); - ASSERT_EQ("tel:00001111", TestFileIter->second); + ASSERT_EQ("00001111", TestFileIter->second); + + // Check the data type section. + + TestFileIter = TestFile.HomeTelephoneListDataType.find(1); + ASSERT_NE(TestFile.HomeTelephoneListDataType.end(), TestFileIter); + ASSERT_EQ("tel", TestFileIter->second); // Check the type section. @@ -1271,7 +1768,13 @@ TEST(ContactLoad, TelephoneTests){ TestFileIter = TestFile.BusinessTelephoneList.find(2); ASSERT_NE(TestFile.BusinessTelephoneList.end(), TestFileIter); - ASSERT_EQ("tel:22221111", TestFileIter->second); + ASSERT_EQ("22221111", TestFileIter->second); + + // Check the data type section. + + TestFileIter = TestFile.BusinessTelephoneListDataType.find(2); + ASSERT_NE(TestFile.BusinessTelephoneListDataType.end(), TestFileIter); + ASSERT_EQ("tel", TestFileIter->second); // Check the type section. @@ -1423,7 +1926,7 @@ TEST(ContactLoad, GeographicTests){ TestFileIter = TestFile.GeneralGeographyList.find(0); ASSERT_NE(TestFile.GeneralGeographyList.end(), TestFileIter); - ASSERT_EQ("geo:3.5,3.5", TestFileIter->second); + ASSERT_EQ("3.5,3.5", TestFileIter->second); // Check the ALTID section. @@ -1459,7 +1962,7 @@ TEST(ContactLoad, GeographicTests){ TestFileIter = TestFile.HomeGeographyList.find(1); ASSERT_NE(TestFile.HomeGeographyList.end(), TestFileIter); - ASSERT_EQ("geo:7.0,7.0", TestFileIter->second); + ASSERT_EQ("7.0,7.0", TestFileIter->second); // Check the ALTID section. @@ -1495,7 +1998,7 @@ TEST(ContactLoad, GeographicTests){ TestFileIter = TestFile.BusinessGeographyList.find(2); ASSERT_NE(TestFile.BusinessGeographyList.end(), TestFileIter); - ASSERT_EQ("geo:14.0,14.0", TestFileIter->second); + ASSERT_EQ("14.0,14.0", TestFileIter->second); // Check the ALTID section. @@ -2540,6 +3043,11 @@ TEST(ContactLoad, PhotoTests){ ASSERT_NE(TestFile.PicturesListPID.end(), TestFileIter); ASSERT_EQ("71", TestFileIter->second); + // Check the TYPE section. + + TestFileIter = TestFile.PicturesListType.find(0); + ASSERT_EQ(TestFile.PicturesListType.end(), TestFileIter); + // Check the MEDIATYPE section. TestFileIter = TestFile.PicturesListMediatype.find(0); @@ -2589,6 +3097,12 @@ TEST(ContactLoad, PhotoTests){ ASSERT_NE(TestFile.PicturesListPID.end(), TestFileIter); ASSERT_EQ("21", TestFileIter->second); + // Check the TYPE section. + + TestFileIter = TestFile.PicturesListType.find(1); + ASSERT_NE(TestFile.PicturesListType.end(), TestFileIter); + ASSERT_EQ("home", TestFileIter->second); + // Check the MEDIATYPE section. TestFileIter = TestFile.PicturesListMediatype.find(1); @@ -2638,6 +3152,12 @@ TEST(ContactLoad, PhotoTests){ ASSERT_NE(TestFile.PicturesListPID.end(), TestFileIter); ASSERT_EQ("91", TestFileIter->second); + // Check the TYPE section. + + TestFileIter = TestFile.PicturesListType.find(2); + ASSERT_NE(TestFile.PicturesListType.end(), TestFileIter); + ASSERT_EQ("work", TestFileIter->second); + // Check the MEDIATYPE section. TestFileIter = TestFile.PicturesListMediatype.find(2); @@ -2701,6 +3221,8 @@ TEST(ContactLoad, LogoTests){ ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter); ASSERT_EQ("71", TestFileIter->second); + // Check the TYPE section. + // Check the MEDIATYPE section. TestFileIter = TestFile.LogosListMediatype.find(0); @@ -2749,6 +3271,12 @@ TEST(ContactLoad, LogoTests){ TestFileIter = TestFile.LogosListPID.find(1); ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter); ASSERT_EQ("21", TestFileIter->second); + + // Check the TYPE section. + + TestFileIter = TestFile.LogosListType.find(1); + ASSERT_NE(TestFile.LogosListType.end(), TestFileIter); + ASSERT_EQ("home", TestFileIter->second); // Check the MEDIATYPE section. @@ -2799,6 +3327,12 @@ TEST(ContactLoad, LogoTests){ ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter); ASSERT_EQ("91", TestFileIter->second); + // Check the TYPE section. + + TestFileIter = TestFile.LogosListType.find(2); + ASSERT_NE(TestFile.LogosListType.end(), TestFileIter); + ASSERT_EQ("work", TestFileIter->second); + // Check the MEDIATYPE section. TestFileIter = TestFile.LogosListMediatype.find(2); @@ -4229,6 +4763,4 @@ TEST(ContactLoad, XTokenTest){ ASSERT_NE(TestFile.XTokenListTokens.end(), TestFileIter); ASSERT_EQ("FOODS;STATUS=FAVOURITE;TYPE=CHEESEANDONION", TestFileIter->second.ToStdString()); -} - -// TODO: Add tests for the Contact Loading process. \ No newline at end of file +} \ No newline at end of file