chore(sonar): clear residual test-file smells (NUnit2046, NUnit2045, CS8604)
SonarQube Analysis / sonarqube (pull_request) Successful in 3m41s

- **NUnit2046 (15)**: extend the prior regex sweep to also catch the
  `Is.GreaterThan(n)` / `Is.GreaterThanOrEqualTo(n)` variants on
  `.Count` and `.Length` — the previous pass only handled `Is.EqualTo`.
  Affects PG/Snowflake `QueryBreakdownTests`, PG `StatementReaderTests`,
  `LinqToSql` `QueryComparatorTests` / `QueryValidatorTests`,
  `Markdown.Tests` `ExpressionGeneratorTests` /
  `QueryBreakdownGeneratorTests`, and `JsonTokenReaderTests`.

- **CS8604 (8)**: `merged[someKey]` access inside `Assert.Multiple(() =>
  { ... })` lambdas where `someKey` is `string?` from `FirstOrDefault`.
  The preceding `Assert.That(someKey, Is.Not.Null)` does not propagate
  null-narrowing into the lambda scope, so add `!` to the dictionary
  index. (Tests fail loud with a meaningful message if the key really
  is null, so this is safe.)

- **NUnit2045 (1)**: wrap a four-assert block in
  `JsonTokenReaderTests.cs:65-68` in `Assert.Multiple`. Mirrors the
  surrounding two `Assert.Multiple` groups in that method.

All 1180 tests stay green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-27 15:29:20 -05:00
co-authored by Claude Opus 4.7
parent 1345a9219e
commit f55d8130e6
12 changed files with 23 additions and 23 deletions
@@ -110,7 +110,7 @@ public class LinqQueryBreakdownWithClauseTests
Assert.Multiple(() =>
{
Assert.That(valueKey, Is.Not.Null, "Should have a Value parameter");
Assert.That(merged[valueKey], Is.EqualTo("main_value"), "Main query parameter should take precedence");
Assert.That(merged[valueKey!], Is.EqualTo("main_value"), "Main query parameter should take precedence");
});
}
@@ -236,7 +236,7 @@ public class QueryComparatorTests
var comparator = QueryComparator.Compare(query1, query2);
// Assert
Assert.That(comparator.Differences.Count, Is.GreaterThan(2));
Assert.That(comparator.Differences, Has.Count.GreaterThan(2));
Assert.That(comparator.Differences, Does.Contain("SELECT clauses differ"));
Assert.That(comparator.Differences, Does.Contain("FROM clauses differ"));
}
@@ -495,7 +495,7 @@ public class QueryValidatorTests
Assert.Multiple(() =>
{
// Assert
Assert.That(validator.Issues.Count, Is.GreaterThan(1));
Assert.That(validator.Issues, Has.Count.GreaterThan(1));
Assert.That(validator.HasWarnings, Is.True);
});
}