using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol; namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Interfaces.Protocol; /// /// Single-source-of-truth coverage for . /// The OpcUa/MxGateway literal set previously lived inline in the Central UI /// (TemplateEdit / InstanceConfigure); those copies were collapsed into this helper, /// so the literal set is pinned here rather than against page markup. Keep this in /// sync with the alarm-subscribable adapters registered in DataConnectionFactory. /// public class AlarmCapableProtocolsTests { /// Verifies that alarm-subscribable protocols are reported as alarm capable. /// The protocol name under test. [Theory] [InlineData("OpcUa")] [InlineData("opcua")] // case-insensitive — matches DataConnectionFactory's OrdinalIgnoreCase key lookup [InlineData("OPCUA")] [InlineData("MxGateway")] [InlineData("mxgateway")] public void IsAlarmCapable_True_ForAlarmSubscribableProtocols(string protocol) { Assert.True(AlarmCapableProtocols.IsAlarmCapable(protocol)); } /// Verifies that non-alarm-capable, null or blank protocols are not reported as alarm capable. /// The protocol name under test. [Theory] [InlineData(null)] [InlineData("")] [InlineData(" ")] [InlineData("ModbusTcp")] [InlineData("Custom")] [InlineData("Opc")] // partial / prefix must not match public void IsAlarmCapable_False_ForNonAlarmCapableOrBlank(string? protocol) { Assert.False(AlarmCapableProtocols.IsAlarmCapable(protocol)); } }