You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- // Copyright (c) Microsoft Corporation. All rights reserved.
- // OpenAIFact.cs
-
- using System;
- using System.Linq;
-
- namespace AutoGen.Tests
- {
- /// <summary>
- /// A fact for tests requiring OPENAI_API_KEY env.
- /// </summary>
- public sealed class ApiKeyFactAttribute : EnvironmentSpecificFactAttribute
- {
- private readonly string[] _envVariableNames;
- public ApiKeyFactAttribute(params string[] envVariableNames) : base($"{envVariableNames} is not found in env")
- {
- _envVariableNames = envVariableNames;
- }
-
- /// <inheritdoc />
- protected override bool IsEnvironmentSupported()
- {
- return _envVariableNames.All(Environment.GetEnvironmentVariables().Contains);
- }
- }
- }
|