From 49e80bcbb5cd9d3758216fd771d1ae57fd5d7e16 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 27 Jan 2016 16:51:48 +0000 Subject: [PATCH] Added unit tests for ATTENDEE in iCalendarEvent/ObjectDataTests. --- source/tests/xestiacalendar_icaleventload.h | 125 ++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 865d16a..5a30678 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -285,4 +285,129 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("BINARY", AttachDataValue); ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); + // Tests for ATTENDEE. First ATTENDEE property. + + std::string AttendeeDataMember; + std::string AttendeeDataDelegatedFrom; + std::string AttendeeDataDelegatedTo; + std::string AttendeeDataRole; + std::string AttendeeDataRSVP; + std::string AttendeeDataDirectoryEntry; + std::string AttendeeDataSentBy; + std::string AttendeeDataCommonName; + std::string AttendeeDataCalendarUserType; + std::string AttendeeDataParticipationStatus; + std::string AttendeeDataLanguage; + std::string AttendeeDataTokens; + std::string AttendeeData; + + if (TestEvent.AttendeeList.begin() != TestEvent.AttendeeList.end()){ + + AttendeeData = TestEvent.AttendeeList[0]; + + } + + ASSERT_EQ("Attendee One", AttendeeData); + + // Second ATTENDEE property. + + AttendeeData.clear(); + + if (TestEvent.AttendeeList.size() > 1){ + + AttendeeData = TestEvent.AttendeeList[1]; + + } + + if (TestEvent.AttendeeList.size() > 1){ + + AttendeeDataDelegatedFrom = TestEvent.AttendeeListDelegatedFrom[1]; + + } + + if (TestEvent.AttendeeList.size() > 1){ + + AttendeeDataDelegatedTo = TestEvent.AttendeeListDelegatedTo[1]; + + } + + if (TestEvent.AttendeeList.size() > 1){ + + AttendeeDataRole = TestEvent.AttendeeListRole[1]; + + } + + if (TestEvent.AttendeeList.size() > 1){ + + AttendeeDataRSVP = TestEvent.AttendeeListRSVP[1]; + + } + + ASSERT_EQ("Attendee Two", AttendeeData); + ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom); + ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo); + ASSERT_EQ("CHAIR", AttendeeDataRole); + ASSERT_EQ("TRUE", AttendeeDataRSVP); + + // Third ATTENDEE property. + + AttendeeData.clear(); + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeData = TestEvent.AttendeeList[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataDirectoryEntry = TestEvent.AttendeeListDirectoryEntry[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataSentBy = TestEvent.AttendeeListSentBy[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataCommonName = TestEvent.AttendeeListCommonName[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataCalendarUserType = TestEvent.AttendeeListCalendarUserType[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataParticipationStatus = TestEvent.AttendeeListParticipationStatus[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataLanguage = TestEvent.AttendeeListLanguage[2]; + + } + + if (TestEvent.AttendeeList.size() > 2){ + + AttendeeDataTokens = TestEvent.AttendeeListTokens[2]; + + } + + ASSERT_EQ("Attendee Three", AttendeeData); + ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry); + ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy); + ASSERT_EQ("Attendee The Third", AttendeeDataCommonName); + ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType); + ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus); + ASSERT_EQ("kw", AttendeeDataLanguage); + ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens); + } \ No newline at end of file -- 2.39.5