Files
mxaccessgw/src/MxGateway.IntegrationTests/Galaxy/LiveGalaxyRepositoryFactAttribute.cs
T
Joseph Doherty b4f5e8eb48 Resolve IntegrationTests-007..010 code-review findings
IntegrationTests-007: the three live test classes contend for shared
singletons (one MXAccess COM, one ZB SQL DB, one GLAuth). Added
LiveResourcesCollection with DisableParallelization and applied it to all
three so they no longer run concurrently.

IntegrationTests-008: the three live fact attributes each re-implemented the
env-var check. Added IntegrationTestEnvironment.IsEnabled and all three now
delegate to it.

IntegrationTests-009: reworded the misleading "Mock server call context" XML
doc — it is a hand-written stub with no verification behavior.

IntegrationTests-010: WaitForMessageAsync ignored cancellation. It now takes
an optional CancellationToken linked with the timeout; the smoke test shares
one cancellation source with the StreamEvents call context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 22:59:18 -04:00

28 lines
1.4 KiB
C#

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