减少TraceItem数据量较大时的性能浪费
智能大石头 authored at 2024-10-22 08:41:14
446.00 B
Stardust
using Stardust.Data.Monitors;
using Xunit;

namespace Stardust.ServerTests;

public class TraceRuleTests
{
    [Fact]
    public void GetOrAddItem()
    {
        var name = "/Admin/Menu/Index";
        var rule = TraceRule.Match(name);
        Assert.NotNull(rule);

        var app = AppTracer.FindByName("StarWeb");
        var ti = app.GetOrAddItem(name, rule?.IsWhite);
        Assert.NotNull(ti);
        Assert.True(ti.Enable);
    }
}