diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs | 350 |
1 files changed, 204 insertions, 146 deletions
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs index e379047d..abed83c6 100644 --- a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs +++ b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs | |||
@@ -16,110 +16,128 @@ namespace WixToolsetTest.MsiE2E | |||
16 | [RuntimeFact] | 16 | [RuntimeFact] |
17 | public void CanInstallAndUninstallNonDomainGroups() | 17 | public void CanInstallAndUninstallNonDomainGroups() |
18 | { | 18 | { |
19 | UserGroupVerifier.CreateLocalGroup("testName3"); | 19 | try |
20 | var productA = this.CreatePackageInstaller("ProductA"); | 20 | { |
21 | 21 | UserGroupVerifier.CreateLocalGroup("testName3"); | |
22 | productA.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 22 | var productA = this.CreatePackageInstaller("ProductA"); |
23 | 23 | ||
24 | // Validate New User Information. | 24 | productA.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
25 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not created on Install", "testName1")); | ||
26 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not created on Install", "testName2")); | ||
27 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName3"), String.Format("Group '{0}' was not created on Install", "testName3")); | ||
28 | 25 | ||
29 | productA.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 26 | // Validate New User Information. |
27 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not created on Install", "testName1")); | ||
28 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not created on Install", "testName2")); | ||
29 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName3"), String.Format("Group '{0}' was not created on Install", "testName3")); | ||
30 | 30 | ||
31 | // Verify Users marked as RemoveOnUninstall were removed. | 31 | productA.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
32 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Uninstall", "testName1")); | ||
33 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was removed on Uninstall", "testName2")); | ||
34 | 32 | ||
35 | // clean up | 33 | // Verify Users marked as RemoveOnUninstall were removed. |
36 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 34 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Uninstall", "testName1")); |
37 | UserGroupVerifier.DeleteLocalGroup("testName2"); | 35 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was removed on Uninstall", "testName2")); |
38 | UserGroupVerifier.DeleteLocalGroup("testName3"); | 36 | } |
37 | finally | ||
38 | { | ||
39 | // clean up | ||
40 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
41 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
42 | UserGroupVerifier.DeleteLocalGroup("testName3"); | ||
43 | } | ||
39 | } | 44 | } |
40 | 45 | ||
41 | // Verify the rollback action reverts all Users changes. | 46 | // Verify the rollback action reverts all Users changes. |
42 | [RuntimeFact] | 47 | [RuntimeFact] |
43 | public void CanRollbackNonDomainGroups() | 48 | public void CanRollbackNonDomainGroups() |
44 | { | 49 | { |
45 | UserGroupVerifier.CreateLocalGroup("testName3"); | 50 | try |
46 | var productFail = this.CreatePackageInstaller("ProductFail"); | 51 | { |
47 | 52 | UserGroupVerifier.CreateLocalGroup("testName3"); | |
48 | // make sure the user accounts are deleted before we start | 53 | var productFail = this.CreatePackageInstaller("ProductFail"); |
49 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
50 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
51 | 54 | ||
52 | productFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); | 55 | // make sure the user accounts are deleted before we start |
56 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
57 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
53 | 58 | ||
54 | // Verify added Users were removed on rollback. | 59 | productFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); |
55 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Rollback", "testName1")); | ||
56 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not removed on Rollback", "testName2")); | ||
57 | 60 | ||
58 | // clean up | 61 | // Verify added Users were removed on rollback. |
59 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 62 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Rollback", "testName1")); |
60 | UserGroupVerifier.DeleteLocalGroup("testName2"); | 63 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not removed on Rollback", "testName2")); |
61 | UserGroupVerifier.DeleteLocalGroup("testName3"); | 64 | } |
65 | finally | ||
66 | { | ||
67 | // clean up | ||
68 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
69 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
70 | UserGroupVerifier.DeleteLocalGroup("testName3"); | ||
71 | } | ||
62 | } | 72 | } |
63 | 73 | ||
64 | |||
65 | // Verify that command-line parameters aer not blocked by repair switches. | 74 | // Verify that command-line parameters aer not blocked by repair switches. |
66 | // Original code signalled repair mode by using "-f ", which silently | 75 | // Original code signalled repair mode by using "-f ", which silently |
67 | // terminated the command-line parsing, ignoring any parameters that followed. | 76 | // terminated the command-line parsing, ignoring any parameters that followed. |
68 | [RuntimeFact()] | 77 | [RuntimeFact()] |
69 | public void CanRepairNonDomainGroupsWithCommandLineParameters() | 78 | public void CanRepairNonDomainGroupsWithCommandLineParameters() |
70 | { | 79 | { |
71 | var arguments = new string[] | 80 | try |
72 | { | 81 | { |
73 | "TESTPARAMETER1=testName1", | 82 | var arguments = new string[] |
74 | }; | 83 | { |
75 | var productWithCommandLineParameters = this.CreatePackageInstaller("ProductWithCommandLineParameters"); | 84 | "TESTPARAMETER1=testName1", |
85 | }; | ||
86 | var productWithCommandLineParameters = this.CreatePackageInstaller("ProductWithCommandLineParameters"); | ||
76 | 87 | ||
77 | // Make sure that the user doesn't exist when we start the test. | 88 | // Make sure that the user doesn't exist when we start the test. |
78 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 89 | UserGroupVerifier.DeleteLocalGroup("testName1"); |
79 | 90 | ||
80 | // Install | 91 | // Install |
81 | productWithCommandLineParameters.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); | 92 | productWithCommandLineParameters.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); |
82 | 93 | ||
83 | // Repair | 94 | // Repair |
84 | productWithCommandLineParameters.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); | 95 | productWithCommandLineParameters.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); |
85 | 96 | ||
86 | 97 | ||
87 | // Install | 98 | // Install |
88 | productWithCommandLineParameters.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); | 99 | productWithCommandLineParameters.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, arguments); |
89 | 100 | } | |
90 | // Clean up | 101 | finally |
91 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 102 | { |
103 | // Clean up | ||
104 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
105 | } | ||
92 | } | 106 | } |
93 | 107 | ||
94 | |||
95 | // Verify that the groups specified in the authoring are created as expected on repair. | 108 | // Verify that the groups specified in the authoring are created as expected on repair. |
96 | [RuntimeFact()] | 109 | [RuntimeFact()] |
97 | public void CanRepairNonDomainGroups() | 110 | public void CanRepairNonDomainGroups() |
98 | { | 111 | { |
99 | UserGroupVerifier.CreateLocalGroup("testName3"); | 112 | try |
100 | var productA = this.CreatePackageInstaller("ProductA"); | 113 | { |
101 | 114 | UserGroupVerifier.CreateLocalGroup("testName3"); | |
102 | productA.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 115 | var productA = this.CreatePackageInstaller("ProductA"); |
103 | 116 | ||
104 | // Validate New User Information. | 117 | productA.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
105 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
106 | 118 | ||
107 | productA.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 119 | // Validate New User Information. |
120 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
108 | 121 | ||
109 | // Validate New User Information. | 122 | productA.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
110 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("User '{0}' was not installed on Repair", "testName1")); | ||
111 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("User '{0}' was not installed after Repair", "testName2")); | ||
112 | 123 | ||
113 | productA.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 124 | // Validate New User Information. |
125 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("User '{0}' was not installed on Repair", "testName1")); | ||
126 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("User '{0}' was not installed after Repair", "testName2")); | ||
114 | 127 | ||
115 | // Verify Users marked as RemoveOnUninstall were removed. | 128 | productA.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
116 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("User '{0}' was not removed on Uninstall", "testName1")); | ||
117 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("User '{0}' was removed on Uninstall", "testName2")); | ||
118 | 129 | ||
119 | // clean up | 130 | // Verify Users marked as RemoveOnUninstall were removed. |
120 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 131 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("User '{0}' was not removed on Uninstall", "testName1")); |
121 | UserGroupVerifier.DeleteLocalGroup("testName2"); | 132 | Assert.True(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("User '{0}' was removed on Uninstall", "testName2")); |
122 | UserGroupVerifier.DeleteLocalGroup("testName3"); | 133 | } |
134 | finally | ||
135 | { | ||
136 | // clean up | ||
137 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
138 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
139 | UserGroupVerifier.DeleteLocalGroup("testName3"); | ||
140 | } | ||
123 | } | 141 | } |
124 | 142 | ||
125 | // Verify that Installation fails if FailIfExists is set. | 143 | // Verify that Installation fails if FailIfExists is set. |
@@ -165,101 +183,131 @@ namespace WixToolsetTest.MsiE2E | |||
165 | [RuntimeFact] | 183 | [RuntimeFact] |
166 | public void CanCreateNewNonDomainGroupWithComment() | 184 | public void CanCreateNewNonDomainGroupWithComment() |
167 | { | 185 | { |
168 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); | 186 | try |
169 | 187 | { | |
170 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 188 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); |
171 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); | ||
172 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
173 | 189 | ||
174 | // clean up | 190 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
175 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 191 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); |
192 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
193 | } | ||
194 | finally | ||
195 | { | ||
196 | // clean up | ||
197 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
198 | } | ||
176 | } | 199 | } |
177 | 200 | ||
178 | // Verify that a comment can be added to an existing group | 201 | // Verify that a comment can be added to an existing group |
179 | [RuntimeFact] | 202 | [RuntimeFact] |
180 | public void CanAddCommentToExistingNonDomainGroup() | 203 | public void CanAddCommentToExistingNonDomainGroup() |
181 | { | 204 | { |
182 | UserGroupVerifier.CreateLocalGroup("testName1"); | 205 | try |
183 | var productAddCommentToExistingUser = this.CreatePackageInstaller("ProductAddCommentToExistingGroup"); | 206 | { |
184 | 207 | UserGroupVerifier.CreateLocalGroup("testName1"); | |
185 | productAddCommentToExistingUser.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 208 | var productAddCommentToExistingUser = this.CreatePackageInstaller("ProductAddCommentToExistingGroup"); |
186 | 209 | ||
187 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); | 210 | productAddCommentToExistingUser.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
188 | 211 | ||
189 | productAddCommentToExistingUser.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 212 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); |
190 | 213 | ||
191 | // clean up | 214 | productAddCommentToExistingUser.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
192 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 215 | } |
216 | finally | ||
217 | { | ||
218 | // clean up | ||
219 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
220 | } | ||
193 | } | 221 | } |
194 | 222 | ||
195 | // Verify that a comment can be repaired for a new group | 223 | // Verify that a comment can be repaired for a new group |
196 | [RuntimeFact] | 224 | [RuntimeFact] |
197 | public void CanRepairCommentOfNewNonDomainGroup() | 225 | public void CanRepairCommentOfNewNonDomainGroup() |
198 | { | 226 | { |
199 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); | 227 | try |
200 | 228 | { | |
201 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 229 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); |
202 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", ""); | ||
203 | 230 | ||
204 | productNewUserWithComment.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 231 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
205 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); | 232 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", ""); |
206 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
207 | 233 | ||
208 | // clean up | 234 | productNewUserWithComment.RepairProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
209 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 235 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); |
236 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
237 | } | ||
238 | finally | ||
239 | { | ||
240 | // clean up | ||
241 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
242 | } | ||
210 | } | 243 | } |
211 | 244 | ||
212 | // Verify that a comment can be changed for an existing group | 245 | // Verify that a comment can be changed for an existing group |
213 | [RuntimeFact] | 246 | [RuntimeFact] |
214 | public void CanChangeCommentOfExistingNonDomainGroup() | 247 | public void CanChangeCommentOfExistingNonDomainGroup() |
215 | { | 248 | { |
216 | UserGroupVerifier.CreateLocalGroup("testName1"); | 249 | try |
217 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); | 250 | { |
218 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); | 251 | UserGroupVerifier.CreateLocalGroup("testName1"); |
219 | 252 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); | |
220 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 253 | var productNewUserWithComment = this.CreatePackageInstaller("ProductNewGroupWithComment"); |
221 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); | ||
222 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
223 | 254 | ||
224 | // clean up | 255 | productNewUserWithComment.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
225 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 256 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "testComment1"); |
257 | productNewUserWithComment.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
258 | } | ||
259 | finally | ||
260 | { | ||
261 | // clean up | ||
262 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
263 | } | ||
226 | } | 264 | } |
227 | 265 | ||
228 | // Verify that a comment can be rolled back for an existing group | 266 | // Verify that a comment can be rolled back for an existing group |
229 | [RuntimeFact] | 267 | [RuntimeFact] |
230 | public void CanRollbackCommentOfExistingNonDomainGroup() | 268 | public void CanRollbackCommentOfExistingNonDomainGroup() |
231 | { | 269 | { |
232 | UserGroupVerifier.CreateLocalGroup("testName1"); | 270 | try |
233 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); | 271 | { |
234 | var productCommentFail = this.CreatePackageInstaller("ProductCommentFail"); | 272 | UserGroupVerifier.CreateLocalGroup("testName1"); |
235 | 273 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "initialTestComment1"); | |
236 | productCommentFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); | 274 | var productCommentFail = this.CreatePackageInstaller("ProductCommentFail"); |
237 | 275 | ||
238 | // Verify that comment change was rolled back. | 276 | productCommentFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); |
239 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "initialTestComment1"); | ||
240 | 277 | ||
241 | // clean up | 278 | // Verify that comment change was rolled back. |
242 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 279 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", "initialTestComment1"); |
280 | } | ||
281 | finally | ||
282 | { | ||
283 | // clean up | ||
284 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
285 | } | ||
243 | } | 286 | } |
244 | 287 | ||
245 | // Verify that a comment can be deleted for an existing group | 288 | // Verify that a comment can be deleted for an existing group |
246 | [RuntimeFact] | 289 | [RuntimeFact] |
247 | public void CanDeleteCommentOfExistingNonDomainGroup() | 290 | public void CanDeleteCommentOfExistingNonDomainGroup() |
248 | { | 291 | { |
249 | UserGroupVerifier.CreateLocalGroup("testName1"); | 292 | try |
250 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "testComment1"); | 293 | { |
251 | var productCommentDelete = this.CreatePackageInstaller("ProductCommentDelete"); | 294 | UserGroupVerifier.CreateLocalGroup("testName1"); |
252 | 295 | UserGroupVerifier.SetGroupComment(String.Empty, "testName1", "testComment1"); | |
253 | productCommentDelete.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | 296 | var productCommentDelete = this.CreatePackageInstaller("ProductCommentDelete"); |
254 | 297 | ||
255 | // Verify that comment was removed. | 298 | productCommentDelete.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
256 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", ""); | ||
257 | 299 | ||
300 | // Verify that comment was removed. | ||
301 | UserGroupVerifier.VerifyGroupComment(String.Empty, "testName1", ""); | ||
258 | 302 | ||
259 | productCommentDelete.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
260 | 303 | ||
261 | // clean up | 304 | productCommentDelete.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); |
262 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 305 | } |
306 | finally | ||
307 | { | ||
308 | // clean up | ||
309 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
310 | } | ||
263 | } | 311 | } |
264 | 312 | ||
265 | #endregion | 313 | #endregion |
@@ -269,48 +317,58 @@ namespace WixToolsetTest.MsiE2E | |||
269 | [RuntimeFact(DomainRequired = true)] | 317 | [RuntimeFact(DomainRequired = true)] |
270 | public void CanNestDomainGroups() | 318 | public void CanNestDomainGroups() |
271 | { | 319 | { |
272 | var testDomain = System.Environment.UserDomainName; | 320 | try |
273 | var productNestedGroups = this.CreatePackageInstaller("ProductNestedGroups"); | 321 | { |
274 | 322 | var testDomain = System.Environment.UserDomainName; | |
275 | productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}"); | 323 | var productNestedGroups = this.CreatePackageInstaller("ProductNestedGroups"); |
276 | 324 | ||
277 | // Verify group nested membership | 325 | productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}"); |
278 | UserGroupVerifier.VerifyIsMemberOf(testDomain, "Domain Users", new string[] { "testName1", "testName2" }); | ||
279 | //UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Everyone", new string[] { "testName1" }); | ||
280 | 326 | ||
281 | UserGroupVerifier.VerifyIsNotMemberOf(testDomain, "Domain Users", new string[] { "testName3" }); | 327 | // Verify group nested membership |
282 | //UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Everyone", new string[] { "testName2", "testName3" }); | 328 | UserGroupVerifier.VerifyIsMemberOf(testDomain, "Domain Users", new string[] { "testName1", "testName2" }); |
329 | //UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Everyone", new string[] { "testName1" }); | ||
283 | 330 | ||
284 | productNestedGroups.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}"); | 331 | UserGroupVerifier.VerifyIsNotMemberOf(testDomain, "Domain Users", new string[] { "testName3" }); |
332 | //UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Everyone", new string[] { "testName2", "testName3" }); | ||
285 | 333 | ||
286 | // clean up | 334 | productNestedGroups.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, $"TESTDOMAIN={testDomain}"); |
287 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 335 | } |
288 | UserGroupVerifier.DeleteLocalGroup("testName2"); | 336 | finally |
289 | UserGroupVerifier.DeleteLocalGroup("testName3"); | 337 | { |
338 | // clean up | ||
339 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
340 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
341 | UserGroupVerifier.DeleteLocalGroup("testName3"); | ||
342 | } | ||
290 | } | 343 | } |
291 | 344 | ||
292 | // Verify the rollback action reverts all Users changes. | 345 | // Verify the rollback action reverts all Users changes. |
293 | [RuntimeFact(DomainRequired = true)] | 346 | [RuntimeFact(DomainRequired = true)] |
294 | public void CanRollbackDomainGroups() | 347 | public void CanRollbackDomainGroups() |
295 | { | 348 | { |
296 | var testDomain = System.Environment.UserDomainName; | 349 | try |
297 | UserGroupVerifier.CreateLocalGroup("testName3"); | 350 | { |
298 | var productFail = this.CreatePackageInstaller("ProductFail"); | 351 | var testDomain = System.Environment.UserDomainName; |
299 | 352 | UserGroupVerifier.CreateLocalGroup("testName3"); | |
300 | // make sure the user accounts are deleted before we start | 353 | var productFail = this.CreatePackageInstaller("ProductFail"); |
301 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
302 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
303 | 354 | ||
304 | productFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, $"TESTDOMAIN={testDomain}"); | 355 | // make sure the user accounts are deleted before we start |
356 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
357 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
305 | 358 | ||
306 | // Verify added Users were removed on rollback. | 359 | productFail.InstallProduct(MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, $"TESTDOMAIN={testDomain}"); |
307 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Rollback", "testName1")); | ||
308 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not removed on Rollback", "testName2")); | ||
309 | 360 | ||
310 | // clean up | 361 | // Verify added Users were removed on rollback. |
311 | UserGroupVerifier.DeleteLocalGroup("testName1"); | 362 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName1"), String.Format("Group '{0}' was not removed on Rollback", "testName1")); |
312 | UserGroupVerifier.DeleteLocalGroup("testName2"); | 363 | Assert.False(UserGroupVerifier.GroupExists(String.Empty, "testName2"), String.Format("Group '{0}' was not removed on Rollback", "testName2")); |
313 | UserGroupVerifier.DeleteLocalGroup("testName3"); | 364 | } |
365 | finally | ||
366 | { | ||
367 | // clean up | ||
368 | UserGroupVerifier.DeleteLocalGroup("testName1"); | ||
369 | UserGroupVerifier.DeleteLocalGroup("testName2"); | ||
370 | UserGroupVerifier.DeleteLocalGroup("testName3"); | ||
371 | } | ||
314 | } | 372 | } |
315 | 373 | ||
316 | #endregion | 374 | #endregion |