diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-11 21:11:30 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-07-12 11:51:29 +1000 |
| commit | 9c4b5559ccb55491fe68b0096d1be0496fd6fcc7 (patch) | |
| tree | faa51204fc2e6e3dfd1b00ae03c7184c4fb0b4bf /src/test/DUtilUnitTest/UriUtilTest.cpp | |
| parent | f651268309263fa67fa84caf9fb6dbebb5c900d9 (diff) | |
| download | wix-9c4b5559ccb55491fe68b0096d1be0496fd6fcc7.tar.gz wix-9c4b5559ccb55491fe68b0096d1be0496fd6fcc7.tar.bz2 wix-9c4b5559ccb55491fe68b0096d1be0496fd6fcc7.zip | |
Import DUtilUnitTest from old wix4 repo.
Diffstat (limited to 'src/test/DUtilUnitTest/UriUtilTest.cpp')
| -rw-r--r-- | src/test/DUtilUnitTest/UriUtilTest.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/test/DUtilUnitTest/UriUtilTest.cpp b/src/test/DUtilUnitTest/UriUtilTest.cpp new file mode 100644 index 00000000..220b3ff5 --- /dev/null +++ b/src/test/DUtilUnitTest/UriUtilTest.cpp | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | using namespace System; | ||
| 6 | using namespace System::Text; | ||
| 7 | using namespace System::Collections::Generic; | ||
| 8 | using namespace Xunit; | ||
| 9 | |||
| 10 | namespace CfgTests | ||
| 11 | { | ||
| 12 | public ref class UriUtil | ||
| 13 | { | ||
| 14 | public: | ||
| 15 | [Fact] | ||
| 16 | void UriProtocolTest() | ||
| 17 | { | ||
| 18 | HRESULT hr = S_OK; | ||
| 19 | |||
| 20 | LPCWSTR uri = L"https://localhost/"; | ||
| 21 | URI_PROTOCOL uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 22 | hr = UriProtocol(uri, &uriProtocol); | ||
| 23 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 24 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTPS, (int)uriProtocol); | ||
| 25 | |||
| 26 | uri = L"HTTPS://localhost/"; | ||
| 27 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 28 | hr = UriProtocol(uri, &uriProtocol); | ||
| 29 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 30 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTPS, (int)uriProtocol); | ||
| 31 | |||
| 32 | uri = L"HtTpS://localhost/"; | ||
| 33 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 34 | hr = UriProtocol(uri, &uriProtocol); | ||
| 35 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 36 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTPS, (int)uriProtocol); | ||
| 37 | |||
| 38 | uri = L"HTTP://localhost/"; | ||
| 39 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 40 | hr = UriProtocol(uri, &uriProtocol); | ||
| 41 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 42 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTP, (int)uriProtocol); | ||
| 43 | |||
| 44 | uri = L"http://localhost/"; | ||
| 45 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 46 | hr = UriProtocol(uri, &uriProtocol); | ||
| 47 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 48 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTP, (int)uriProtocol); | ||
| 49 | |||
| 50 | uri = L"HtTp://localhost/"; | ||
| 51 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 52 | hr = UriProtocol(uri, &uriProtocol); | ||
| 53 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 54 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_HTTP, (int)uriProtocol); | ||
| 55 | |||
| 56 | uri = L"file://localhost/"; | ||
| 57 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 58 | hr = UriProtocol(uri, &uriProtocol); | ||
| 59 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 60 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FILE, (int)uriProtocol); | ||
| 61 | |||
| 62 | uri = L"FILE://localhost/"; | ||
| 63 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 64 | hr = UriProtocol(uri, &uriProtocol); | ||
| 65 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 66 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FILE, (int)uriProtocol); | ||
| 67 | |||
| 68 | uri = L"FiLe://localhost/"; | ||
| 69 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 70 | hr = UriProtocol(uri, &uriProtocol); | ||
| 71 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 72 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FILE, (int)uriProtocol); | ||
| 73 | |||
| 74 | uri = L"FTP://localhost/"; | ||
| 75 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 76 | hr = UriProtocol(uri, &uriProtocol); | ||
| 77 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 78 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FTP, (int)uriProtocol); | ||
| 79 | |||
| 80 | uri = L"ftp://localhost/"; | ||
| 81 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 82 | hr = UriProtocol(uri, &uriProtocol); | ||
| 83 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 84 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FTP, (int)uriProtocol); | ||
| 85 | |||
| 86 | uri = L"FtP://localhost/"; | ||
| 87 | uriProtocol = URI_PROTOCOL::URI_PROTOCOL_UNKNOWN; | ||
| 88 | hr = UriProtocol(uri, &uriProtocol); | ||
| 89 | ExitOnFailure(hr, "Failed to determine UriProtocol"); | ||
| 90 | Assert::Equal((int)URI_PROTOCOL::URI_PROTOCOL_FTP, (int)uriProtocol); | ||
| 91 | |||
| 92 | LExit: | ||
| 93 | ; | ||
| 94 | } | ||
| 95 | }; | ||
| 96 | } | ||
