diff options
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/LayoutTests.cs')
-rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/LayoutTests.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/LayoutTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/LayoutTests.cs new file mode 100644 index 00000000..1e36e2a5 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/LayoutTests.cs | |||
@@ -0,0 +1,68 @@ | |||
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.BurnE2E | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using System.IO; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using Xunit; | ||
9 | using Xunit.Abstractions; | ||
10 | |||
11 | public class LayoutTests : BurnE2ETests | ||
12 | { | ||
13 | public LayoutTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
14 | |||
15 | [Fact] | ||
16 | public void CanLayoutBundleInPlaceWithMissingPayloads() | ||
17 | { | ||
18 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
19 | var webServer = this.CreateWebServer(); | ||
20 | |||
21 | webServer.AddFiles(new Dictionary<string, string> | ||
22 | { | ||
23 | { "/BundleA/LayoutOnlyPayload", Path.Combine(this.TestContext.TestDataFolder, "BundleA.wxs") }, | ||
24 | { "/BundleA/packages.cab", Path.Combine(this.TestContext.TestDataFolder, "packages.cab") }, | ||
25 | }); | ||
26 | webServer.Start(); | ||
27 | |||
28 | using var dfs = new DisposableFileSystem(); | ||
29 | var layoutDirectory = dfs.GetFolder(true); | ||
30 | |||
31 | // Manually copy bundle to layout directory and then run from there so the non-compressed payloads have to be resolved. | ||
32 | var bundleAFileInfo = new FileInfo(bundleA.Bundle); | ||
33 | var bundleACopiedPath = Path.Combine(layoutDirectory, bundleAFileInfo.Name); | ||
34 | bundleAFileInfo.CopyTo(bundleACopiedPath); | ||
35 | |||
36 | bundleA.Layout(bundleACopiedPath, layoutDirectory); | ||
37 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
38 | |||
39 | Assert.True(File.Exists(bundleACopiedPath)); | ||
40 | Assert.True(File.Exists(Path.Combine(layoutDirectory, "packages.cab"))); | ||
41 | Assert.True(File.Exists(Path.Combine(layoutDirectory, "BundleA.wxs"))); | ||
42 | } | ||
43 | |||
44 | [Fact] | ||
45 | public void CanLayoutBundleToNewDirectory() | ||
46 | { | ||
47 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
48 | var webServer = this.CreateWebServer(); | ||
49 | |||
50 | webServer.AddFiles(new Dictionary<string, string> | ||
51 | { | ||
52 | { "/BundleA/LayoutOnlyPayload", Path.Combine(this.TestContext.TestDataFolder, "BundleA.wxs") }, | ||
53 | { "/BundleA/packages.cab", Path.Combine(this.TestContext.TestDataFolder, "packages.cab") }, | ||
54 | }); | ||
55 | webServer.Start(); | ||
56 | |||
57 | using var dfs = new DisposableFileSystem(); | ||
58 | var layoutDirectory = dfs.GetFolder(); | ||
59 | |||
60 | bundleA.Layout(layoutDirectory); | ||
61 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
62 | |||
63 | Assert.True(File.Exists(Path.Combine(layoutDirectory, "BundleA.exe"))); | ||
64 | Assert.True(File.Exists(Path.Combine(layoutDirectory, "packages.cab"))); | ||
65 | Assert.True(File.Exists(Path.Combine(layoutDirectory, "BundleA.wxs"))); | ||
66 | } | ||
67 | } | ||
68 | } | ||