aboutsummaryrefslogtreecommitdiff
path: root/src/api/burn/test/BalUtilUnitTest
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-06-16 14:41:27 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-06-16 16:49:13 -0500
commit4d94ed9fd1d9cb69337134561c520a24a91b91b2 (patch)
tree494d91dce4eacffae5a0263a0d35892b80d10e73 /src/api/burn/test/BalUtilUnitTest
parent223606fcd02e6d15e065d1e108e17c8848d35f9f (diff)
downloadwix-4d94ed9fd1d9cb69337134561c520a24a91b91b2.tar.gz
wix-4d94ed9fd1d9cb69337134561c520a24a91b91b2.tar.bz2
wix-4d94ed9fd1d9cb69337134561c520a24a91b91b2.zip
Use dotnet test on C++/CLI test projects to get trx logs.
Diffstat (limited to 'src/api/burn/test/BalUtilUnitTest')
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp49
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj4
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters12
-rw-r--r--src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp45
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h10
-rw-r--r--src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h9
-rw-r--r--src/api/burn/test/BalUtilUnitTest/precomp.h14
7 files changed, 138 insertions, 5 deletions
diff --git a/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp
new file mode 100644
index 00000000..9920564e
--- /dev/null
+++ b/src/api/burn/test/BalUtilUnitTest/BAFunctionsTests.cpp
@@ -0,0 +1,49 @@
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
5using namespace System;
6using namespace Xunit;
7using namespace WixBuildTools::TestSupport;
8using namespace WixBuildTools::TestSupport::XunitExtensions;
9
10namespace BalUtilTests
11{
12 public ref class BAFunctions
13 {
14 public:
15 [Fact]
16 void CanCreateTestBAFunctions()
17 {
18 HRESULT hr = S_OK;
19 BOOTSTRAPPER_CREATE_ARGS bootstrapperArgs = { };
20 BOOTSTRAPPER_COMMAND bootstrapperCommand = { };
21 BA_FUNCTIONS_CREATE_ARGS args = { };
22 BA_FUNCTIONS_CREATE_RESULTS results = { };
23 IBootstrapperEngine* pEngine = NULL;
24 IBAFunctions* pBAFunctions = NULL;
25
26 bootstrapperArgs.cbSize = sizeof(bootstrapperArgs);
27 bootstrapperArgs.pCommand = &bootstrapperCommand;
28
29 args.cbSize = sizeof(args);
30 args.pBootstrapperCreateArgs = &bootstrapperArgs;
31
32 results.cbSize = sizeof(results);
33
34 try
35 {
36 hr = BalInitializeFromCreateArgs(&bootstrapperArgs, &pEngine);
37 NativeAssert::Succeeded(hr, "Failed to create engine.");
38
39 hr = CreateBAFunctions(NULL, pEngine, &args, &results, &pBAFunctions);
40 NativeAssert::Succeeded(hr, "Failed to create BAFunctions.");
41 }
42 finally
43 {
44 ReleaseObject(pEngine);
45 ReleaseObject(pBAFunctions);
46 }
47 }
48 };
49}
diff --git a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj
index 113edeaa..d6c03a43 100644
--- a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj
+++ b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj
@@ -37,6 +37,8 @@
37 </PropertyGroup> 37 </PropertyGroup>
38 38
39 <ItemGroup> 39 <ItemGroup>
40 <ClCompile Include="BAFunctionsTests.cpp" />
41 <ClCompile Include="BootstrapperApplicationTests.cpp" />
40 <ClCompile Include="precomp.cpp"> 42 <ClCompile Include="precomp.cpp">
41 <PrecompiledHeader>Create</PrecompiledHeader> 43 <PrecompiledHeader>Create</PrecompiledHeader>
42 <!-- Warnings from referencing netstandard dlls --> 44 <!-- Warnings from referencing netstandard dlls -->
@@ -48,6 +50,8 @@
48 50
49 <ItemGroup> 51 <ItemGroup>
50 <ClInclude Include="precomp.h" /> 52 <ClInclude Include="precomp.h" />
53 <ClInclude Include="TestBAFunctions.h" />
54 <ClInclude Include="TestBootstrapperApplication.h" />
51 </ItemGroup> 55 </ItemGroup>
52 56
53 <ItemGroup> 57 <ItemGroup>
diff --git a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters
index 85f31076..0b3b60be 100644
--- a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters
+++ b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters
@@ -15,6 +15,12 @@
15 </Filter> 15 </Filter>
16 </ItemGroup> 16 </ItemGroup>
17 <ItemGroup> 17 <ItemGroup>
18 <ClCompile Include="BAFunctionsTests.cpp">
19 <Filter>Source Files</Filter>
20 </ClCompile>
21 <ClCompile Include="BootstrapperApplicationTests.cpp">
22 <Filter>Source Files</Filter>
23 </ClCompile>
18 <ClCompile Include="precomp.cpp"> 24 <ClCompile Include="precomp.cpp">
19 <Filter>Source Files</Filter> 25 <Filter>Source Files</Filter>
20 </ClCompile> 26 </ClCompile>
@@ -29,5 +35,11 @@
29 <ClInclude Include="precomp.h"> 35 <ClInclude Include="precomp.h">
30 <Filter>Header Files</Filter> 36 <Filter>Header Files</Filter>
31 </ClInclude> 37 </ClInclude>
38 <ClInclude Include="TestBAFunctions.h">
39 <Filter>Header Files</Filter>
40 </ClInclude>
41 <ClInclude Include="TestBootstrapperApplication.h">
42 <Filter>Header Files</Filter>
43 </ClInclude>
32 </ItemGroup> 44 </ItemGroup>
33</Project> \ No newline at end of file 45</Project> \ No newline at end of file
diff --git a/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp
new file mode 100644
index 00000000..396682ee
--- /dev/null
+++ b/src/api/burn/test/BalUtilUnitTest/BootstrapperApplicationTests.cpp
@@ -0,0 +1,45 @@
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
5using namespace System;
6using namespace Xunit;
7using namespace WixBuildTools::TestSupport;
8using namespace WixBuildTools::TestSupport::XunitExtensions;
9
10namespace BalUtilTests
11{
12 public ref class BootstrapperApplication
13 {
14 public:
15 [Fact]
16 void CanCreateTestBootstrapperApplication()
17 {
18 HRESULT hr = S_OK;
19 BOOTSTRAPPER_CREATE_ARGS args = { };
20 BOOTSTRAPPER_COMMAND command = { };
21 BOOTSTRAPPER_CREATE_RESULTS results = { };
22 IBootstrapperEngine* pEngine = NULL;
23 IBootstrapperApplication* pApplication = NULL;
24
25 args.cbSize = sizeof(args);
26 args.pCommand = &command;
27
28 results.cbSize = sizeof(results);
29
30 try
31 {
32 hr = BalInitializeFromCreateArgs(&args, &pEngine);
33 NativeAssert::Succeeded(hr, "Failed to create engine.");
34
35 hr = CreateBootstrapperApplication(pEngine, &args, &results, &pApplication);
36 NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication.");
37 }
38 finally
39 {
40 ReleaseObject(pEngine);
41 ReleaseObject(pApplication);
42 }
43 }
44 };
45}
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h
new file mode 100644
index 00000000..41f36df8
--- /dev/null
+++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.h
@@ -0,0 +1,10 @@
1#pragma once
2// 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.
3
4HRESULT CreateBAFunctions(
5 __in HMODULE hModule,
6 __in IBootstrapperEngine* pEngine,
7 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
8 __in BA_FUNCTIONS_CREATE_RESULTS* pResults,
9 __out IBAFunctions** ppApplication
10 );
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h
new file mode 100644
index 00000000..c173e9ee
--- /dev/null
+++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.h
@@ -0,0 +1,9 @@
1#pragma once
2// 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.
3
4HRESULT CreateBootstrapperApplication(
5 __in IBootstrapperEngine* pEngine,
6 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
7 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults,
8 __out IBootstrapperApplication** ppApplication
9 );
diff --git a/src/api/burn/test/BalUtilUnitTest/precomp.h b/src/api/burn/test/BalUtilUnitTest/precomp.h
index ce893906..218cab68 100644
--- a/src/api/burn/test/BalUtilUnitTest/precomp.h
+++ b/src/api/burn/test/BalUtilUnitTest/precomp.h
@@ -18,11 +18,15 @@
18#include <BootstrapperEngine.h> 18#include <BootstrapperEngine.h>
19#include <BootstrapperApplication.h> 19#include <BootstrapperApplication.h>
20 20
21#include "IBootstrapperEngine.h" 21#include <BAFunctions.h>
22#include "IBootstrapperApplication.h" 22#include <IBootstrapperEngine.h>
23#include "balutil.h" 23#include <IBootstrapperApplication.h>
24#include "balretry.h" 24#include <IBAFunctions.h>
25#include "BAFunctions.h" 25#include <balutil.h>
26#include <balretry.h>
27
28#include "TestBAFunctions.h"
29#include "TestBootstrapperApplication.h"
26 30
27#pragma managed 31#pragma managed
28#include <vcclr.h> 32#include <vcclr.h>