diff options
Diffstat (limited to 'src/test/msi/WixToolsetTest.MsiE2E/MsiE2EFixture.cs')
-rw-r--r-- | src/test/msi/WixToolsetTest.MsiE2E/MsiE2EFixture.cs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/MsiE2EFixture.cs b/src/test/msi/WixToolsetTest.MsiE2E/MsiE2EFixture.cs deleted file mode 100644 index a7646568..00000000 --- a/src/test/msi/WixToolsetTest.MsiE2E/MsiE2EFixture.cs +++ /dev/null | |||
@@ -1,28 +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.MsiE2E | ||
4 | { | ||
5 | using System; | ||
6 | using System.Security.Principal; | ||
7 | |||
8 | public class MsiE2EFixture | ||
9 | { | ||
10 | const string RequiredEnvironmentVariableName = "RuntimeTestsEnabled"; | ||
11 | |||
12 | public MsiE2EFixture() | ||
13 | { | ||
14 | using var identity = WindowsIdentity.GetCurrent(); | ||
15 | var principal = new WindowsPrincipal(identity); | ||
16 | if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) | ||
17 | { | ||
18 | throw new InvalidOperationException("These tests must run elevated."); | ||
19 | } | ||
20 | |||
21 | var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); | ||
22 | if (!bool.TryParse(testsEnabledString, out var testsEnabled) || !testsEnabled) | ||
23 | { | ||
24 | throw new InvalidOperationException($"These tests affect machine state. Set the {RequiredEnvironmentVariableName} environment variable to true to accept the consequences."); | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | } | ||