From 220bea1948c19132d0e5277021b967993293c5a3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 8 Jul 2020 13:09:59 -0700 Subject: Tests for CopyFile element Validates wixtoolset/issues#5867 --- .../CopyFileFixture.cs | 48 ++++++++++++++++++++++ .../TestData/CopyFile/CopyFile.wxs | 15 +++++++ .../WixToolsetTest.CoreIntegration.csproj | 1 + 3 files changed, 64 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/CopyFileFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CopyFile/CopyFile.wxs diff --git a/src/test/WixToolsetTest.CoreIntegration/CopyFileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CopyFileFixture.cs new file mode 100644 index 00000000..c6fa602b --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/CopyFileFixture.cs @@ -0,0 +1,48 @@ +// 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.CoreIntegration +{ + using System.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using Xunit; + + public class CopyFileFixture + { + [Fact] + public void CanBuildCopyFile() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "CopyFile", "CopyFile.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); + var section = intermediate.Sections.Single(); + var copyFileSymbol = section.Symbols.OfType().Single(); + Assert.Equal("MoveText", copyFileSymbol.Id.Id); + Assert.True(copyFileSymbol.Delete); + Assert.Equal("OtherFolder", copyFileSymbol.DestFolder); + } + } + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CopyFile/CopyFile.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CopyFile/CopyFile.wxs new file mode 100644 index 00000000..66208806 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CopyFile/CopyFile.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 44ff5bca..87ace0b9 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -33,6 +33,7 @@ + -- cgit v1.2.3-55-g6feb