chore(sonar): second sweep — catch .Length, Is.Not.Empty, and newly-exposed Multiple groups (NUnit2046, NUnit2045)
SonarQube Analysis / sonarqube (pull_request) Successful in 2m59s

Re-runs `dotnet format analyzers --diagnostics NUnit2046 NUnit2045` after
the Tier 2 Assert.Multiple wrap, which exposed:

- `Has.Length.EqualTo(n)` rewrites for `string[]`/array `.Length` checks
  (the first pass only knew about `.Count`).
- `Is.Not.Empty` rewrites for `Count, Is.GreaterThan(0)`.
- A handful of new NUnit2045 groups that became wrappable once the
  initial Multiple blocks settled the surrounding indentation.

Tests still 1180/1180 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-27 12:14:13 -05:00
co-authored by Claude Opus 4.7
parent 470cb009b9
commit 4fe9eb36e6
18 changed files with 50 additions and 39 deletions
@@ -247,7 +247,7 @@ public class QueryBreakdownCollectionTests
var report = _collection.GetParameterUsageReport().ToList();
// Assert
Assert.That(report.Count, Is.GreaterThan(0));
Assert.That(report, Is.Not.Empty);
var userIdReport = report.FirstOrDefault(r => r.ParameterName == "UserId");
Assert.That(userIdReport, Is.Not.Null);
Assert.That(userIdReport?.UsedInQueryCount, Is.EqualTo(2));
@@ -127,7 +127,7 @@ public class QueryBreakdownTests
// Verify 4-space Snowflake indentation
var lines = sql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
var indentedLines = lines.Where(l => l.StartsWith(" ")).ToList();
Assert.That(indentedLines.Count, Is.GreaterThan(0));
Assert.That(indentedLines, Is.Not.Empty);
}
[Test]
@@ -306,10 +306,13 @@ public class QueryBreakdownTests
Assert.That(withIndex, Is.GreaterThan(-1));
Assert.That(mainSelectIndex, Is.GreaterThan(-1));
});
Assert.That(withIndex, Is.LessThan(mainSelectIndex));
Assert.Multiple(() =>
{
Assert.That(withIndex, Is.LessThan(mainSelectIndex));
// Assert - Verify CTE definition
Assert.That(sql, Does.Contain("PRODUCT_TOTALS"));
// Assert - Verify CTE definition
Assert.That(sql, Does.Contain("PRODUCT_TOTALS"));
});
Assert.That(sql, Does.Contain("AS"));
Assert.That(sql, Does.Contain("PRODUCT_ID"));
Assert.That(sql, Does.Contain("TOTAL_QUANTITY"));
@@ -457,7 +460,7 @@ public class QueryBreakdownTests
// Assert
// Main query value should win
var keys = merged.Keys.Where(k => k.Contains("QueryLimit")).ToList();
Assert.That(keys.Count, Is.GreaterThan(0));
Assert.That(keys, Is.Not.Empty);
// All QueryLimit entries should be 100 (main query's value)
foreach (var key in keys)
{
@@ -614,7 +617,7 @@ public class QueryBreakdownTests
var queryBreakdown = QueryBreakdown.Parse(sql, false);
// Assert
Assert.That(queryBreakdown.Parameters.Count, Is.GreaterThan(0));
Assert.That(queryBreakdown.Parameters, Is.Not.Empty);
}
[Test]
@@ -1070,7 +1073,7 @@ public class QueryBreakdownTests
// Assert
// Base class normalizes to @, but Snowflake might handle differently
Assert.That(queryBreakdown.Parameters.Count, Is.GreaterThan(0));
Assert.That(queryBreakdown.Parameters, Is.Not.Empty);
}
#endregion
@@ -1188,7 +1191,7 @@ public class QueryBreakdownTests
// Assert - Snowflake should use 4-space indent, base uses 5-space
var snowflakeLines = snowflakeSql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
var snowflakeIndentedLines = snowflakeLines.Where(l => l.StartsWith(" ") && !l.StartsWith(" ")).ToList();
Assert.That(snowflakeIndentedLines.Count, Is.GreaterThan(0), "Snowflake should use 4-space indentation");
Assert.That(snowflakeIndentedLines, Is.Not.Empty, "Snowflake should use 4-space indentation");
}
#endregion
@@ -1407,7 +1410,7 @@ public class QueryBreakdownTests
// Verify Snowflake-style formatting (4-space indentation)
var lines = snowflakeSql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
var indentedLines = lines.Where(l => l.StartsWith(" ")).ToList();
Assert.That(indentedLines.Count, Is.GreaterThan(0), "Should have Snowflake-style indentation");
Assert.That(indentedLines, Is.Not.Empty, "Should have Snowflake-style indentation");
}
[Test]