namespace MxGateway.IntegrationTests.Galaxy;
/// Fact attribute that skips tests unless live Galaxy Repository tests are explicitly enabled.
public sealed class LiveGalaxyRepositoryFactAttribute : FactAttribute
{
/// Environment variable name to enable live Galaxy Repository tests.
public const string EnableVariableName = "MXGATEWAY_RUN_LIVE_GALAXY_TESTS";
/// Environment variable name for the Galaxy Repository connection string.
public const string ConnectionStringVariableName = "MXGATEWAY_LIVE_GALAXY_CONN";
/// Initializes a new instance of the LiveGalaxyRepositoryFactAttribute class.
public LiveGalaxyRepositoryFactAttribute()
{
if (!Enabled)
{
Skip = $"Set {EnableVariableName}=1 to run live Galaxy Repository tests.";
}
}
/// Gets a value indicating whether live Galaxy Repository tests are enabled.
public static bool Enabled => IntegrationTestEnvironment.IsEnabled(EnableVariableName);
/// Gets the Galaxy Repository connection string from environment or default.
public static string ConnectionString =>
Environment.GetEnvironmentVariable(ConnectionStringVariableName)
?? "Server=localhost;Database=ZB;Integrated Security=True;TrustServerCertificate=True;Encrypt=False;";
}