diff --git a/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs b/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs index 1acdcab096..b00cd4bc9f 100644 --- a/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs +++ b/test/Microsoft.IdentityModel.AotCompatibility.Tests/AotCompatibilityTests.cs @@ -32,7 +32,7 @@ public AotCompatibilityTests(ITestOutputHelper testOutputHelper) /// /// You can also 'dotnet publish' the 'Microsoft.IdentityModel.AotCompatibility.TestApp.csproj' as well to get the errors. /// - [Fact] + [IgnoreOnAzureDevopsFact] public void EnsureAotCompatibility() { string testAppPath = Path.Combine("..", "..", "..", "..", "Microsoft.IdentityModel.AotCompatibility.TestApp"); diff --git a/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs b/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs new file mode 100644 index 0000000000..cc3c994837 --- /dev/null +++ b/test/Microsoft.IdentityModel.AotCompatibility.Tests/IgnoreOnAzureDevopsFactAttribute.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Xunit; + +namespace Microsoft.IdentityModel.AotCompatibility.Tests +{ + public sealed class IgnoreOnAzureDevopsFactAttribute : FactAttribute + { + public IgnoreOnAzureDevopsFactAttribute() + { + if (!IsRunningOnAzureDevOps()) + { + return; + } + + Skip = "Ignored on Azure DevOps"; + } + + /// Determine if runtime is Azure DevOps. + /// True if being executed in Azure DevOps, false otherwise. + public static bool IsRunningOnAzureDevOps() + { + return Environment.GetEnvironmentVariable("SYSTEM_DEFINITIONID") != null; + } + } +}