Files
lmxopcua/tests/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Cli.Tests/SubscribeCommandIntervalTests.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

39 lines
1.4 KiB
C#

using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Driver.AbCip.Cli.Commands;
namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.Cli.Tests;
/// <summary>
/// Covers <see cref="SubscribeCommand.ValidateInterval(int)"/> — the guard that
/// stops a zero / negative <c>--interval-ms</c> from reaching <c>SubscribeAsync</c>
/// as a non-positive <see cref="TimeSpan"/>.
/// </summary>
[Trait("Category", "Unit")]
public sealed class SubscribeCommandIntervalTests
{
/// <summary>Verifies that validate interval rejects non-positive milliseconds.</summary>
/// <param name="badMs">A non-positive interval value that should be rejected.</param>
[Theory]
[InlineData(0)]
[InlineData(-1)]
[InlineData(-500)]
public void ValidateInterval_rejects_non_positive(int badMs)
{
var ex = Should.Throw<CliFx.Exceptions.CommandException>(
() => SubscribeCommand.ValidateInterval(badMs));
ex.Message.ShouldContain("--interval-ms");
}
/// <summary>Verifies that validate interval accepts positive milliseconds.</summary>
/// <param name="goodMs">A positive interval value that should be accepted.</param>
[Theory]
[InlineData(1)]
[InlineData(250)]
[InlineData(60_000)]
public void ValidateInterval_accepts_positive(int goodMs)
{
Should.NotThrow(() => SubscribeCommand.ValidateInterval(goodMs));
}
}