diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests/OpcUaClientAttributeMappingTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests/OpcUaClientAttributeMappingTests.cs index 700ef4a..3234754 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests/OpcUaClientAttributeMappingTests.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests/OpcUaClientAttributeMappingTests.cs @@ -10,6 +10,8 @@ public sealed class OpcUaClientAttributeMappingTests { [Theory] [InlineData((uint)DataTypes.Boolean, DriverDataType.Boolean)] + [InlineData((uint)DataTypes.SByte, DriverDataType.Int16)] + [InlineData((uint)DataTypes.Byte, DriverDataType.UInt16)] [InlineData((uint)DataTypes.Int16, DriverDataType.Int16)] [InlineData((uint)DataTypes.UInt16, DriverDataType.UInt16)] [InlineData((uint)DataTypes.Int32, DriverDataType.Int32)] @@ -27,12 +29,19 @@ public sealed class OpcUaClientAttributeMappingTests } [Fact] - public void MapUpstreamDataType_maps_SByte_and_Byte_to_Int16_since_DriverDataType_lacks_8bit() + public void MapUpstreamDataType_maps_SByte_to_Int16_since_DriverDataType_lacks_8bit_signed() { - // DriverDataType has no 8-bit type; conservative widen to Int16. Documented so a - // future Core.Abstractions PR that adds Int8/Byte can find this call site. + // SByte (signed 8-bit) has no narrower signed type in DriverDataType; widen to Int16. OpcUaClientDriver.MapUpstreamDataType(new NodeId((uint)DataTypes.SByte)).ShouldBe(DriverDataType.Int16); - OpcUaClientDriver.MapUpstreamDataType(new NodeId((uint)DataTypes.Byte)).ShouldBe(DriverDataType.Int16); + } + + [Fact] + public void MapUpstreamDataType_maps_Byte_to_UInt16_not_Int16() + { + // Driver.OpcUaClient-010: Byte is unsigned 0-255 and must map to the unsigned family + // (UInt16), NOT Int16. The old mapping misrepresented type metadata for downstream + // clients and range/validation logic keyed off DriverDataType. + OpcUaClientDriver.MapUpstreamDataType(new NodeId((uint)DataTypes.Byte)).ShouldBe(DriverDataType.UInt16); } [Fact]