From 6b78f2e62262b742adb854fe9645ce8a7b6ff655 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 27 Jan 2016 19:39:39 +0000 Subject: [PATCH] Added unit tests for CONTACT in iCalendarEvent/ObjectDataTests. --- source/tests/xestiacalendar_icaleventload.h | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 48424f5..d2c342c 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -534,4 +534,66 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("This is the third comment.", CommentData); ASSERT_EQ("ZEBRAS=YES", CommentDataTokens); + // Get the first CONTACT. + + std::string ContactData; + + if (TestEvent.ContactList.begin() != TestEvent.ContactList.end()){ + + ContactData = TestEvent.ContactList[0]; + + } + + ASSERT_EQ("First Contact", ContactData); + + // Get the second CONTACT. + + ContactData.clear(); + + std::string ContactDataAltRep; + std::string ContactDataLanguage; + + if (TestEvent.ContactList.size() > 1){ + + ContactData = TestEvent.ContactList[1]; + + } + + if (TestEvent.ContactList.size() > 1){ + + ContactDataAltRep = TestEvent.ContactListAltRep[1]; + + } + + if (TestEvent.ContactList.size() > 1){ + + ContactDataLanguage = TestEvent.ContactListLanguage[1]; + + } + + ASSERT_EQ("Second Contact", ContactData); + ASSERT_EQ("null:nodata", ContactDataAltRep); + ASSERT_EQ("en-GB", ContactDataLanguage); + + // Get the third CONTACT. + + ContactData.clear(); + + std::string ContactDataTokens; + + if (TestEvent.ContactList.size() > 2){ + + ContactData = TestEvent.ContactList[2]; + + } + + if (TestEvent.ContactList.size() > 2){ + + ContactDataTokens = TestEvent.ContactListTokens[2]; + + } + + ASSERT_EQ("Third Contact", ContactData); + ASSERT_EQ("ZEBRAS=NO", ContactDataTokens); + } \ No newline at end of file -- 2.39.5