forked from dotnet/try
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIntegrationTestFactAttribute.cs
More file actions
30 lines (26 loc) · 1.01 KB
/
IntegrationTestFactAttribute.cs
File metadata and controls
30 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
using Xunit;
namespace Microsoft.TryDotNet.IntegrationTests
{
internal class IntegrationTestFactAttribute : FactAttribute
{
private const string EnvironmentVariableName = "RunIntegrationTests";
public IntegrationTestFactAttribute(string? skipReason = null)
{
var variableValue = Environment.GetEnvironmentVariable(EnvironmentVariableName) ?? "false";
switch (variableValue.ToLowerInvariant())
{
case "1":
case "true":
// Run tests
break;
default:
Skip = $"Skipping integration tests because environment variable '{EnvironmentVariableName}' was not 'true' or '1'.";
break;
}
}
}
}