winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

AppShutdown.cpp (756B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #include "pch.h"
      4 #include <winget/Runtime.h>
      5 #include "Commands/TestCommand.h"
      6 
      7 using namespace AppInstaller::CLI;
      8 
      9 TEST_CASE("AppShutdown_WindowMessage", "[appShutdown]")
     10 {
     11     if (AppInstaller::Runtime::IsRunningAsAdmin() && AppInstaller::Runtime::IsRunningInPackagedContext())
     12     {
     13         WARN("Test can't run as admin in package context");
     14         return;
     15     }
     16 
     17     std::ostringstream output;
     18     Execution::Context context{ output, std::cin };
     19     context.Args.AddArg(Execution::Args::Type::Force);
     20 
     21     TestAppShutdownCommand appShutdownCmd({});
     22     appShutdownCmd.Execute(context);
     23 
     24     REQUIRE(context.IsTerminated());
     25     REQUIRE(S_OK == context.GetTerminationHR());
     26 }