From: Steve Brokenshire Date: Sun, 31 Jan 2016 13:18:49 +0000 (+0000) Subject: Added unit tests for ATTACH in iCalendarTask/ObjectDataTests. X-Git-Tag: release-0.02~534 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=74b883756ce2aca0f8c566a2e8d93b3ae9ad3209;p=xestiacalendar%2F.git Added unit tests for ATTACH in iCalendarTask/ObjectDataTests. --- diff --git a/source/tests/xestiacalendar_icaltaskload.h b/source/tests/xestiacalendar_icaltaskload.h index 741747d..c23779b 100644 --- a/source/tests/xestiacalendar_icaltaskload.h +++ b/source/tests/xestiacalendar_icaltaskload.h @@ -182,4 +182,93 @@ TEST(iCalendarTask, ObjectDataTests){ ASSERT_EQ("PT15M", TestTask2.DurationData); ASSERT_EQ("TEST=YES", TestTask2.DurationDataTokens); + // Tests for ATTACH. First ATTACH property. + + std::string AttachData; + std::string AttachDataFormatType; + std::string AttachDataValue; + std::string AttachDataEncoding; + std::string AttachDataTokens; + + if (TestTask.AttachList.begin() != TestTask.AttachList.end()){ + + AttachData = TestTask.AttachList[0]; + + } + + if (TestTask.AttachListFormatType.begin() != TestTask.AttachListFormatType.end()){ + + AttachDataFormatType = TestTask.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 (TestTask.AttachList.size() > 1){ + + AttachData = TestTask.AttachList[1]; + + } + + if (TestTask.AttachListFormatType.size() > 1){ + + AttachDataFormatType = TestTask.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 (TestTask.AttachList.size() > 2){ + + AttachData = TestTask.AttachList[2]; + + } + + if (TestTask.AttachListFormatType.size() > 2){ + + AttachDataFormatType = TestTask.AttachListFormatType[2]; + + } + + if (TestTask.AttachListValue.size() > 2){ + + AttachDataValue = TestTask.AttachListValue[2]; + + } + + if (TestTask.AttachListFormatType.size() > 2){ + + AttachDataEncoding = TestTask.AttachListEncoding[2]; + + } + + if (TestTask.AttachListTokens.size() > 2){ + + AttachDataTokens = TestTask.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