diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-04-22 06:38:23 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-29 16:21:09 -0700 |
| commit | 7f642e51670bc38a4ef782a363936850bc2b0ba9 (patch) | |
| tree | 19684b2d94979f130c0935328f0d44cf006e45ef /src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp | |
| parent | f39e7a3e164d0736e45049e5726d0da2013da3c9 (diff) | |
| download | wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.tar.gz wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.tar.bz2 wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.zip | |
Move dutil into libs/dutil
Diffstat (limited to 'src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp')
| -rw-r--r-- | src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp b/src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp new file mode 100644 index 00000000..a6e27a09 --- /dev/null +++ b/src/libs/dutil/test/DUtilUnitTest/GuidUtilTest.cpp | |||
| @@ -0,0 +1,60 @@ | |||
| 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 Xunit; | ||
| 7 | using namespace WixBuildTools::TestSupport; | ||
| 8 | |||
| 9 | namespace DutilTests | ||
| 10 | { | ||
| 11 | public ref class GuidUtil | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | [Fact] | ||
| 15 | void GuidCreateTest() | ||
| 16 | { | ||
| 17 | HRESULT hr = S_OK; | ||
| 18 | WCHAR wzGuid1[GUID_STRING_LENGTH]; | ||
| 19 | WCHAR wzGuid2[GUID_STRING_LENGTH]; | ||
| 20 | |||
| 21 | hr = GuidFixedCreate(wzGuid1); | ||
| 22 | NativeAssert::Succeeded(hr, "Failed to create first guid."); | ||
| 23 | Guid firstGuid = Guid::Parse(gcnew String(wzGuid1)); | ||
| 24 | |||
| 25 | hr = GuidFixedCreate(wzGuid2); | ||
| 26 | NativeAssert::Succeeded(hr, "Failed to create second guid."); | ||
| 27 | Guid secondGuid = Guid::Parse(gcnew String(wzGuid2)); | ||
| 28 | |||
| 29 | NativeAssert::NotStringEqual(wzGuid1, wzGuid2); | ||
| 30 | NativeAssert::NotEqual(firstGuid, secondGuid); | ||
| 31 | } | ||
| 32 | |||
| 33 | [Fact] | ||
| 34 | void GuidCreateSczTest() | ||
| 35 | { | ||
| 36 | HRESULT hr = S_OK; | ||
| 37 | LPWSTR sczGuid1 = NULL; | ||
| 38 | LPWSTR sczGuid2 = NULL; | ||
| 39 | |||
| 40 | try | ||
| 41 | { | ||
| 42 | hr = GuidCreate(&sczGuid1); | ||
| 43 | NativeAssert::Succeeded(hr, "Failed to create first guid."); | ||
| 44 | Guid firstGuid = Guid::Parse(gcnew String(sczGuid1)); | ||
| 45 | |||
| 46 | hr = GuidCreate(&sczGuid2); | ||
| 47 | NativeAssert::Succeeded(hr, "Failed to create second guid."); | ||
| 48 | Guid secondGuid = Guid::Parse(gcnew String(sczGuid2)); | ||
| 49 | |||
| 50 | NativeAssert::NotStringEqual(sczGuid1, sczGuid2); | ||
| 51 | NativeAssert::NotEqual(firstGuid, secondGuid); | ||
| 52 | } | ||
| 53 | finally | ||
| 54 | { | ||
| 55 | ReleaseStr(sczGuid1); | ||
| 56 | ReleaseStr(sczGuid2); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | }; | ||
| 60 | } | ||
