HashCommand.cpp (935B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #include "pch.h" 4 #include "TestCommon.h" 5 #include "Commands/HashCommand.h" 6 7 using namespace std::string_literals; 8 using namespace TestCommon; 9 using namespace AppInstaller::CLI; 10 11 TEST_CASE("HashCommandWithTestMsix", "[Sha256Hash]") 12 { 13 std::ostringstream hashOutput; 14 Execution::Context context{ hashOutput, std::cin }; 15 context.Args.AddArg(Execution::Args::Type::HashFile, TestDataFile("TestSignedApp.msix").GetPath().u8string()); 16 context.Args.AddArg(Execution::Args::Type::Msix); 17 HashCommand hashCommand({}); 18 19 hashCommand.Execute(context); 20 21 REQUIRE(hashOutput.str().find("Sha256: 6a2d3683fa19bf00e58e07d1313d20a5f5735ebbd6a999d33381d28740ee07ea") != std::string::npos); 22 REQUIRE(hashOutput.str().find("SignatureSha256: 138781c3e6f635240353f3d14d1d57bdcb89413e49be63b375e6a5d7b93b0d07") != std::string::npos); 23 }