From 6ed045ee1fe69be037a999df2e57122a25f0dedf Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 27 Mar 2024 12:15:44 -0700 Subject: Add a managed custom action E2E test --- .../ManagedCustomActions.wixproj | 6 ++++ .../ManagedCustomActions/Package.wxs | 32 ++++++++++++++++++++++ .../CustomActionTests/TestCA/CustomAction.config | 17 ++++++++++++ .../CustomActionTests/TestCA/CustomAction.cs | 28 +++++++++++++++++++ .../CustomActionTests/TestCA/TestCA.csproj | 16 +++++++++++ .../msi/WixToolsetTest.MsiE2E/CustomActionTests.cs | 23 ++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 src/test/msi/TestData/CustomActionTests/ManagedCustomActions/ManagedCustomActions.wixproj create mode 100644 src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs create mode 100644 src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.config create mode 100644 src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs create mode 100644 src/test/msi/TestData/CustomActionTests/TestCA/TestCA.csproj create mode 100644 src/test/msi/WixToolsetTest.MsiE2E/CustomActionTests.cs diff --git a/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/ManagedCustomActions.wixproj b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/ManagedCustomActions.wixproj new file mode 100644 index 00000000..c11a7c79 --- /dev/null +++ b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/ManagedCustomActions.wixproj @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs new file mode 100644 index 00000000..9b1d224a --- /dev/null +++ b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.config b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.config new file mode 100644 index 00000000..cfae001e --- /dev/null +++ b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.config @@ -0,0 +1,17 @@ + + + + + + + diff --git a/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs new file mode 100644 index 00000000..6891f8da --- /dev/null +++ b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs @@ -0,0 +1,28 @@ +// 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. + +namespace WixToolsetTest.TestCA +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Dtf.WindowsInstaller; + + public class CustomActions + { + [CustomAction] + public static ActionResult ImmediateCA(Session session) + { + session.Log("Begin ImmediateCA"); + + return ActionResult.Success; + } + + [CustomAction] + public static ActionResult DeferredCA(Session session) + { + session.Log("Begin DeferredCA"); + + return ActionResult.Success; + } + } +} diff --git a/src/test/msi/TestData/CustomActionTests/TestCA/TestCA.csproj b/src/test/msi/TestData/CustomActionTests/TestCA/TestCA.csproj new file mode 100644 index 00000000..80602295 --- /dev/null +++ b/src/test/msi/TestData/CustomActionTests/TestCA/TestCA.csproj @@ -0,0 +1,16 @@ + + + + + net472 + + + + + + + + + + + diff --git a/src/test/msi/WixToolsetTest.MsiE2E/CustomActionTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/CustomActionTests.cs new file mode 100644 index 00000000..a30cf36f --- /dev/null +++ b/src/test/msi/WixToolsetTest.MsiE2E/CustomActionTests.cs @@ -0,0 +1,23 @@ +// 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. + +namespace WixToolsetTest.MsiE2E +{ + using System; + using WixTestTools; + using Xunit; + using Xunit.Abstractions; + + public class CustomActionTests : MsiE2ETests + { + public CustomActionTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } + + [RuntimeFact] + public void CanInstallAndUninstallWithManagedCustomAction() + { + var product = this.CreatePackageInstaller("ManagedCustomActions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + } +} -- cgit v1.2.3-55-g6feb