| 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 WixInternal.TestSupport; |
| 8 | using WixInternal.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 | WixAssert.StringEqual("MoveText", copyFileSymbol.Id.Id); |
| 43 | Assert.True(copyFileSymbol.Delete); |
| 44 | WixAssert.StringEqual("OtherFolder", copyFileSymbol.DestFolder); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |