Files
lmxopcua/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/TransportMatrix.cs
T

42 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests;
/// <summary>
/// Crosses every <c>ab_server</c> compose profile with both AbCip transports so each integration
/// test runs once on libplctag and once on the native managed stack. The native run must be green
/// wherever the libplctag run is.
/// </summary>
/// <remarks>
/// Every AbCip compose profile binds host <c>:44818</c>, so only one can run at a time. When
/// <c>AB_SERVER_COMPOSE_PROFILE</c> is set, <see cref="Profiles"/> keeps only that profile, so the
/// rows match the running container instead of driving, say, Micro800 semantics at a ControlLogix.
/// Unset, only the default ControlLogix profile is crossed: ab_server does not self-identify its
/// <c>--plc</c> mode, so crossing every family at whichever container holds <c>:44818</c> failed the
/// non-matching rows instead of skipping them. Set <c>AB_SERVER_COMPOSE_PROFILE</c> to the running
/// profile (<c>compactlogix</c> / <c>micro800</c> / <c>guardlogix</c>) to select another family.
/// </remarks>
public static class TransportMatrix
{
/// <summary>Both transports, for tests that are not parameterised by profile.</summary>
public static IReadOnlyList<AbCipTransport> AllTransports { get; } =
[AbCipTransport.Libplctag, AbCipTransport.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_SERVER_COMPOSE_PROFILE");
return from p in KnownProfiles.All
where string.Equals(p.ComposeProfile,
string.IsNullOrEmpty(only) ? KnownProfiles.ControlLogix.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 });
}