b37e9613f7
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
42 lines
2.1 KiB
C#
42 lines
2.1 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests;
|
||
|
||
/// <summary>
|
||
/// Crosses the PCCC compose profiles with both AbLegacy transports so each integration test runs
|
||
/// once on libplctag and once on the native managed stack.
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// Preserves the <c>AB_LEGACY_COMPOSE_PROFILE</c> filter the smoke theory always applied: when set,
|
||
/// <see cref="KnownProfiles.All"/> is narrowed to that profile <b>before</b> it is crossed with the
|
||
/// transports, so the rows match the running container. Unset, every family is crossed because each
|
||
/// has its own port and skips itself when unreachable — <b>unless</b> <c>AB_LEGACY_ENDPOINT</c> pins
|
||
/// one device, in which case the family is a property of that device and cannot be detected, so only
|
||
/// the default SLC500 profile is crossed (set <c>AB_LEGACY_COMPOSE_PROFILE</c> to pick another).
|
||
/// </remarks>
|
||
public static class TransportMatrix
|
||
{
|
||
/// <summary>Both transports, for tests that are not parameterised by profile.</summary>
|
||
public static IReadOnlyList<AbLegacyTransport> AllTransports { get; } =
|
||
[AbLegacyTransport.Libplctag, AbLegacyTransport.Native];
|
||
|
||
/// <summary>Gets <c>(profile, transport)</c> rows for every selected profile × both transports.</summary>
|
||
public static IEnumerable<object[]> Profiles
|
||
{
|
||
get
|
||
{
|
||
var only = Environment.GetEnvironmentVariable("AB_LEGACY_COMPOSE_PROFILE");
|
||
if (string.IsNullOrEmpty(only) &&
|
||
Environment.GetEnvironmentVariable("AB_LEGACY_ENDPOINT") is { Length: > 0 })
|
||
only = KnownProfiles.Slc500.ComposeProfile;
|
||
return from p in KnownProfiles.All
|
||
where string.IsNullOrEmpty(only) ||
|
||
string.Equals(p.ComposeProfile, only, StringComparison.OrdinalIgnoreCase)
|
||
from t in AllTransports
|
||
select new object[] { p, t };
|
||
}
|
||
}
|
||
|
||
/// <summary>Gets one row per transport.</summary>
|
||
public static IEnumerable<object[]> Transports =>
|
||
AllTransports.Select(t => new object[] { t });
|
||
}
|