节点在线、应用在线、配置在线使用令牌查询
大石头 authored at 2021-12-16 19:49:30
767.00 B
Stardust
#nullable enable
using System;
using Stardust.Server.Services;
using Xunit;

namespace ServerTest.Services;

/// <summary>客户端标识异常判定测试。标识缺少主机段时单独告警,避免旧版客户端反复重连被忽略</summary>
public class AlarmServiceClientIdTests
{
    [Theory(DisplayName = "缺少主机段的客户端标识被判为异常")]
    [InlineData("@1234", true)]
    [InlineData("@", true)]
    [InlineData("10.0.0.1@1234", false)]
    [InlineData("host-a@1234", false)]
    [InlineData("10.0.0.1", false)]
    [InlineData("", false)]
    [InlineData(null, false)]
    public void IsAbnormalClientId_Cases(String? client, Boolean expected)
    {
        Assert.Equal(expected, AlarmService.IsAbnormalClientId(client!));
    }
}