using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol;

namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Interfaces.Protocol;

/// <summary>
/// Single-source-of-truth coverage for <see cref="AlarmCapableProtocols.IsAlarmCapable"/>.
/// The OpcUa/MxGateway literal set previously lived inline in the Central UI
/// (TemplateEdit / InstanceConfigure); #53 collapsed those copies 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.
/// </summary>
public class AlarmCapableProtocolsTests
{
    [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));
    }

    [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));
    }
}
