25 lines
904 B
C#
25 lines
904 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
|
using Microsoft.AspNetCore.Testing.xunit;
|
|
|
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|
{
|
|
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
|
|
public sealed class RequiresEnvironmentVariableAttribute : Attribute, ITestCondition
|
|
{
|
|
private readonly string _name;
|
|
|
|
public RequiresEnvironmentVariableAttribute(string name)
|
|
{
|
|
_name = name;
|
|
}
|
|
|
|
public bool IsMet => !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(_name));
|
|
|
|
public string SkipReason => $"Environment variable {_name} is required to run this test.";
|
|
}
|
|
}
|