| 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 WixTestTools |
| 4 | { |
| 5 | using System; |
| 6 | |
| 7 | public class LongRuntimeFactAttribute : RuntimeFactAttribute |
| 8 | { |
| 9 | const string RequiredEnvironmentVariableName = "LongRuntimeTestsEnabled"; |
| 10 | |
| 11 | public static bool LongRuntimeTestsEnabled { get; } |
| 12 | |
| 13 | static LongRuntimeFactAttribute() |
| 14 | { |
| 15 | var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); |
| 16 | LongRuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled; |
| 17 | } |
| 18 | |
| 19 | public LongRuntimeFactAttribute() |
| 20 | { |
| 21 | if (!LongRuntimeTestsEnabled) |
| 22 | { |
| 23 | this.Skip = $"These tests take a long time to run, so the {RequiredEnvironmentVariableName} environment variable must be set to true."; |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |