diff options
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs deleted file mode 100644 index 62ffe1eb..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ /dev/null | |||
@@ -1,148 +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 WixBuildTools.TestSupport; | ||
8 | using WixToolset.Core.TestPackage; | ||
9 | using WixToolset.Data; | ||
10 | using Xunit; | ||
11 | |||
12 | public class BadInputFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void SwitchIsNotConsideredAnArgument() | ||
16 | { | ||
17 | var result = WixRunner.Execute(new[] | ||
18 | { | ||
19 | "build", | ||
20 | "-bindpath", "-thisisaswitchnotanarg", | ||
21 | }); | ||
22 | |||
23 | Assert.Single(result.Messages, m => m.Id == (int)ErrorMessages.Ids.ExpectedArgument); | ||
24 | // TODO: when CantBuildSingleExeBundleWithInvalidArgument is fixed, uncomment: | ||
25 | //Assert.Equal((int)ErrorMessages.Ids.ExpectedArgument, result.ExitCode); | ||
26 | } | ||
27 | |||
28 | [Fact] | ||
29 | public void HandleInvalidIds() | ||
30 | { | ||
31 | var folder = TestData.Get(@"TestData\BadInput"); | ||
32 | |||
33 | using (var fs = new DisposableFileSystem()) | ||
34 | { | ||
35 | var baseFolder = fs.GetFolder(); | ||
36 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
37 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
38 | |||
39 | var result = WixRunner.Execute(new[] | ||
40 | { | ||
41 | "build", | ||
42 | Path.Combine(folder, "InvalidIds.wxs"), | ||
43 | "-intermediateFolder", intermediateFolder, | ||
44 | "-o", wixlibPath, | ||
45 | }); | ||
46 | |||
47 | Assert.Equal(330, result.ExitCode); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | [Fact] | ||
52 | public void CantBuildSingleExeBundleWithInvalidArgument() | ||
53 | { | ||
54 | var folder = TestData.Get(@"TestData"); | ||
55 | |||
56 | using (var fs = new DisposableFileSystem()) | ||
57 | { | ||
58 | var baseFolder = fs.GetFolder(); | ||
59 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
60 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
61 | |||
62 | var result = WixRunner.Execute(new[] | ||
63 | { | ||
64 | "build", | ||
65 | Path.Combine(folder, "SingleExeBundle", "SingleExePackageGroup.wxs"), | ||
66 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | ||
67 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
68 | "-bindpath", Path.Combine(folder, ".Data"), | ||
69 | "-intermediateFolder", intermediateFolder, | ||
70 | "-o", exePath, | ||
71 | "-nonexistentswitch", "param", | ||
72 | }); | ||
73 | |||
74 | Assert.NotEqual(0, result.ExitCode); | ||
75 | Assert.False(File.Exists(exePath)); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | [Fact] | ||
80 | public void RegistryKeyWithoutAttributesDoesntCrash() | ||
81 | { | ||
82 | var folder = TestData.Get(@"TestData\BadInput"); | ||
83 | |||
84 | using (var fs = new DisposableFileSystem()) | ||
85 | { | ||
86 | var baseFolder = fs.GetFolder(); | ||
87 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
88 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
89 | |||
90 | var result = WixRunner.Execute(new[] | ||
91 | { | ||
92 | "build", | ||
93 | Path.Combine(folder, "RegistryKey.wxs"), | ||
94 | "-intermediateFolder", intermediateFolder, | ||
95 | "-o", wixlibPath, | ||
96 | }); | ||
97 | |||
98 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | [Fact] | ||
103 | public void BundleVariableWithBadTypeIsRejected() | ||
104 | { | ||
105 | var folder = TestData.Get(@"TestData\BadInput"); | ||
106 | |||
107 | using (var fs = new DisposableFileSystem()) | ||
108 | { | ||
109 | var baseFolder = fs.GetFolder(); | ||
110 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
111 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
112 | |||
113 | var result = WixRunner.Execute(new[] | ||
114 | { | ||
115 | "build", | ||
116 | Path.Combine(folder, "BundleVariable.wxs"), | ||
117 | "-intermediateFolder", intermediateFolder, | ||
118 | "-o", wixlibPath, | ||
119 | }); | ||
120 | |||
121 | Assert.Equal(21, result.ExitCode); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | [Fact] | ||
126 | public void BundleVariableWithHiddenPersistedIsRejected() | ||
127 | { | ||
128 | var folder = TestData.Get(@"TestData\BadInput"); | ||
129 | |||
130 | using (var fs = new DisposableFileSystem()) | ||
131 | { | ||
132 | var baseFolder = fs.GetFolder(); | ||
133 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
134 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
135 | |||
136 | var result = WixRunner.Execute(new[] | ||
137 | { | ||
138 | "build", | ||
139 | Path.Combine(folder, "HiddenPersistedBundleVariable.wxs"), | ||
140 | "-intermediateFolder", intermediateFolder, | ||
141 | "-o", wixlibPath, | ||
142 | }); | ||
143 | |||
144 | Assert.Equal(193, result.ExitCode); | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||