diff options
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs deleted file mode 100644 index 17e91692..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
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; | ||
6 | using System.IO; | ||
7 | using System.Linq; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | using WixToolset.Data; | ||
11 | using WixToolset.Data.Symbols; | ||
12 | using WixToolset.Data.WindowsInstaller; | ||
13 | using Xunit; | ||
14 | |||
15 | public class ModuleFixture | ||
16 | { | ||
17 | [Fact] | ||
18 | public void CanBuildSimpleModule() | ||
19 | { | ||
20 | var folder = TestData.Get(@"TestData\SimpleModule"); | ||
21 | |||
22 | using (var fs = new DisposableFileSystem()) | ||
23 | { | ||
24 | var intermediateFolder = fs.GetFolder(); | ||
25 | |||
26 | var result = WixRunner.Execute(new[] | ||
27 | { | ||
28 | "build", | ||
29 | Path.Combine(folder, "Module.wxs"), | ||
30 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
31 | "-bindpath", Path.Combine(folder, "data"), | ||
32 | "-intermediateFolder", intermediateFolder, | ||
33 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
34 | }); | ||
35 | |||
36 | result.AssertSuccess(); | ||
37 | |||
38 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
39 | Assert.True(File.Exists(msmPath)); | ||
40 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
41 | |||
42 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
43 | var section = intermediate.Sections.Single(); | ||
44 | |||
45 | var dirSymbols = section.Symbols.OfType<DirectorySymbol>().OrderBy(d => d.Id.Id).ToList(); | ||
46 | WixAssert.CompareLineByLine(new[] | ||
47 | { | ||
48 | "MergeRedirectFolder\tTARGETDIR\t.", | ||
49 | "NotTheMergeRedirectFolder\tTARGETDIR\t.", | ||
50 | "TARGETDIR\t\tSourceDir" | ||
51 | }, dirSymbols.Select(d => String.Join("\t", d.Id.Id, d.ParentDirectoryRef, d.Name)).ToArray()); | ||
52 | |||
53 | var fileSymbols = section.Symbols.OfType<FileSymbol>().OrderBy(d => d.Id.Id).ToList(); | ||
54 | WixAssert.CompareLineByLine(new[] | ||
55 | { | ||
56 | $"File1\t{Path.Combine(folder, @"data\test.txt")}\ttest.txt", | ||
57 | $"File2\t{Path.Combine(folder, @"data\test.txt")}\ttest.txt", | ||
58 | }, fileSymbols.Select(fileSymbol => String.Join("\t", fileSymbol.Id.Id, fileSymbol[FileSymbolFields.Source].AsPath().Path, fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath().Path)).ToArray()); | ||
59 | |||
60 | var data = WindowsInstallerData.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
61 | var fileRows = data.Tables["File"].Rows; | ||
62 | Assert.Equal(new[] | ||
63 | { | ||
64 | "File1.243FB739_4D05_472F_9CFB_EF6B1017B6DE", | ||
65 | "File2.243FB739_4D05_472F_9CFB_EF6B1017B6DE", | ||
66 | }, fileRows.Select(r => r.FieldAsString(0)).ToArray()); | ||
67 | |||
68 | var cabPath = Path.Combine(intermediateFolder, "msm-test.cab"); | ||
69 | Query.ExtractStream(msmPath, "MergeModule.CABinet", cabPath); | ||
70 | var files = Query.GetCabinetFiles(cabPath); | ||
71 | Assert.Equal(new[] | ||
72 | { | ||
73 | "File1.243FB739_4D05_472F_9CFB_EF6B1017B6DE", | ||
74 | "File2.243FB739_4D05_472F_9CFB_EF6B1017B6DE", | ||
75 | }, files.Select(f => Path.Combine(f.Path, f.Name)).ToArray()); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | [Fact] | ||
80 | public void CanSuppressModularization() | ||
81 | { | ||
82 | var folder = TestData.Get(@"TestData\SuppressModularization"); | ||
83 | |||
84 | using (var fs = new DisposableFileSystem()) | ||
85 | { | ||
86 | var intermediateFolder = fs.GetFolder(); | ||
87 | |||
88 | var result = WixRunner.Execute(new[] | ||
89 | { | ||
90 | "build", | ||
91 | Path.Combine(folder, "Module.wxs"), | ||
92 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
93 | "-bindpath", Path.Combine(folder, "data"), | ||
94 | "-intermediateFolder", intermediateFolder, | ||
95 | "-sw1079", | ||
96 | "-sw1086", | ||
97 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
98 | }); | ||
99 | |||
100 | result.AssertSuccess(); | ||
101 | |||
102 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
103 | |||
104 | var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "Property" }); | ||
105 | WixAssert.CompareLineByLine(new[] | ||
106 | { | ||
107 | "CustomAction:Test\t11265\tFakeCA.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tTestEntry\t", | ||
108 | "Property:MsiHiddenProperties\tTest" | ||
109 | }, rows); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | } | ||