Files
lmxopcua/tests/ZB.MOM.WW.LmxOpcUa.Tests/Domain/SecurityClassificationMapperTests.cs
Joseph Doherty 415e62c585 Add security classification, alarm detection, historical data access, and primitive grouping
Wire Galaxy security_classification to OPC UA AccessLevel (ReadOnly for SecuredWrite/VerifiedWrite/ViewOnly).
Use deployed package chain for attribute queries to exclude undeployed attributes.
Group primitive attributes under their parent variable node (merged Variable+Object).
Add is_historized and is_alarm detection via HistoryExtension/AlarmExtension primitives.
Implement OPC UA HistoryRead backed by Wonderware Historian Runtime database.
Implement AlarmConditionState nodes driven by InAlarm with condition refresh support.
Add historyread and alarms CLI commands for testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:32:33 -04:00

38 lines
1.1 KiB
C#

using Shouldly;
using Xunit;
using ZB.MOM.WW.LmxOpcUa.Host.Domain;
namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain
{
public class SecurityClassificationMapperTests
{
[Theory]
[InlineData(0, true)] // FreeAccess
[InlineData(1, true)] // Operate
[InlineData(4, true)] // Tune
[InlineData(5, true)] // Configure
public void Writable_SecurityLevels(int classification, bool expected)
{
SecurityClassificationMapper.IsWritable(classification).ShouldBe(expected);
}
[Theory]
[InlineData(2, false)] // SecuredWrite
[InlineData(3, false)] // VerifiedWrite
[InlineData(6, false)] // ViewOnly
public void ReadOnly_SecurityLevels(int classification, bool expected)
{
SecurityClassificationMapper.IsWritable(classification).ShouldBe(expected);
}
[Theory]
[InlineData(-1)]
[InlineData(7)]
[InlineData(99)]
public void Unknown_Values_DefaultToWritable(int classification)
{
SecurityClassificationMapper.IsWritable(classification).ShouldBeTrue();
}
}
}