diff options
author | Rob Mensching <rob@firegiant.com> | 2020-07-08 13:09:59 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-07-08 15:18:09 -0700 |
commit | 220bea1948c19132d0e5277021b967993293c5a3 (patch) | |
tree | 514a812106a756b086471434e0a043080d80d593 | |
parent | b8bd03960b79e92d38ee7094a88e246253dad800 (diff) | |
download | wix-220bea1948c19132d0e5277021b967993293c5a3.tar.gz wix-220bea1948c19132d0e5277021b967993293c5a3.tar.bz2 wix-220bea1948c19132d0e5277021b967993293c5a3.zip |
Tests for CopyFile element
Validates wixtoolset/issues#5867
3 files changed, 64 insertions, 0 deletions
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 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System.IO; | ||
6 | using System.Linq; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using WixToolset.Core.TestPackage; | ||
9 | using WixToolset.Data; | ||
10 | using WixToolset.Data.Symbols; | ||
11 | using Xunit; | ||
12 | |||
13 | public class CopyFileFixture | ||
14 | { | ||
15 | [Fact] | ||
16 | public void CanBuildCopyFile() | ||
17 | { | ||
18 | var folder = TestData.Get(@"TestData"); | ||
19 | |||
20 | using (var fs = new DisposableFileSystem()) | ||
21 | { | ||
22 | var baseFolder = fs.GetFolder(); | ||
23 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
24 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
25 | |||
26 | var result = WixRunner.Execute(new[] | ||
27 | { | ||
28 | "build", | ||
29 | Path.Combine(folder, "CopyFile", "CopyFile.wxs"), | ||
30 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
31 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
32 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
33 | "-intermediateFolder", intermediateFolder, | ||
34 | "-o", msiPath | ||
35 | }); | ||
36 | |||
37 | result.AssertSuccess(); | ||
38 | |||
39 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
40 | var section = intermediate.Sections.Single(); | ||
41 | var copyFileSymbol = section.Symbols.OfType<MoveFileSymbol>().Single(); | ||
42 | Assert.Equal("MoveText", copyFileSymbol.Id.Id); | ||
43 | Assert.True(copyFileSymbol.Delete); | ||
44 | Assert.Equal("OtherFolder", copyFileSymbol.DestFolder); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | } | ||
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 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="CopyFileComp" Directory="INSTALLFOLDER"> | ||
6 | <File Id="test.txt" Source="test.txt" /> | ||
7 | <CopyFile Id="MoveText" Delete="yes" SourceName="*.txt" DestinationDirectory="OtherFolder"/> | ||
8 | </Component> | ||
9 | </ComponentGroup> | ||
10 | </Fragment> | ||
11 | |||
12 | <Fragment> | ||
13 | <Directory Id="OtherFolder" Name="INSTALLFOLDER:\other" /> | ||
14 | </Fragment> | ||
15 | </Wix> | ||
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 @@ | |||
33 | <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" /> | 33 | <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" /> |
34 | <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" /> | 34 | <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" /> |
35 | <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" /> | 35 | <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" /> |
36 | <Content Include="TestData\CopyFile\CopyFile.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
36 | <Content Include="TestData\CustomAction\CustomActionCycle.wxs" CopyToOutputDirectory="PreserveNewest" /> | 37 | <Content Include="TestData\CustomAction\CustomActionCycle.wxs" CopyToOutputDirectory="PreserveNewest" /> |
37 | <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" /> | 38 | <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" /> |
38 | <Content Include="TestData\CustomTable\CustomTable-Expected.wxs" CopyToOutputDirectory="PreserveNewest" /> | 39 | <Content Include="TestData\CustomTable\CustomTable-Expected.wxs" CopyToOutputDirectory="PreserveNewest" /> |