Skip to content

Commit 463f31f

Browse files
committed
Improve test
1 parent 7641d0e commit 463f31f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/AppInstallerCLITests/InstallDependenciesFlow.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <Commands/InstallCommand.h>
77
#include <Commands/COMCommand.h>
88
#include <Workflows/DependenciesFlow.h>
9+
#include <Workflows/DownloadFlow.h>
910
#include <Workflows/InstallFlow.h>
1011
#include <Workflows/ShellExecuteInstallerHandler.h>
1112

@@ -40,11 +41,12 @@ void OverrideForProcessMultiplePackages(TestContext& context)
4041
} });
4142
}
4243

43-
void OverrideShellExecute(TestContext& context)
44+
void OverrideShellExecute(TestContext& context, std::vector<std::string>& installationOrder)
4445
{
45-
context.Override({ ShellExecuteInstallImpl, [](TestContext& c)
46+
context.Override({ ShellExecuteInstallImpl, [&installationOrder](TestContext& c)
4647
{
47-
c.Add< Execution::Data::OperationReturnCode>(0);
48+
installationOrder.push_back(c.Get<Execution::Data::Manifest>().Id);
49+
c.Add<Execution::Data::OperationReturnCode>(0);
4850
} });
4951
}
5052

@@ -276,21 +278,34 @@ TEST_CASE("InstallFlow_Dependencies", "[InstallFlow][workflow][dependencies]")
276278

277279
TEST_CASE("InstallFlow_Dependencies_COM", "[InstallFlow][workflow][dependencies]")
278280
{
281+
std::vector<std::string> installationOrder;
282+
279283
std::ostringstream installOutput;
280284
TestContext context{ installOutput, std::cin };
281285
auto previousThreadGlobals = context.SetForCurrentThread();
282286
OverrideForShellExecute(context);
283-
OverrideShellExecute(context);
287+
OverrideShellExecute(context, installationOrder);
284288
OverrideOpenDependencySource(context);
285289
OverrideEnableWindowsFeaturesDependencies(context);
290+
context.Override({ ReverifyInstallerHash, [](TestContext&) {} });
286291

287292
context.Add<Execution::Data::Manifest>(YamlParser::CreateFromPath(TestDataFile("InstallFlowTest_MultipleDependencies.yaml")));
288293

289294
COMDownloadCommand download({});
290295
download.Execute(context);
291296

297+
REQUIRE(installationOrder.size() == 0);
298+
292299
COMInstallCommand install({});
293300
REQUIRE_NOTHROW(install.Execute(context));
301+
302+
REQUIRE(context.GetTerminationHR() == S_OK);
303+
304+
// Verify installers are called in order
305+
REQUIRE(installationOrder.size() == 3);
306+
REQUIRE(installationOrder.at(0) == "Dependency1");
307+
REQUIRE(installationOrder.at(1) == "Dependency2");
308+
REQUIRE(installationOrder.at(2) == "AppInstallerCliTest.TestExeInstaller.MultipleDependencies");
294309
}
295310

296311
// TODO:

0 commit comments

Comments
 (0)