sqlinsight-pro/tests/SQLInsight.Rules.Tests/RuleCatalogTests.cs
Claude edb7410f76
Some checks are pending
CI / Integration (mcr.microsoft.com/mssql/server:2017-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2019-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2022-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2025-latest) (push) Blocked by required conditions
CI / Build og unit tests (push) Waiting to run
Fase 2: Azure SQL Managed Instance, docs and rule catalog test
- Managed Instance reports 12.0.2000.8 but is evergreen: treated as the
  newest engine with all capabilities; new SelfManagedInfrastructure
  capability so backup, CHECKDB, files, tempdb, memory, patch level and
  lifecycle rules report 'handled by Azure' instead of false findings
- Microsoft Entra ID login (managed identity, service principal, default
  credential chain) via SqlConnection.AccessTokenCallback
- Least-privilege script recognizes Managed Instance; deadlock collector
  falls back to the ring buffer when event files cannot be read
- Web UI shows the right release for Managed Instance
- README and installation docs: notifications and Managed Instance
- Catalog test: 61 rules with unique, well-formed ids

Integration suite green on SQL Server 2017 and 2022.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E3EExwndy8Z22EK2Qpt6BK
2026-09-29 08:23:40 +00:00

23 lines
676 B
C#

using SQLInsight.Rules.Engine;
namespace SQLInsight.Rules.Tests;
public class RuleCatalogTests
{
[Fact]
public void Every_rule_has_a_unique_well_formed_id()
{
var rules = BuiltInRules.Create();
Assert.Equal(rules.Count, rules.Select(r => r.Id).Distinct(StringComparer.OrdinalIgnoreCase).Count());
Assert.All(rules, r => Assert.Matches("^SQLI-[A-Z]+-[0-9]{3}$", r.Id));
Assert.All(rules, r => Assert.False(string.IsNullOrWhiteSpace(r.Title)));
}
/// <summary>Keeps the rule count in the README honest.</summary>
[Fact]
public void Rule_count()
{
Assert.Equal(61, BuiltInRules.Create().Count);
}
}