Files
lmxopcua/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests/Mapping/GatewayQualityMapperReverseTests.cs
T

23 lines
1011 B
C#

using Xunit;
using ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Mapping;
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway.Tests.Mapping;
public sealed class GatewayQualityMapperReverseTests
{
[Theory]
[InlineData((byte)192)] [InlineData((byte)216)]
[InlineData((byte)64)] [InlineData((byte)68)] [InlineData((byte)80)] [InlineData((byte)84)] [InlineData((byte)88)]
[InlineData((byte)0)] [InlineData((byte)4)] [InlineData((byte)8)] [InlineData((byte)12)]
[InlineData((byte)16)] [InlineData((byte)20)] [InlineData((byte)24)] [InlineData((byte)32)]
public void Round_trips_every_explicit_byte(byte q)
=> Assert.Equal(q, GatewayQualityMapper.ToDaQuality(GatewayQualityMapper.Map(q)));
[Theory]
[InlineData(0x00AB0000u, (byte)192)]
[InlineData(0x40AB0000u, (byte)64)]
[InlineData(0x80AB0000u, (byte)0)]
public void Unknown_status_falls_back_by_severity(uint status, byte expected)
=> Assert.Equal(expected, GatewayQualityMapper.ToDaQuality(status));
}