// Copyright (c) Microsoft. All rights reserved.
using System;
using Microsoft.Extensions.Configuration;
namespace AgentConformance.IntegrationTests.Support;
///
/// Helper for loading test configuration settings.
///
public sealed class TestConfiguration
{
private static readonly IConfiguration s_configuration = new ConfigurationBuilder()
.AddJsonFile(path: "testsettings.development.json", optional: true)
.AddEnvironmentVariables()
.AddUserSecrets()
.Build();
///
/// Gets a configuration value by its flat key name.
///
/// The configuration key.
/// The configuration value, or if not found.
public static string? GetValue(string key) => s_configuration[key];
///
/// Gets a required configuration value by its flat key name.
///
/// The configuration key.
/// The configuration value.
/// Thrown if the configuration value is not found.
public static string GetRequiredValue(string key) =>
s_configuration[key] ?? throw new InvalidOperationException($"Configuration key '{key}' is required but was not found.");
}