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/GuidUtilTest.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/GuidUtilTest.cpp')
-rw-r--r-- | src/test/DUtilUnitTest/GuidUtilTest.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/test/DUtilUnitTest/GuidUtilTest.cpp b/src/test/DUtilUnitTest/GuidUtilTest.cpp new file mode 100644 index 00000000..d0ea9a89 --- /dev/null +++ b/src/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 WixTest; | ||
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 | } | ||