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
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.
34 lines
1.5 KiB
C#
34 lines
1.5 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.S7.Cli.Tests;
|
|
|
|
/// <summary>
|
|
/// Driver.S7.Cli-007: the S7 subscribe command — a near-verbatim copy of the Modbus
|
|
/// subscribe command — must keep the comment that explains why <c>OnDataChange</c>
|
|
/// uses <c>console.Output.WriteLine</c> (synchronous, on a driver background thread)
|
|
/// instead of <c>System.Console</c> or the async <c>WriteLineAsync</c>. The rationale
|
|
/// is non-obvious to a reader and the Modbus copy carries it; the S7 copy must too.
|
|
/// </summary>
|
|
[Trait("Category", "Unit")]
|
|
public sealed class SubscribeCommandConsoleHandlerCommentTests
|
|
{
|
|
/// <summary>Verifies that SubscribeCommand explains why OnDataChange uses console.Output synchronously.</summary>
|
|
[Fact]
|
|
public void SubscribeCommand_explains_why_OnDataChange_uses_console_Output_synchronously()
|
|
{
|
|
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
|
while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "ZB.MOM.WW.OtOpcUa.slnx")))
|
|
dir = dir.Parent;
|
|
dir.ShouldNotBeNull();
|
|
var source = File.ReadAllText(Path.Combine(
|
|
dir!.FullName, "src", "Drivers", "Cli", "ZB.MOM.WW.OtOpcUa.Driver.S7.Cli",
|
|
"Commands", "SubscribeCommand.cs"));
|
|
|
|
// The comment must reference the CliFx console abstraction so future copy-pastes
|
|
// do not lose the rationale.
|
|
source.ShouldContain("CliFx console");
|
|
source.ShouldContain("IConsole");
|
|
}
|
|
}
|