Some checks are pending
CI / Build og unit tests (push) Waiting to run
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
- .NET 10 solution with Core, Connectivity, Rules, Contracts, Agent, Web and Hub - Capability model gating collectors and rules by SQL Server version (2000 and later); rules that cannot run are reported as not measurable, never as passed - Connectivity via Microsoft.Data.SqlClient with ODBC fallback for legacy instances, hardened monitoring session settings valid back to SQL Server 2000 - Support lifecycle rule (SQLI-VER-001) with lifecycle data shipped as a rule pack - Version-aware least-privilege permissions script, verified by integration tests against SQL Server in Docker (reads monitoring sources, cannot read customer data) - Forgejo Actions CI, contributing guide, code of conduct, issue templates, legacy version notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E3EExwndy8Z22EK2Qpt6BK
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using SQLInsight.Core.Instances;
|
|
|
|
namespace SQLInsight.Core.Tests;
|
|
|
|
public class SqlServerVersionTests
|
|
{
|
|
[Theory]
|
|
[InlineData("8.00.2039", SqlServerRelease.SqlServer2000)]
|
|
[InlineData("9.00.5000.00", SqlServerRelease.SqlServer2005)]
|
|
[InlineData("10.0.6000.29", SqlServerRelease.SqlServer2008)]
|
|
[InlineData("10.50.6000.34", SqlServerRelease.SqlServer2008R2)]
|
|
[InlineData("11.0.7001.0", SqlServerRelease.SqlServer2012)]
|
|
[InlineData("12.0.6024.0", SqlServerRelease.SqlServer2014)]
|
|
[InlineData("13.0.6300.2", SqlServerRelease.SqlServer2016)]
|
|
[InlineData("14.0.3456.2", SqlServerRelease.SqlServer2017)]
|
|
[InlineData("15.0.4355.3", SqlServerRelease.SqlServer2019)]
|
|
[InlineData("16.0.4135.4", SqlServerRelease.SqlServer2022)]
|
|
[InlineData("17.0.1000.7", SqlServerRelease.SqlServer2025)]
|
|
[InlineData("18.0.100.1", SqlServerRelease.Unknown)]
|
|
public void Maps_product_version_to_release(string productVersion, SqlServerRelease expected)
|
|
{
|
|
Assert.Equal(expected, SqlServerVersion.Parse(productVersion).Release);
|
|
}
|
|
|
|
[Fact]
|
|
public void Parses_sql2000_style_version_with_three_parts()
|
|
{
|
|
Assert.Equal(new SqlServerVersion(8, 0, 2039, 0), SqlServerVersion.Parse("8.00.2039"));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("")]
|
|
[InlineData("sixteen")]
|
|
[InlineData("16")]
|
|
[InlineData("16.0.1.2.3")]
|
|
[InlineData("-16.0.1.2")]
|
|
public void Rejects_invalid_versions(string? value)
|
|
{
|
|
Assert.False(SqlServerVersion.TryParse(value, out _));
|
|
}
|
|
|
|
[Fact]
|
|
public void Compares_by_build_not_by_text()
|
|
{
|
|
Assert.True(SqlServerVersion.Parse("13.0.5026.0") > SqlServerVersion.Parse("13.0.4001.0"));
|
|
Assert.True(SqlServerVersion.Parse("10.50.1600.1") > SqlServerVersion.Parse("10.0.6000.29"));
|
|
Assert.True(SqlServerVersion.Parse("9.0.1399.6") < SqlServerVersion.Parse("10.0.1600.22"));
|
|
}
|
|
}
|