Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
2.6 KiB
C#
69 lines
2.6 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Driver.AbLegacy;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests;
|
|
|
|
[Trait("Category", "Unit")]
|
|
public sealed class AbLegacyHostAndStatusTests
|
|
{
|
|
[Theory]
|
|
[InlineData("ab://10.0.0.5/1,0", "10.0.0.5", 44818, "1,0")]
|
|
[InlineData("ab://10.0.0.5/", "10.0.0.5", 44818, "")]
|
|
[InlineData("ab://10.0.0.5:2222/1,0", "10.0.0.5", 2222, "1,0")]
|
|
[InlineData("ab://plc-slc.factory/1,2", "plc-slc.factory", 44818, "1,2")]
|
|
public void HostAddress_parses_valid(string input, string gateway, int port, string path)
|
|
{
|
|
var parsed = AbLegacyHostAddress.TryParse(input);
|
|
parsed.ShouldNotBeNull();
|
|
parsed.Gateway.ShouldBe(gateway);
|
|
parsed.Port.ShouldBe(port);
|
|
parsed.CipPath.ShouldBe(path);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("http://10.0.0.5/1,0")]
|
|
[InlineData("ab://10.0.0.5")]
|
|
[InlineData("ab:///1,0")]
|
|
[InlineData("ab://10.0.0.5:0/1,0")]
|
|
public void HostAddress_rejects_invalid(string? input)
|
|
{
|
|
AbLegacyHostAddress.TryParse(input).ShouldBeNull();
|
|
}
|
|
|
|
[Fact]
|
|
public void HostAddress_ToString_canonicalises()
|
|
{
|
|
new AbLegacyHostAddress("10.0.0.5", 44818, "1,0").ToString().ShouldBe("ab://10.0.0.5/1,0");
|
|
new AbLegacyHostAddress("10.0.0.5", 2222, "1,0").ToString().ShouldBe("ab://10.0.0.5:2222/1,0");
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData((byte)0x00, AbLegacyStatusMapper.Good)]
|
|
[InlineData((byte)0x10, AbLegacyStatusMapper.BadNotSupported)]
|
|
[InlineData((byte)0x20, AbLegacyStatusMapper.BadNodeIdUnknown)]
|
|
[InlineData((byte)0x30, AbLegacyStatusMapper.BadNotWritable)]
|
|
[InlineData((byte)0x40, AbLegacyStatusMapper.BadDeviceFailure)]
|
|
[InlineData((byte)0x50, AbLegacyStatusMapper.BadDeviceFailure)]
|
|
[InlineData((byte)0xF0, AbLegacyStatusMapper.BadInternalError)]
|
|
[InlineData((byte)0xFF, AbLegacyStatusMapper.BadCommunicationError)]
|
|
public void PcccStatus_maps_known_codes(byte sts, uint expected)
|
|
{
|
|
AbLegacyStatusMapper.MapPcccStatus(sts).ShouldBe(expected);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0, AbLegacyStatusMapper.Good)]
|
|
[InlineData(1, AbLegacyStatusMapper.GoodMoreData)]
|
|
[InlineData(-5, AbLegacyStatusMapper.BadTimeout)]
|
|
[InlineData(-7, AbLegacyStatusMapper.BadCommunicationError)]
|
|
[InlineData(-14, AbLegacyStatusMapper.BadNodeIdUnknown)]
|
|
[InlineData(-16, AbLegacyStatusMapper.BadNotWritable)]
|
|
[InlineData(-17, AbLegacyStatusMapper.BadOutOfRange)]
|
|
public void LibplctagStatus_maps_known_codes(int status, uint expected)
|
|
{
|
|
AbLegacyStatusMapper.MapLibplctagStatus(status).ShouldBe(expected);
|
|
}
|
|
}
|