using Shouldly; using Xunit; using ZB.MOM.WW.LmxOpcUa.Host.Domain; namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain { public class SecurityClassificationMapperTests { /// /// Verifies that Galaxy classifications intended for operator and engineering writes remain writable through OPC UA. /// /// The Galaxy security classification value being evaluated for write access. /// The expected writable result for the supplied Galaxy classification. [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); } /// /// Verifies that secured or view-only Galaxy classifications are exposed as read-only attributes. /// /// The Galaxy security classification value expected to block writes. /// The expected writable result for the supplied read-only Galaxy classification. [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); } /// /// Verifies that unknown security classifications do not accidentally block writes for unmapped Galaxy values. /// /// /// An unmapped Galaxy security classification value that should fall back to writable /// behavior. /// [Theory] [InlineData(-1)] [InlineData(7)] [InlineData(99)] public void Unknown_Values_DefaultToWritable(int classification) { SecurityClassificationMapper.IsWritable(classification).ShouldBeTrue(); } } }