chore(sonar): adopt Has.Count, Is.Empty, Does.Contain, char overloads in tests (NUnit2046, NUnit2011, CA1866)
- NUnit2046: `Assert.That(x.Count, Is.EqualTo(n))` → `Assert.That(x, Has.Count.EqualTo(n))` (or `Is.Empty` when n==0)
- NUnit2011: `Assert.That(s.Contains(x))` → `Assert.That(s, Does.Contain(x))` for richer failure messages
- CA1866: `.StartsWith("$"|"@"|":")` → `.StartsWith('$'|'@'|':')` char overload
Driven by `dotnet format analyzers --diagnostics NUnit2046 NUnit2011 CA1866`
for the cases the Roslyn fixer handles, plus a regex sweep for the remaining
`Count == n` (n>0) cases which the fixer doesn't address. CA1866 had no
associated code fix and was edited by hand (3 sites in 2 files). All tests
green (1180 passing).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
5aca8e93fd
commit
505ada5017
+5
-5
@@ -188,7 +188,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
Assert.That(query.SelectClause.Clause, Is.EqualTo("*"));
|
||||
Assert.That(query.FromClause.Clause, Is.EqualTo("active_users"));
|
||||
@@ -238,7 +238,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(2));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(2));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
Assert.That(query.WithClauses[1].TableName, Is.EqualTo("recent_orders"));
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(sql, Does.Contain("active_users (id, name, email)"));
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class QueryBreakdownExtensionsTests
|
||||
var sql = query.GetSql();
|
||||
|
||||
// Assert
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(2));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(2));
|
||||
Assert.That(sql, Does.Contain("active_users AS"));
|
||||
Assert.That(sql, Does.Contain("user_orders AS"));
|
||||
Assert.That(sql, Does.Contain("customer_tier"));
|
||||
|
||||
Reference in New Issue
Block a user