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
@@ -27,7 +27,7 @@ public class DateFunctionTests : ExpressionTestsBase
{
var sql = (string)result;
Assert.That(sql, Is.Not.Null);
Assert.That(sql.Length, Is.GreaterThan(0));
Assert.That(sql, Is.Not.Empty);
Assert.That(sql, Is.EqualTo("DATE_TRUNC('month', DATEADD('month', 6, PES.DISCHARGE_DATE))"));
return true;
}
@@ -52,7 +52,7 @@ public class ExpressionFactoryFilterTests : ExpressionTestsBase
// Assert
Assert.That(result, Is.Not.Null);
Assert.That(result.Length, Is.GreaterThan(0));
Assert.That(result, Is.Not.Empty);
Assert.That(result, Is.EqualTo(expectedSql));
}
}
@@ -65,9 +65,8 @@ public class GenericColumnExpressionTests : ExpressionTestsBase
Assertions = result =>
{
var results = (Dictionary<string, string>)result;
Assert.That(results["priceCondition"], Does.Contain("Price"));
Assert.That(results["priceCondition"], Does.Contain("100"));
Assert.That(results["categoryCondition"], Does.Contain("Category"));
Assert.That(results["priceCondition"], Does.Contain("Price")); Assert.Multiple(() => { Assert.That(results["priceCondition"], Does.Contain("100"));
Assert.That(results["categoryCondition"], Does.Contain("Category")); });
Assert.That(results["categoryCondition"], Does.Contain("Electronics"));
return true;
}
@@ -57,8 +57,11 @@ public class JsonTokenReaderTests
Assert.That(tokens[tokenIndex].Type, Is.EqualTo(JsonTokenType.Number));
Assert.That(tokens[tokenIndex++].Value, Is.EqualTo("1"));
});
Assert.That(tokens[tokenIndex].Type, Is.EqualTo(JsonTokenType.Number));
Assert.That(tokens[tokenIndex++].Value, Is.EqualTo("2"));
Assert.Multiple(() =>
{
Assert.That(tokens[tokenIndex].Type, Is.EqualTo(JsonTokenType.Number));
Assert.That(tokens[tokenIndex++].Value, Is.EqualTo("2"));
});
Assert.That(tokens[tokenIndex].Type, Is.EqualTo(JsonTokenType.Number));
Assert.That(tokens[tokenIndex++].Value, Is.EqualTo("3"));
Assert.That(tokens[tokenIndex].Type, Is.EqualTo(JsonTokenType.Number));
@@ -80,7 +80,7 @@ public class SqlBreakdownCollectionCreateTests : SqlBreakdownCollectionTestBase
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection.Count, Is.GreaterThanOrEqualTo(1));
Assert.That(collection, Is.Not.Empty);
Assert.That(collection.GetRawStatementAt(0), Does.Contain("CREATE PROCEDURE"));
}
}
@@ -71,7 +71,7 @@ public class SqlBreakdownCollectionDeleteTests : SqlBreakdownCollectionTestBase
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection.Count, Is.GreaterThanOrEqualTo(1));
Assert.That(collection, Is.Not.Empty);
Assert.That(collection.GetRawStatementAt(0), Does.Contain("DELETE Orders"));
Assert.That(collection.GetRawStatementAt(0), Does.Contain("INNER JOIN"));
}
@@ -58,7 +58,7 @@ public class SqlBreakdownCollectionSelectTests : SqlBreakdownCollectionTestBase
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection.Count, Is.GreaterThanOrEqualTo(1));
Assert.That(collection, Is.Not.Empty);
Assert.That(collection.GetRawStatementAt(0), Does.Contain("WITH UserOrders AS"));
}
@@ -29,7 +29,7 @@ public class SqlBreakdownCollectionTransactionTests : SqlBreakdownCollectionTest
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection.Count, Is.GreaterThanOrEqualTo(1));
Assert.That(collection, Is.Not.Empty);
var statement = collection.GetRawStatementAt(0);
Assert.That(statement, Does.Contain("BEGIN TRANSACTION"));
Assert.That(statement, Does.Contain("COMMIT"));
@@ -80,7 +80,7 @@ public class SqlBreakdownCollectionUpdateTests : SqlBreakdownCollectionTestBase
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection.Count, Is.GreaterThanOrEqualTo(1));
Assert.That(collection, Is.Not.Empty);
Assert.That(collection.GetRawStatementAt(0), Does.Contain("UPDATE Orders"));
Assert.That(collection.GetRawStatementAt(0), Does.Contain("JOIN"));
}