From: Steve Brokenshire Date: Sun, 31 Jan 2016 15:05:58 +0000 (+0000) Subject: Added unit tests for ATTACH in iCalendarJournal/ObjectDataTests. X-Git-Tag: release-0.02~466 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=8e91b16abffaf98909963ae690fc5ccaf3163e45;p=xestiacalendar%2F.git Added unit tests for ATTACH in iCalendarJournal/ObjectDataTests. --- diff --git a/source/tests/xestiacalendar_icaljournalload.h b/source/tests/xestiacalendar_icaljournalload.h index c654058..f102a61 100644 --- a/source/tests/xestiacalendar_icaljournalload.h +++ b/source/tests/xestiacalendar_icaljournalload.h @@ -106,4 +106,93 @@ TEST(iCalendarJournal, ObjectDataTests){ ASSERT_EQ("FREQ=DAILY;COUNT=10", TestJournal.RecurranceRuleData); ASSERT_EQ("TEST=DATA", TestJournal.RecurranceRuleDataTokens); + // Tests for ATTACH. First ATTACH property. + + std::string AttachData; + std::string AttachDataFormatType; + std::string AttachDataValue; + std::string AttachDataEncoding; + std::string AttachDataTokens; + + if (TestJournal.AttachList.begin() != TestJournal.AttachList.end()){ + + AttachData = TestJournal.AttachList[0]; + + } + + if (TestJournal.AttachListFormatType.begin() != TestJournal.AttachListFormatType.end()){ + + AttachDataFormatType = TestJournal.AttachListFormatType[0]; + + } + + ASSERT_EQ("http://www.example.com/", AttachData); + ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); + + // Second ATTACH property. + + AttachData.clear(); + AttachDataFormatType.clear(); + AttachDataValue.clear(); + AttachDataEncoding.clear(); + + if (TestJournal.AttachList.size() > 1){ + + AttachData = TestJournal.AttachList[1]; + + } + + if (TestJournal.AttachListFormatType.size() > 1){ + + AttachDataFormatType = TestJournal.AttachListFormatType[1]; + + } + + ASSERT_EQ("http://www.example.com/page2.html", AttachData); + ASSERT_EQ("application/internet-shortcut", AttachDataFormatType); + + // Third ATTACH property. + + AttachData.clear(); + AttachDataFormatType.clear(); + AttachDataValue.clear(); + AttachDataEncoding.clear(); + AttachDataTokens.clear(); + + if (TestJournal.AttachList.size() > 2){ + + AttachData = TestJournal.AttachList[2]; + + } + + if (TestJournal.AttachListFormatType.size() > 2){ + + AttachDataFormatType = TestJournal.AttachListFormatType[2]; + + } + + if (TestJournal.AttachListValue.size() > 2){ + + AttachDataValue = TestJournal.AttachListValue[2]; + + } + + if (TestJournal.AttachListFormatType.size() > 2){ + + AttachDataEncoding = TestJournal.AttachListEncoding[2]; + + } + + if (TestJournal.AttachListTokens.size() > 2){ + + AttachDataTokens = TestJournal.AttachListTokens[2]; + + } + + ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); + ASSERT_EQ("text/plain", AttachDataFormatType); + ASSERT_EQ("BASE64", AttachDataEncoding); + ASSERT_EQ("BINARY", AttachDataValue); + ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); + } \ No newline at end of file