Files
lmxopcua/tests/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Cli.Tests/SubscribeCommandMechanismTests.cs
T
Joseph Doherty 64e3fbe035
v2-ci / build (push) Failing after 1m43s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
docs: backfill XML documentation across 756 files
Adds <summary>, <param>, <typeparam>, and <inheritdoc/> tags to public
members surfaced by commentchecker — resolves 5,847 of 5,869 issues
(99.6%) across three /fixdocs passes.
2026-05-28 08:10:17 -04:00

42 lines
1.8 KiB
C#

using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
using ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Cli.Commands;
namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Cli.Tests;
/// <summary>
/// Driver.TwinCAT.Cli-003: the subscribe banner mechanism label is derived from the
/// <see cref="ISubscriptionHandle.DiagnosticId"/> the driver actually returned, not from
/// the <c>--poll-only</c> flag. That way the banner cannot disagree with what the driver
/// did even if a future fallback path lands the subscription somewhere unexpected.
/// </summary>
[Trait("Category", "Unit")]
public sealed class SubscribeCommandMechanismTests
{
private sealed record StubHandle(string DiagnosticId) : ISubscriptionHandle;
/// <summary>Verifies that DescribeMechanism returns ADS notification for native handle.</summary>
/// <param name="diagId">The diagnostic ID of the subscription handle to classify.</param>
[Theory]
[InlineData("twincat-native-sub-1")]
[InlineData("twincat-native-sub-42")]
[InlineData("twincat-native-sub-9223372036854775807")]
public void DescribeMechanism_returns_ADS_notification_for_native_handle(string diagId)
{
SubscribeCommand.DescribeMechanism(new StubHandle(diagId)).ShouldBe("ADS notification");
}
/// <summary>Verifies that DescribeMechanism returns polling for anything else.</summary>
/// <param name="diagId">The diagnostic ID of the subscription handle to classify.</param>
[Theory]
[InlineData("pollgroup-1")]
[InlineData("modbus-poll-7")]
[InlineData("")]
[InlineData("TWINCAT-NATIVE-SUB-1")] // ordinal comparison — uppercase prefix does NOT match.
public void DescribeMechanism_returns_polling_for_anything_else(string diagId)
{
SubscribeCommand.DescribeMechanism(new StubHandle(diagId)).ShouldBe("polling");
}
}