Severity: Info
File: tests/Servy.Infrastructure.UnitTests/Helpers/DatabaseValidatorTests.cs lines 15–25
Description:
IsSqliteVersionSafe_CurrentEnvironment_ShouldMatchExpectation is written as a regular [Fact] but its outcome depends entirely on the SQLite version shipped in the binaries of the machine running the test:
if (isSafe)
{
Assert.True(Version.TryParse(detectedVersion, out var version));
Assert.True(version >= AppConfig.MinRequiredSqliteVersion);
}
else
{
// If it fails, we want to know what version caused the failure in the test logs
Assert.Fail($"Environment is unsafe. Detected: {detectedVersion}. Required: {AppConfig.MinRequiredSqliteVersion}");
}
Two problems:
- A developer on an older Windows box (or a CI worker with a bundled older
System.Data.SQLite transitive dep) gets a red test for an environment issue, not a code issue. The Assert.Fail message is helpful but the failure mode conflates "code broken" with "box misconfigured".
- The companion
[Theory] SQLiteVersionComparison_LogicCheck (line 30+) already covers the pure logic (threshold comparison, invalid strings). The environment check is not earning its keep as a unit test — it belongs in an integration suite.
Suggested fix:
Convert the environment-check case to one of:
- A
[Trait("Category", "Integration")] test so the CI run can filter it in/out explicitly.
- An
[SkippableFact] using Xunit.SkippableFact that Skip.IfNot(isSafe, ...) and asserts the shape of detectedVersion rather than the comparison result.
- A
[Fact] that only asserts Version.TryParse(detectedVersion, out _) — the detector works even if the installed version is behind the floor — and move the "is the installed version ≥ floor?" assertion to a deployment-gate check outside the unit test suite.
Severity: Info
File:
tests/Servy.Infrastructure.UnitTests/Helpers/DatabaseValidatorTests.cslines 15–25Description:
IsSqliteVersionSafe_CurrentEnvironment_ShouldMatchExpectationis written as a regular[Fact]but its outcome depends entirely on the SQLite version shipped in the binaries of the machine running the test:Two problems:
System.Data.SQLitetransitive dep) gets a red test for an environment issue, not a code issue. The Assert.Fail message is helpful but the failure mode conflates "code broken" with "box misconfigured".[Theory]SQLiteVersionComparison_LogicCheck(line 30+) already covers the pure logic (threshold comparison, invalid strings). The environment check is not earning its keep as a unit test — it belongs in an integration suite.Suggested fix:
Convert the environment-check case to one of:
[Trait("Category", "Integration")]test so the CI run can filter it in/out explicitly.[SkippableFact]using Xunit.SkippableFact thatSkip.IfNot(isSafe, ...)and asserts the shape ofdetectedVersionrather than the comparison result.[Fact]that only assertsVersion.TryParse(detectedVersion, out _)— the detector works even if the installed version is behind the floor — and move the "is the installed version ≥ floor?" assertion to a deployment-gate check outside the unit test suite.