Path: redb-route/tests/redb.Route.Tests.Llm.Mcp/TestHelpers/EnvFactAttribute.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Llm.Mcp/TestHelpers/EnvFactAttribute.cs ---- using Xunit.Sdk; namespace redb.Route.Tests.Llm.Mcp.TestHelpers; /// /// xUnit fact attribute that skips the test when the named environment variable is /// missing or empty. Same shape as redb.Route.Tests.Llm.TestHelpers.EnvFactAttribute — /// duplicated here to keep the MCP test project self-contained. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] [XunitTestCaseDiscoverer("Xunit.Sdk.FactDiscoverer", "xunit.execution.{Platform}")] public sealed class EnvFactAttribute : FactAttribute { /// Creates an env-gated fact. /// Required environment variable. If unset/empty the test is skipped. /// Additional variables that must also be present. public EnvFactAttribute(string envVar, params string[] extraEnvVars) { var missing = new List(); if (string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(envVar))) missing.Add(envVar); foreach (var v in extraEnvVars) if (string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(v))) missing.Add(v); if (missing.Count > 0) Skip = $"Live LLM test skipped — set env vars: {string.Join(", ", missing)}."; } }